--- /srv/reproducible-results/rbuild-debian/r-b-build.thXoaZzz/b1/dune-grid-glue_2.9.0-3_amd64.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.thXoaZzz/b2/dune-grid-glue_2.9.0-3_amd64.changes ├── Files │ @@ -1,4 +1,4 @@ │ │ 7371a9b40fec9397734c4ad86964d353 907748 debug optional libdune-grid-glue-dev-dbgsym_2.9.0-3_amd64.deb │ eed4fdc49cf2d338ba95fb096b3b3e67 106376 libdevel optional libdune-grid-glue-dev_2.9.0-3_amd64.deb │ - 36867d3a38ba30d51e91b1fadb2e53ca 959460 doc optional libdune-grid-glue-doc_2.9.0-3_all.deb │ + 34b5576e5624ae572ffd4b03ba4ef328 958852 doc optional libdune-grid-glue-doc_2.9.0-3_all.deb ├── libdune-grid-glue-doc_2.9.0-3_all.deb │ ├── file list │ │ @@ -1,3 +1,3 @@ │ │ -rw-r--r-- 0 0 0 4 2023-01-13 13:23:40.000000 debian-binary │ │ --rw-r--r-- 0 0 0 7396 2023-01-13 13:23:40.000000 control.tar.xz │ │ --rw-r--r-- 0 0 0 951872 2023-01-13 13:23:40.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 7416 2023-01-13 13:23:40.000000 control.tar.xz │ │ +-rw-r--r-- 0 0 0 951244 2023-01-13 13:23:40.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ │ │ │ ├── line order │ │ │ │ │ @@ -42,14 +42,15 @@ │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html │ │ │ │ │ +usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html │ │ │ │ │ @@ -57,15 +58,14 @@ │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00089.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00089_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html │ │ │ │ │ -usr/share/doc/libdune-grid-glue-doc/doxygen/a00092_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00095_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00101.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00103.html │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00104.html │ ├── data.tar.xz │ │ ├── data.tar │ │ │ ├── file list │ │ │ │ @@ -5,77 +5,77 @@ │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/ │ │ │ │ -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 │ │ │ │ -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 │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2569 2023-01-12 15:07:38.000000 ./usr/share/doc/libdune-grid-glue-doc/copyright │ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7138 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 81665 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5609 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 84446 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8112 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 119797 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5797 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 52527 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5321 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16899 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5088 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 16768 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5453 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 27383 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10871 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 70887 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6157 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 14373 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5980 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 27621 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8136 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 72681 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5360 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8500 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8222 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 30066 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11613 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 39771 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7675 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11025 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 7370 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 44830 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6619 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 9138 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5453 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 27383 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6157 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 14373 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5321 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16899 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10871 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 70887 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8112 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 119797 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5797 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 52527 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5088 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 16768 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5609 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 84446 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11613 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 39771 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6619 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 9138 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7370 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 44830 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5980 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 27621 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5360 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8500 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8222 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 30066 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8136 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 72681 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 7675 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11025 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5429 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 44826 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5562 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 72929 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5388 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 50226 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 8206 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 96800 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5357 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 22694 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 10146 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 8206 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 96800 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5562 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 72929 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5388 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 50226 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5484 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 36322 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 12399 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 149554 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 4559 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 63705 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 11543 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 239992 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 12399 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 149554 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6080 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 59845 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6647 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 36462 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5930 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 19310 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5484 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 36322 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 4310 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 55659 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 6348 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 45998 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095_source.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 5967 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html │ │ │ │ --rw-r--r-- 0 root (0) root (0) 37342 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5357 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 22694 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 4310 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 55659 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5967 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 37342 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6080 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 59845 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 11543 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 239992 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6348 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 45998 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 10146 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 5930 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 19310 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095_source.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 6647 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 36462 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5859 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00101.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 4619 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00103.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 67072 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00104.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 5774 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00105.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 15143 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00106.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 13626 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00107.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 6280 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00108.html │ │ │ │ @@ -226,15 +226,15 @@ │ │ │ │ -rw-r--r-- 0 root (0) root (0) 6780 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_65f347cff0208f20f00d27c542208238.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 2198 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_65f347cff0208f20f00d27c542208238_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7640 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_68eff8a27dcb1cd0ff0ecf490070d3de.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 13471 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_68eff8a27dcb1cd0ff0ecf490070d3de_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 6670 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_eaad0bdad6fc03850e65b1fdad9faad4.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7018 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_eaad0bdad6fc03850e65b1fdad9faad4_dep.png │ │ │ │ -rw-r--r-- 0 root (0) root (0) 45631 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/doxygen.css │ │ │ │ --rw-r--r-- 0 root (0) root (0) 27052 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz │ │ │ │ +-rw-r--r-- 0 root (0) root (0) 27050 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz │ │ │ │ -rw-r--r-- 0 root (0) root (0) 7704 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dynsections.js │ │ │ │ -rw-r--r-- 0 root (0) root (0) 15973 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/files.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3221 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 3786 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_b.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 13456 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_c.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 4846 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_d.html │ │ │ │ -rw-r--r-- 0 root (0) root (0) 6112 2023-01-13 13:23:40.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_e.html │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html │ │ │ │ @@ -87,28 +87,28 @@ │ │ │ │ #include <type_traits>
│ │ │ │ #include <dune/common/deprecated.hh>
│ │ │ │ #include <dune/common/exceptions.hh>
│ │ │ │ #include <dune/common/iteratorfacades.hh>
│ │ │ │ #include <dune/common/promotiontraits.hh>
│ │ │ │ #include <dune/common/shared_ptr.hh>
│ │ │ │ #include <dune/common/stdstreams.hh>
│ │ │ │ -#include "adapter/gridgluecommunicate.hh"
│ │ │ │ -#include <dune/grid-glue/merging/merger.hh>
│ │ │ │ +#include "adapter/gridgluecommunicate.hh"
│ │ │ │ +#include <dune/grid-glue/merging/merger.hh>
│ │ │ │ #include <dune/common/parallel/mpitraits.hh>
│ │ │ │ #include <dune/common/parallel/mpicommunication.hh>
│ │ │ │ #include <dune/common/parallel/indexset.hh>
│ │ │ │ #include <dune/common/parallel/plocalindex.hh>
│ │ │ │ #include <dune/common/parallel/remoteindices.hh>
│ │ │ │ #include <dune/common/parallel/communicator.hh>
│ │ │ │ #include <dune/common/parallel/interface.hh>
│ │ │ │ -#include "adapter/rangegenerators.hh"
│ │ │ │ -#include "adapter/gridglue.cc"
│ │ │ │ -#include "adapter/intersection.hh"
│ │ │ │ -#include "adapter/intersectioniterator.hh"
│ │ │ │ -#include "adapter/intersectionindexset.hh"
│ │ │ │ +#include "adapter/rangegenerators.hh"
│ │ │ │ +#include "adapter/gridglue.cc"
│ │ │ │ +#include "adapter/intersection.hh"
│ │ │ │ +#include "adapter/intersectioniterator.hh"
│ │ │ │ +#include "adapter/intersectionindexset.hh"
│ │ │ │ │ │ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html │ │ │ │ @@ -95,16 +95,16 @@ │ │ │ │
19#include <dune/common/deprecated.hh>
│ │ │ │
20#include <dune/common/exceptions.hh>
│ │ │ │
21#include <dune/common/iteratorfacades.hh>
│ │ │ │
22#include <dune/common/promotiontraits.hh>
│ │ │ │
23#include <dune/common/shared_ptr.hh>
│ │ │ │
24#include <dune/common/stdstreams.hh>
│ │ │ │
25
│ │ │ │ -
26#include "adapter/gridgluecommunicate.hh"
│ │ │ │ -
27#include <dune/grid-glue/merging/merger.hh>
│ │ │ │ +
26#include "adapter/gridgluecommunicate.hh"
│ │ │ │ +
27#include <dune/grid-glue/merging/merger.hh>
│ │ │ │
28
│ │ │ │
29#include <dune/common/parallel/mpitraits.hh>
│ │ │ │
30#include <dune/common/parallel/mpicommunication.hh>
│ │ │ │
31#include <dune/common/parallel/indexset.hh>
│ │ │ │
32#include <dune/common/parallel/plocalindex.hh>
│ │ │ │
33#include <dune/common/parallel/remoteindices.hh>
│ │ │ │
34#include <dune/common/parallel/communicator.hh>
│ │ │ │ @@ -391,30 +391,30 @@ │ │ │ │ │ │ │ │
399
│ │ │ │
400} // end namespace GridGlue
│ │ │ │ │ │ │ │
401} // end namespace Dune
│ │ │ │ │ │ │ │
402
│ │ │ │ -
403#include "adapter/rangegenerators.hh"
│ │ │ │ +
403#include "adapter/rangegenerators.hh"
│ │ │ │
404
│ │ │ │ -
405#include "adapter/gridglue.cc"
│ │ │ │ +
405#include "adapter/gridglue.cc"
│ │ │ │
406
│ │ │ │ -
407#include "adapter/intersection.hh"
│ │ │ │ -
408#include "adapter/intersectioniterator.hh"
│ │ │ │ -
409#include "adapter/intersectionindexset.hh"
│ │ │ │ +
407#include "adapter/intersection.hh"
│ │ │ │ +
408#include "adapter/intersectioniterator.hh"
│ │ │ │ +
409#include "adapter/intersectionindexset.hh"
│ │ │ │
410
│ │ │ │
411#endif // DUNE_GRIDGLUE_GRIDGLUE_HH
│ │ │ │ -
gridglue.cc
│ │ │ │ -
intersection.hh
Model of the Intersection concept provided by GridGlue.
│ │ │ │ -
intersectioniterator.hh
Implement iterators over GridGlue intersections.
│ │ │ │ -
intersectionindexset.hh
│ │ │ │ -
gridgluecommunicate.hh
Describes the parallel communication interface class for Dune::GridGlue.
│ │ │ │ -
rangegenerators.hh
│ │ │ │ -
merger.hh
│ │ │ │ +
rangegenerators.hh
│ │ │ │ +
intersectioniterator.hh
Implement iterators over GridGlue intersections.
│ │ │ │ +
gridgluecommunicate.hh
Describes the parallel communication interface class for Dune::GridGlue.
│ │ │ │ +
intersection.hh
Model of the Intersection concept provided by GridGlue.
│ │ │ │ +
intersectionindexset.hh
│ │ │ │ +
gridglue.cc
│ │ │ │ +
merger.hh
│ │ │ │
Dune
Definition gridglue.hh:37
│ │ │ │
Dune::GridGlue::GridGlue
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │
Dune::GridGlue::GridGlue::Coords
Dune::FieldVector< ctype, dimworld > Coords
The type used for coordinate vectors.
Definition gridglue.hh:174
│ │ │ │
Dune::GridGlue::GridGlue::getIntersection
Intersection getIntersection(int i) const
Definition gridglue.hh:388
│ │ │ │
Dune::GridGlue::GridGlue::Grid1Vertex
GridVertex< 1 > Grid1Vertex
The type of the Grid1 vertices.
Definition gridglue.hh:194
│ │ │ │
Dune::GridGlue::GridGlue::IndexSet
Dune::GridGlue::IntersectionIndexSet< P0, P1 > IndexSet
Type of remote intersection indexSet.
Definition gridglue.hh:206
│ │ │ │
Dune::GridGlue::GridGlue::IndexType
unsigned int IndexType
Definition gridglue.hh:147
│ │ │ │ ├── html2text {} │ │ │ │ │ @@ -322,23 +322,23 @@ │ │ │ │ │ 405#include "_a_d_a_p_t_e_r_/_g_r_i_d_g_l_u_e_._c_c" │ │ │ │ │ 406 │ │ │ │ │ 407#include "_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_._h_h" │ │ │ │ │ 408#include "_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_i_t_e_r_a_t_o_r_._h_h" │ │ │ │ │ 409#include "_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_i_n_d_e_x_s_e_t_._h_h" │ │ │ │ │ 410 │ │ │ │ │ 411#endif // DUNE_GRIDGLUE_GRIDGLUE_HH │ │ │ │ │ -_g_r_i_d_g_l_u_e_._c_c │ │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ -Model of the Intersection concept provided by GridGlue. │ │ │ │ │ +_r_a_n_g_e_g_e_n_e_r_a_t_o_r_s_._h_h │ │ │ │ │ _i_n_t_e_r_s_e_c_t_i_o_n_i_t_e_r_a_t_o_r_._h_h │ │ │ │ │ Implement iterators over GridGlue intersections. │ │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_i_n_d_e_x_s_e_t_._h_h │ │ │ │ │ _g_r_i_d_g_l_u_e_c_o_m_m_u_n_i_c_a_t_e_._h_h │ │ │ │ │ Describes the parallel communication interface class for Dune::GridGlue. │ │ │ │ │ -_r_a_n_g_e_g_e_n_e_r_a_t_o_r_s_._h_h │ │ │ │ │ +_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ +Model of the Intersection concept provided by GridGlue. │ │ │ │ │ +_i_n_t_e_r_s_e_c_t_i_o_n_i_n_d_e_x_s_e_t_._h_h │ │ │ │ │ +_g_r_i_d_g_l_u_e_._c_c │ │ │ │ │ _m_e_r_g_e_r_._h_h │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_o_r_d_s │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridglue.cc File Reference │ │ │ │ +dune-grid-glue: gridglueamirawriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,41 +70,43 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
gridglue.cc File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
gridglueamirawriter.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include "intersection.hh"
│ │ │ │ -#include <vector>
│ │ │ │ -#include <iterator>
│ │ │ │ -#include "../gridglue.hh"
│ │ │ │ -#include "../common/ringcomm.hh"
│ │ │ │ -#include <dune/common/unused.hh>
│ │ │ │ + │ │ │ │ +

Write all remote intersections to a AmiraMesh file. │ │ │ │ +More...

│ │ │ │ +
#include <fstream>
│ │ │ │ +#include <sstream>
│ │ │ │ +#include <type_traits>
│ │ │ │
│ │ │ │

Go to the source code of this file.

│ │ │ │

│ │ │ │ Classes

class  Dune::GridGlue::GridGlue< P0, P1 >
 sequential adapter to couple two grids at specified close together boundaries More...
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Classes

class  Dune::GridGlue::GridGlueAmiraWriter
 Write remote intersections to a AmiraMesh file for debugging purposes. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Functions

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

Detailed Description

│ │ │ │ +

Write all remote intersections to a AmiraMesh file.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,28 +1,28 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -gridglue.cc File Reference │ │ │ │ │ -#include "_i_n_t_e_r_s_e_c_t_i_o_n_._h_h" │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_._._/_g_r_i_d_g_l_u_e_._h_h" │ │ │ │ │ -#include "_._._/_c_o_m_m_o_n_/_r_i_n_g_c_o_m_m_._h_h" │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +gridglueamirawriter.hh File Reference │ │ │ │ │ +Write all remote intersections to a AmiraMesh file. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ +CCllaasssseess │ │ │ │ │ +class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r │ │ │ │ │ +  Write remote intersections to a AmiraMesh file for debugging purposes. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t_V_e_c_t_o_r (const std::vector< T > &v, std::string name, │ │ │ │ │ - int rank) │ │ │ │ │ -  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Write all remote intersections to a AmiraMesh file. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridglue.cc Source File │ │ │ │ +dune-grid-glue: gridglueamirawriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,502 +74,166 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
gridglue.cc
│ │ │ │ +
gridglueamirawriter.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ -
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
5/* IMPLEMENTATION OF CLASS G R I D G L U E */
│ │ │ │ -
6
│ │ │ │ -
7#include "intersection.hh"
│ │ │ │ -
8#include <vector>
│ │ │ │ -
9#include <iterator>
│ │ │ │ -
10#include "../gridglue.hh"
│ │ │ │ -
11#if HAVE_MPI
│ │ │ │ -
12#include "../common/ringcomm.hh"
│ │ │ │ -
13#endif
│ │ │ │ +Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ +
8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
│ │ │ │ +
9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
│ │ │ │ +
10
│ │ │ │ +
11#include <fstream>
│ │ │ │ +
12#include <sstream>
│ │ │ │ +
13#include <type_traits>
│ │ │ │
14
│ │ │ │ -
15#include <dune/common/unused.hh>
│ │ │ │ -
16
│ │ │ │ -
17namespace Dune {
│ │ │ │ -
18namespace GridGlue {
│ │ │ │ -
19
│ │ │ │ -
20template<typename P0, typename P1>
│ │ │ │ -
│ │ │ │ -
21GridGlue<P0, P1>::GridGlue(const std::shared_ptr< const GridPatch<0> >& gp0, const std::shared_ptr< const GridPatch<1> >& gp1, const std::shared_ptr<Merger>& merger)
│ │ │ │ -
22 : patches_{gp0, gp1}, merger_(merger)
│ │ │ │ -
23{
│ │ │ │ -
24#if HAVE_MPI
│ │ │ │ -
25 // if we have only seq. meshes don't use parallel glueing
│ │ │ │ -
26 if (gp0->gridView().comm().size() == 1
│ │ │ │ -
27 && gp1->gridView().comm().size() == 1)
│ │ │ │ -
28 mpicomm_ = MPI_COMM_SELF;
│ │ │ │ -
29 else
│ │ │ │ -
30 mpicomm_ = MPI_COMM_WORLD;
│ │ │ │ -
31#endif // HAVE_MPI
│ │ │ │ -
32 std::cout << "GridGlue: Constructor succeeded!" << std::endl;
│ │ │ │ -
33}
│ │ │ │ -
│ │ │ │ +
15namespace Dune {
│ │ │ │ +
16namespace GridGlue {
│ │ │ │ +
17
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
21{
│ │ │ │ +
22
│ │ │ │ +
26 template <class Glue, int side>
│ │ │ │ +
27 static void writeIntersections(const Glue& glue, const std::string& filename)
│ │ │ │ +
28 {
│ │ │ │ +
29 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
│ │ │ │ +
30
│ │ │ │ +
31 std::ofstream fgrid;
│ │ │ │ +
32
│ │ │ │ +
33 fgrid.open(filename.c_str());
│ │ │ │
34
│ │ │ │ -
35template<typename P0, typename P1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
37{
│ │ │ │ -
38 int myrank = 0;
│ │ │ │ -
39#if HAVE_MPI
│ │ │ │ -
40 int commsize = 1;
│ │ │ │ -
41 MPI_Comm_rank(mpicomm_, &myrank);
│ │ │ │ -
42 MPI_Comm_size(mpicomm_, &commsize);
│ │ │ │ -
43#endif // HAVE_MPI
│ │ │ │ -
44
│ │ │ │ -
45 // clear the contents from the current intersections array
│ │ │ │ -
46 {
│ │ │ │ -
47 std::vector<IntersectionData> dummy(1); // we need size 1, as we always store data for the end-intersection
│ │ │ │ -
48 intersections_.swap(dummy);
│ │ │ │ -
49 }
│ │ │ │ -
50
│ │ │ │ -
51 std::vector<Dune::FieldVector<ctype, dimworld> > patch0coords;
│ │ │ │ -
52 std::vector<unsigned int> patch0entities;
│ │ │ │ -
53 std::vector<Dune::GeometryType> patch0types;
│ │ │ │ -
54 std::vector<Dune::FieldVector<ctype,dimworld> > patch1coords;
│ │ │ │ -
55 std::vector<unsigned int> patch1entities;
│ │ │ │ -
56 std::vector<Dune::GeometryType> patch1types;
│ │ │ │ -
57
│ │ │ │ -
58 /*
│ │ │ │ -
59 * extract global surface patchs
│ │ │ │ -
60 */
│ │ │ │ +
35 using GridView = typename Glue::template GridView<side>;
│ │ │ │ +
36 const int dim = GridView::dimension;
│ │ │ │ +
37 const int domdimw = GridView::dimensionworld;
│ │ │ │ +
38
│ │ │ │ +
39 // coordinates have to be in R^3 in the VTK format
│ │ │ │ +
40 std::string coordinatePadding;
│ │ │ │ +
41 for (int i=domdimw; i<3; i++)
│ │ │ │ +
42 coordinatePadding += " 0";
│ │ │ │ +
43
│ │ │ │ +
44 int overlaps = glue.size();
│ │ │ │ +
45
│ │ │ │ +
46 if (dim==3) {
│ │ │ │ +
47
│ │ │ │ +
48 fgrid << "# HyperSurface 0.1 ASCII \n" << std::endl;
│ │ │ │ +
49 fgrid<<"\n";
│ │ │ │ +
50 fgrid<<"Parameters {\n";
│ │ │ │ +
51 fgrid<<" Materials {\n";
│ │ │ │ +
52 fgrid<<" outside {\n";
│ │ │ │ +
53 fgrid<<" Id 0\n";
│ │ │ │ +
54 fgrid<<" }\n";
│ │ │ │ +
55 fgrid<<" inside {\n";
│ │ │ │ +
56 fgrid<<" Id 1\n";
│ │ │ │ +
57 fgrid<<" }\n";
│ │ │ │ +
58 fgrid<<" }\n";
│ │ │ │ +
59 fgrid<<"\n";
│ │ │ │ +
60 fgrid<<"}\n";
│ │ │ │
61
│ │ │ │ -
62 // retrieve the coordinate and topology information from the extractors
│ │ │ │ -
63 // and apply transformations if necessary
│ │ │ │ -
64 extractGrid(patch<0>(), patch0coords, patch0entities, patch0types);
│ │ │ │ -
65 extractGrid(patch<1>(), patch1coords, patch1entities, patch1types);
│ │ │ │ -
66
│ │ │ │ -
67 std::cout << ">>>> rank " << myrank << " coords: "
│ │ │ │ -
68 << patch0coords.size() << " and " << patch1coords.size() << std::endl;
│ │ │ │ -
69 std::cout << ">>>> rank " << myrank << " entities: "
│ │ │ │ -
70 << patch0entities.size() << " and " << patch1entities.size() << std::endl;
│ │ │ │ -
71 std::cout << ">>>> rank " << myrank << " types: "
│ │ │ │ -
72 << patch0types.size() << " and " << patch1types.size() << std::endl;
│ │ │ │ -
73
│ │ │ │ -
74#ifdef WRITE_TO_VTK
│ │ │ │ -
75 const char prefix[] = "GridGlue::Builder::build() : ";
│ │ │ │ -
76 char patch0surf[256];
│ │ │ │ -
77 sprintf(patch0surf, "/tmp/vtk-patch0-test-%i", myrank);
│ │ │ │ -
78 char patch1surf[256];
│ │ │ │ -
79 sprintf(patch1surf, "/tmp/vtk-patch1-test-%i", myrank);
│ │ │ │ -
80
│ │ │ │ -
81 // std::cout << prefix << "Writing patch0 surface to '" << patch0surf << ".vtk'...\n";
│ │ │ │ -
82 // VtkSurfaceWriter vtksw(patch0surf);
│ │ │ │ -
83 // vtksw.writeSurface(patch0coords, patch0entities, grid0dim, dimworld);
│ │ │ │ -
84 // std::cout << prefix << "Done writing patch0 surface!\n";
│ │ │ │ -
85
│ │ │ │ -
86 // std::cout << prefix << "Writing patch1 surface to '" << patch1surf << ".vtk'...\n";
│ │ │ │ -
87 // vtksw.setFilename(patch1surf);
│ │ │ │ -
88 // vtksw.writeSurface(patch1coords, patch1entities, grid1dim, dimworld);
│ │ │ │ -
89 // std::cout << prefix << "Done writing patch1 surface!\n";
│ │ │ │ -
90#endif // WRITE_TO_VTK
│ │ │ │ -
91
│ │ │ │ -
92 // we start with an empty set
│ │ │ │ -
93 index__sz = 0;
│ │ │ │ -
94
│ │ │ │ -
95#if HAVE_MPI
│ │ │ │ -
96 if (commsize > 1)
│ │ │ │ -
97 {
│ │ │ │ -
98 // setup parallel indexset
│ │ │ │ -
99 patch0_is_.beginResize();
│ │ │ │ -
100 patch1_is_.beginResize();
│ │ │ │ -
101 }
│ │ │ │ -
102
│ │ │ │ -
103 auto op =
│ │ │ │ -
104 [&](
│ │ │ │ -
105 const int mergingrank,
│ │ │ │ -
106 const std::vector<Dune::FieldVector<ctype,dimworld> >& remotePatch0coords,
│ │ │ │ -
107 const std::vector<unsigned int>& remotePatch0entities,
│ │ │ │ -
108 const std::vector<Dune::GeometryType>& remotePatch0types,
│ │ │ │ -
109 const std::vector<Dune::FieldVector<ctype,dimworld> >& remotePatch1coords,
│ │ │ │ -
110 const std::vector<unsigned int>& remotePatch1entities,
│ │ │ │ -
111 const std::vector<Dune::GeometryType>& remotePatch1types
│ │ │ │ -
112 )
│ │ │ │ -
113 {
│ │ │ │ -
114 if (remotePatch1entities.size() > 0 && patch0entities.size() > 0)
│ │ │ │ -
115 mergePatches(patch0coords, patch0entities, patch0types, myrank,
│ │ │ │ -
116 remotePatch1coords, remotePatch1entities, remotePatch1types, mergingrank);
│ │ │ │ -
117 if (mergingrank != myrank &&
│ │ │ │ -
118 remotePatch0entities.size() > 0 && patch1entities.size() > 0)
│ │ │ │ -
119 mergePatches(remotePatch0coords, remotePatch0entities, remotePatch0types, mergingrank,
│ │ │ │ -
120 patch1coords, patch1entities, patch1types, myrank);
│ │ │ │ -
121 };
│ │ │ │ -
122 Parallel::MPI_AllApply(mpicomm_, op,
│ │ │ │ -
123 patch0coords, patch0entities, patch0types,
│ │ │ │ -
124 patch1coords, patch1entities, patch1types
│ │ │ │ -
125 );
│ │ │ │ -
126
│ │ │ │ -
127 if (commsize > 1)
│ │ │ │ -
128 {
│ │ │ │ -
129 // finalize ParallelIndexSet & RemoteIndices
│ │ │ │ -
130 patch0_is_.endResize();
│ │ │ │ -
131 patch1_is_.endResize();
│ │ │ │ -
132
│ │ │ │ -
133 // setup remote index information
│ │ │ │ -
134 remoteIndices_.setIncludeSelf(true);
│ │ │ │ -
135 // #warning add list of neighbors ...
│ │ │ │ -
136 remoteIndices_.setIndexSets(patch0_is_, patch1_is_, mpicomm_) ;
│ │ │ │ -
137 remoteIndices_.rebuild<true/* all indices are public */>();
│ │ │ │ -
138
│ │ │ │ -
139 // DEBUG Print all remote indices
│ │ │ │ -
140#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
│ │ │ │ -
141 for (auto it = remoteIndices_.begin(); it != remoteIndices_.end(); it++)
│ │ │ │ -
142 {
│ │ │ │ -
143 std::cout << myrank << "\tri-list\t" << it->first << std::endl;
│ │ │ │ -
144 for (auto xit = it->second.first->begin(); xit != it->second.first->end(); ++xit)
│ │ │ │ -
145 std::cout << myrank << "\tri-list 1 \t" << it->first << "\t" << *xit << std::endl;
│ │ │ │ -
146 for (auto xit = it->second.second->begin(); xit != it->second.second->end(); ++xit)
│ │ │ │ -
147 std::cout << myrank << "\tri-list 2 \t" << it->first << "\t" << *xit << std::endl;
│ │ │ │ -
148 }
│ │ │ │ -
149#endif
│ │ │ │ -
150 }
│ │ │ │ -
151#else // HAVE_MPI
│ │ │ │ -
152
│ │ │ │ -
153 if (patch1entities.size() > 0 && patch0entities.size() > 0)
│ │ │ │ -
154 {
│ │ │ │ -
155 mergePatches(patch0coords, patch0entities, patch0types, myrank,
│ │ │ │ -
156 patch1coords, patch1entities, patch1types, myrank);
│ │ │ │ -
157#ifdef CALL_MERGER_TWICE
│ │ │ │ -
158 mergePatches(patch0coords, patch0entities, patch0types, myrank,
│ │ │ │ -
159 patch1coords, patch1entities, patch1types, myrank);
│ │ │ │ -
160#endif
│ │ │ │ -
161 }
│ │ │ │ -
162
│ │ │ │ -
163#endif // HAVE_MPI
│ │ │ │ -
164
│ │ │ │ -
165}
│ │ │ │ -
│ │ │ │ -
166
│ │ │ │ -
167template<typename T>
│ │ │ │ -
│ │ │ │ -
168void printVector(const std::vector<T> & v, std::string name, int rank)
│ │ │ │ -
169{
│ │ │ │ -
170 std::cout << rank << ": " << name << std::endl;
│ │ │ │ -
171 for (size_t i=0; i<v.size(); i++)
│ │ │ │ -
172 {
│ │ │ │ -
173 std::cout << v[i] << " ";
│ │ │ │ -
174 }
│ │ │ │ -
175 std::cout << std::endl;
│ │ │ │ -
176}
│ │ │ │ -
│ │ │ │ -
177
│ │ │ │ -
178template<typename P0, typename P1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
180 const std::vector<Dune::FieldVector<ctype,dimworld> >& patch0coords,
│ │ │ │ -
181 const std::vector<unsigned int>& patch0entities,
│ │ │ │ -
182 const std::vector<Dune::GeometryType>& patch0types,
│ │ │ │ -
183 const int patch0rank,
│ │ │ │ -
184 const std::vector<Dune::FieldVector<ctype,dimworld> >& patch1coords,
│ │ │ │ -
185 const std::vector<unsigned int>& patch1entities,
│ │ │ │ -
186 const std::vector<Dune::GeometryType>& patch1types,
│ │ │ │ -
187 const int patch1rank)
│ │ │ │ -
188{
│ │ │ │ -
189
│ │ │ │ -
190 // howto handle overlap etc?
│ │ │ │ -
191
│ │ │ │ -
192 int myrank = 0;
│ │ │ │ -
193#if HAVE_MPI
│ │ │ │ -
194 int commsize = 1;
│ │ │ │ -
195 MPI_Comm_rank(mpicomm_, &myrank);
│ │ │ │ -
196 MPI_Comm_size(mpicomm_, &commsize);
│ │ │ │ -
197#endif // HAVE_MPI
│ │ │ │ -
198
│ │ │ │ -
199 // which patches are local?
│ │ │ │ -
200 const bool patch0local = (myrank == patch0rank);
│ │ │ │ -
201 const bool patch1local = (myrank == patch1rank);
│ │ │ │ -
202
│ │ │ │ -
203 // remember the number of previous remote intersections
│ │ │ │ -
204 const unsigned int offset = intersections_.size()-1;
│ │ │ │ -
205
│ │ │ │ -
206 std::cout << myrank
│ │ │ │ -
207 << " GridGlue::mergePatches : rank " << patch0rank << " / " << patch1rank << std::endl;
│ │ │ │ -
208
│ │ │ │ -
209 // start the actual build process
│ │ │ │ -
210 merger_->build(patch0coords, patch0entities, patch0types,
│ │ │ │ -
211 patch1coords, patch1entities, patch1types);
│ │ │ │ -
212
│ │ │ │ -
213 // append to intersections list
│ │ │ │ -
214 intersections_.resize(merger_->nSimplices() + offset + 1);
│ │ │ │ -
215 for (unsigned int i = 0; i < merger_->nSimplices(); ++i)
│ │ │ │ -
216 intersections_[offset + i] = IntersectionData(*this, i, offset, patch0local, patch1local);
│ │ │ │ -
217
│ │ │ │ -
218 index__sz = intersections_.size() - 1;
│ │ │ │ -
219
│ │ │ │ -
220 std::cout << myrank
│ │ │ │ -
221 << " GridGlue::mergePatches : "
│ │ │ │ -
222 << "The number of remote intersections is " << intersections_.size()-1 << std::endl;
│ │ │ │ -
223
│ │ │ │ -
224#if 0
│ │ │ │ -
225 printVector(patch0coords,"patch0coords",myrank);
│ │ │ │ -
226 printVector(patch0entities,"patch0entities",myrank);
│ │ │ │ -
227 printVector(patch0types,"patch0types",myrank);
│ │ │ │ -
228 printVector(patch1coords,"patch1coords",myrank);
│ │ │ │ -
229 printVector(patch1entities,"patch1entities",myrank);
│ │ │ │ -
230 printVector(patch1types,"patch1types",myrank);
│ │ │ │ -
231#endif
│ │ │ │ -
232
│ │ │ │ -
233#if HAVE_MPI
│ │ │ │ -
234 if (commsize > 1)
│ │ │ │ -
235 {
│ │ │ │ -
236 // update remote index sets
│ │ │ │ -
237 assert(Dune::RESIZE == patch0_is_.state());
│ │ │ │ -
238 assert(Dune::RESIZE == patch1_is_.state());
│ │ │ │ -
239
│ │ │ │ -
240 for (unsigned int i = 0; i < merger_->nSimplices(); i++)
│ │ │ │ -
241 {
│ │ │ │ -
242 // #warning only handle the newest intersections / merger info
│ │ │ │ -
243 const IntersectionData & it = intersections_[i];
│ │ │ │ -
244 GlobalId gid(patch0rank, patch1rank, i);
│ │ │ │ -
245 if (it.template local<0>())
│ │ │ │ -
246 {
│ │ │ │ -
247 Dune::PartitionType ptype = patch<0>().element(it.template index<0>()).partitionType();
│ │ │ │ -
248 patch0_is_.add (gid, LocalIndex(offset+i, ptype) );
│ │ │ │ -
249 }
│ │ │ │ -
250 if (it.template local<1>())
│ │ │ │ -
251 {
│ │ │ │ -
252 Dune::PartitionType ptype = patch<1>().element(it.template index<1>()).partitionType();
│ │ │ │ -
253 patch1_is_.add (gid, LocalIndex(offset+i, ptype) );
│ │ │ │ -
254 }
│ │ │ │ -
255 }
│ │ │ │ -
256 }
│ │ │ │ -
257#endif // HAVE_MPI
│ │ │ │ -
258
│ │ │ │ -
259 // cleanup the merger
│ │ │ │ -
260 merger_->clear();
│ │ │ │ -
261}
│ │ │ │ -
│ │ │ │ -
262
│ │ │ │ -
263template<typename P0, typename P1>
│ │ │ │ -
264template<typename Extractor>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
266 std::vector<Dune::FieldVector<ctype, dimworld> > & coords,
│ │ │ │ -
267 std::vector<unsigned int> & entities,
│ │ │ │ -
268 std::vector<Dune::GeometryType>& geometryTypes) const
│ │ │ │ -
269{
│ │ │ │ -
270 std::vector<typename Extractor::Coords> tempcoords;
│ │ │ │ -
271 std::vector<typename Extractor::VertexVector> tempentities;
│ │ │ │ -
272
│ │ │ │ -
273 extractor.getCoords(tempcoords);
│ │ │ │ -
274 coords.clear();
│ │ │ │ -
275 coords.reserve(tempcoords.size());
│ │ │ │ -
276
│ │ │ │ -
277 for (unsigned int i = 0; i < tempcoords.size(); ++i)
│ │ │ │ -
278 {
│ │ │ │ -
279 assert(int(dimworld) == int(Extractor::dimworld));
│ │ │ │ -
280 coords.push_back(Dune::FieldVector<ctype, dimworld>());
│ │ │ │ -
281 for (size_t j = 0; j <dimworld; ++j)
│ │ │ │ -
282 coords.back()[j] = tempcoords[i][j];
│ │ │ │ -
283 }
│ │ │ │ -
284
│ │ │ │ -
285 extractor.getFaces(tempentities);
│ │ │ │ -
286 entities.clear();
│ │ │ │ -
287
│ │ │ │ -
288 for (unsigned int i = 0; i < tempentities.size(); ++i) {
│ │ │ │ -
289 for (unsigned int j = 0; j < tempentities[i].size(); ++j)
│ │ │ │ -
290 entities.push_back(tempentities[i][j]);
│ │ │ │ -
291 }
│ │ │ │ -
292
│ │ │ │ -
293 // get the list of geometry types from the extractor
│ │ │ │ -
294 extractor.getGeometryTypes(geometryTypes);
│ │ │ │ -
295
│ │ │ │ -
296}
│ │ │ │ -
│ │ │ │ -
297
│ │ │ │ -
298template<typename P0, typename P1>
│ │ │ │ -
299template<class DataHandleImp, class DataTypeImp>
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ -
302 Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const
│ │ │ │ -
303{
│ │ │ │ - │ │ │ │ -
305 typedef typename DataHandle::DataType DataType;
│ │ │ │ -
306
│ │ │ │ -
307#if HAVE_MPI
│ │ │ │ -
308
│ │ │ │ -
309 if (mpicomm_ != MPI_COMM_SELF)
│ │ │ │ -
310 {
│ │ │ │ -
311 /*
│ │ │ │ -
312 * P A R A L L E L V E R S I O N
│ │ │ │ -
313 */
│ │ │ │ -
314 // setup communication interfaces
│ │ │ │ -
315 Dune::dinfo << "GridGlue: parallel communication" << std::endl;
│ │ │ │ -
316 typedef Dune::EnumItem <Dune::PartitionType, Dune::InteriorEntity> InteriorFlags;
│ │ │ │ -
317 typedef Dune::EnumItem <Dune::PartitionType, Dune::OverlapEntity> OverlapFlags;
│ │ │ │ -
318 typedef Dune::EnumRange <Dune::PartitionType, Dune::InteriorEntity, Dune::GhostEntity> AllFlags;
│ │ │ │ -
319 Dune::Interface interface;
│ │ │ │ -
320 assert(remoteIndices_.isSynced());
│ │ │ │ -
321 switch (iftype)
│ │ │ │ -
322 {
│ │ │ │ -
323 case Dune::InteriorBorder_InteriorBorder_Interface :
│ │ │ │ -
324 interface.build (remoteIndices_, InteriorFlags(), InteriorFlags() );
│ │ │ │ -
325 break;
│ │ │ │ -
326 case Dune::InteriorBorder_All_Interface :
│ │ │ │ -
327 if (dir == Dune::ForwardCommunication)
│ │ │ │ -
328 interface.build (remoteIndices_, InteriorFlags(), AllFlags() );
│ │ │ │ -
329 else
│ │ │ │ -
330 interface.build (remoteIndices_, AllFlags(), InteriorFlags() );
│ │ │ │ -
331 break;
│ │ │ │ -
332 case Dune::Overlap_OverlapFront_Interface :
│ │ │ │ -
333 interface.build (remoteIndices_, OverlapFlags(), OverlapFlags() );
│ │ │ │ -
334 break;
│ │ │ │ -
335 case Dune::Overlap_All_Interface :
│ │ │ │ -
336 if (dir == Dune::ForwardCommunication)
│ │ │ │ -
337 interface.build (remoteIndices_, OverlapFlags(), AllFlags() );
│ │ │ │ -
338 else
│ │ │ │ -
339 interface.build (remoteIndices_, AllFlags(), OverlapFlags() );
│ │ │ │ -
340 break;
│ │ │ │ -
341 case Dune::All_All_Interface :
│ │ │ │ -
342 interface.build (remoteIndices_, AllFlags(), AllFlags() );
│ │ │ │ -
343 break;
│ │ │ │ -
344 default :
│ │ │ │ -
345 DUNE_THROW(Dune::NotImplemented, "GridGlue::communicate for interface " << iftype << " not implemented");
│ │ │ │ -
346 }
│ │ │ │ -
347
│ │ │ │ -
348 // setup communication info (class needed to tunnel all info to the operator)
│ │ │ │ - │ │ │ │ -
350 CommInfo commInfo;
│ │ │ │ -
351 commInfo.dir = dir;
│ │ │ │ -
352 commInfo.gridglue = this;
│ │ │ │ -
353 commInfo.data = &data;
│ │ │ │ -
354
│ │ │ │ -
355 // create communicator
│ │ │ │ -
356 Dune::BufferedCommunicator bComm ;
│ │ │ │ -
357 bComm.template build< CommInfo >(commInfo, commInfo, interface);
│ │ │ │ -
358
│ │ │ │ -
359 // do communication
│ │ │ │ -
360 // choose communication direction.
│ │ │ │ -
361 if (dir == Dune::ForwardCommunication)
│ │ │ │ -
362 bComm.forward< Dune::GridGlue::ForwardOperator >(commInfo, commInfo);
│ │ │ │ -
363 else
│ │ │ │ -
364 bComm.backward< Dune::GridGlue::BackwardOperator >(commInfo, commInfo);
│ │ │ │ -
365 }
│ │ │ │ -
366 else
│ │ │ │ -
367#endif // HAVE_MPI
│ │ │ │ -
368 {
│ │ │ │ -
369 /*
│ │ │ │ -
370 * S E Q U E N T I A L V E R S I O N
│ │ │ │ -
371 */
│ │ │ │ -
372 Dune::dinfo << "GridGlue: sequential fallback communication" << std::endl;
│ │ │ │ -
373
│ │ │ │ -
374 // get comm buffer size
│ │ │ │ -
375 int ssz = size() * 10; // times data per intersection
│ │ │ │ -
376 int rsz = size() * 10;
│ │ │ │ -
377
│ │ │ │ -
378 // allocate send/receive buffer
│ │ │ │ -
379 auto sendbuffer = std::make_unique<DataType[]>(ssz);
│ │ │ │ -
380 auto receivebuffer = std::make_unique<DataType[]>(rsz);
│ │ │ │ -
381
│ │ │ │ -
382 // gather
│ │ │ │ -
383 Dune::GridGlue::StreamingMessageBuffer<DataType> gatherbuffer(sendbuffer.get());
│ │ │ │ -
384 for (const auto& in : intersections(*this))
│ │ │ │ -
385 {
│ │ │ │ -
386 /*
│ │ │ │ -
387 we need to have to variants depending on the communication direction.
│ │ │ │ -
388 */
│ │ │ │ -
389 if (dir == Dune::ForwardCommunication)
│ │ │ │ -
390 {
│ │ │ │ -
391 /*
│ │ │ │ -
392 dir : Forward (grid0 -> grid1)
│ │ │ │ -
393 */
│ │ │ │ -
394 if (in.self())
│ │ │ │ -
395 {
│ │ │ │ -
396 data.gather(gatherbuffer, in.inside(), in);
│ │ │ │ -
397 }
│ │ │ │ -
398 }
│ │ │ │ -
399 else // (dir == Dune::BackwardCommunication)
│ │ │ │ -
400 {
│ │ │ │ -
401 /*
│ │ │ │ -
402 dir : Backward (grid1 -> grid0)
│ │ │ │ -
403 */
│ │ │ │ -
404 if (in.neighbor())
│ │ │ │ -
405 {
│ │ │ │ -
406 data.gather(gatherbuffer, in.outside(), in.flip());
│ │ │ │ -
407 }
│ │ │ │ -
408 }
│ │ │ │ -
409 }
│ │ │ │ -
410
│ │ │ │ -
411 assert(ssz == rsz);
│ │ │ │ -
412 for (int i=0; i<ssz; i++)
│ │ │ │ -
413 receivebuffer[i] = sendbuffer[i];
│ │ │ │ -
414
│ │ │ │ -
415 // scatter
│ │ │ │ -
416 Dune::GridGlue::StreamingMessageBuffer<DataType> scatterbuffer(receivebuffer.get());
│ │ │ │ -
417 for (const auto& in : intersections(*this))
│ │ │ │ -
418 {
│ │ │ │ -
419 /*
│ │ │ │ -
420 we need to have to variants depending on the communication direction.
│ │ │ │ -
421 */
│ │ │ │ -
422 if (dir == Dune::ForwardCommunication)
│ │ │ │ -
423 {
│ │ │ │ -
424 /*
│ │ │ │ -
425 dir : Forward (grid0 -> grid1)
│ │ │ │ -
426 */
│ │ │ │ -
427 if (in.neighbor())
│ │ │ │ -
428 data.scatter(scatterbuffer, in.outside(), in.flip(),
│ │ │ │ -
429 data.size(in));
│ │ │ │ -
430 }
│ │ │ │ -
431 else // (dir == Dune::BackwardCommunication)
│ │ │ │ -
432 {
│ │ │ │ -
433 /*
│ │ │ │ -
434 dir : Backward (grid1 -> grid0)
│ │ │ │ -
435 */
│ │ │ │ -
436 if (in.self())
│ │ │ │ -
437 data.scatter(scatterbuffer, in.inside(), in,
│ │ │ │ -
438 data.size(in));
│ │ │ │ -
439 }
│ │ │ │ -
440 }
│ │ │ │ -
441 }
│ │ │ │ -
442}
│ │ │ │ -
│ │ │ │ -
443
│ │ │ │ -
444} // end namespace GridGlue
│ │ │ │ -
445} // end namespace Dune
│ │ │ │ -
Model of the Intersection concept provided by GridGlue.
│ │ │ │ +
62 // ////////////////////////////////////////////
│ │ │ │ +
63 // Write vertices
│ │ │ │ +
64 // ////////////////////////////////////////////
│ │ │ │ +
65
│ │ │ │ +
66 //use dim and not dim+1
│ │ │ │ +
67 fgrid<<"\nVertices "<< overlaps*(dim)<<"\n";
│ │ │ │ +
68 auto isEnd = glue.template iend<side>();
│ │ │ │ +
69 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt)
│ │ │ │ +
70 {
│ │ │ │ +
71 const auto& geometry = isIt->geometry();
│ │ │ │ +
72 for (int i = 0; i < geometry.corners(); ++i)
│ │ │ │ +
73 fgrid << geometry.corner(i) << coordinatePadding << std::endl;
│ │ │ │ +
74 }
│ │ │ │ +
75
│ │ │ │ +
76 // ////////////////////////////////////////////
│ │ │ │ +
77 // Write triangles
│ │ │ │ +
78 // ////////////////////////////////////////////
│ │ │ │ +
79
│ │ │ │ +
80 fgrid<<"NBranchingPoints 0\n";
│ │ │ │ +
81 fgrid<<"NVerticesOnCurves 0\n";
│ │ │ │ +
82 fgrid<<"BoundaryCurves 0\n";
│ │ │ │ +
83 fgrid<<"Patches 1\n";
│ │ │ │ +
84 fgrid<<"{\n";
│ │ │ │ +
85 fgrid<<"InnerRegion inside\n";
│ │ │ │ +
86 fgrid<<"OuterRegion outside\n";
│ │ │ │ +
87 fgrid<<"BoundaryID 0\n";
│ │ │ │ +
88 fgrid<<"BranchingPoints 0";
│ │ │ │ +
89 fgrid<<"\n";
│ │ │ │ +
90
│ │ │ │ +
91 fgrid<<"Triangles "<<overlaps<<std::endl;
│ │ │ │ +
92
│ │ │ │ +
93 for (int i=0;i<overlaps; i++)
│ │ │ │ +
94 fgrid<<i*dim+1<<" "<<i*dim+2<<" "<<i*dim+3<<std::endl;
│ │ │ │ +
95 fgrid<<"}\n";
│ │ │ │ +
96
│ │ │ │ +
97 } else if (dim==2) {
│ │ │ │ +
98
│ │ │ │ +
99 fgrid << "# AmiraMesh 3D ASCII 2.0 \n";
│ │ │ │ +
100 fgrid<<"\n";
│ │ │ │ +
101 fgrid<<"define Lines "<<3*overlaps<<"\n";
│ │ │ │ +
102 fgrid<<"nVertices "<<2*overlaps<<"\n";
│ │ │ │ +
103 fgrid<<"\n";
│ │ │ │ +
104 fgrid<<"Parameters {\n";
│ │ │ │ +
105 fgrid<<" ContentType \"HxLineSet\" \n";
│ │ │ │ +
106 fgrid<<"}\n";
│ │ │ │ +
107 fgrid<<"\n";
│ │ │ │ +
108 fgrid<<"Lines { int LineIdx } @1\n";
│ │ │ │ +
109 fgrid<<"Vertices { float[3] Coordinates } @2\n";
│ │ │ │ +
110 fgrid<<"\n";
│ │ │ │ +
111 fgrid<<"# Data section follows\n";
│ │ │ │ +
112 fgrid<<"@1 \n";
│ │ │ │ +
113 for (int i=0; i<overlaps;i++)
│ │ │ │ +
114 fgrid<<2*i<<"\n"<<2*i+1<<"\n"<<-1<<"\n";
│ │ │ │ +
115 fgrid<<"\n";
│ │ │ │ +
116 fgrid<<"@2 \n";
│ │ │ │ +
117
│ │ │ │ +
118 auto isEnd = glue.template iend<side>();
│ │ │ │ +
119 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt) {
│ │ │ │ +
120 const auto& geometry = isIt->geometry();
│ │ │ │ +
121 for (int i = 0; i <2; ++i)
│ │ │ │ +
122 fgrid << geometry.corner(i) <<" "<<0<<"\n";
│ │ │ │ +
123 }
│ │ │ │ +
124 }
│ │ │ │ +
125
│ │ │ │ +
126 fgrid.close();
│ │ │ │ +
127 }
│ │ │ │ +
128
│ │ │ │ +
129public:
│ │ │ │ +
130 template<typename Glue>
│ │ │ │ +
│ │ │ │ +
131 static void write(const Glue& glue, const std::string& path, int appendix=1)
│ │ │ │ +
132 {
│ │ │ │ +
133 std::ostringstream name0;
│ │ │ │ +
134 name0 << path;
│ │ │ │ +
135 name0 << "/domain.surf" << std::setw(3) << std::setfill('0') << appendix;
│ │ │ │ +
136
│ │ │ │ +
137 // Write extracted grid and remote intersection on the grid1-side
│ │ │ │ +
138 writeIntersections<Glue,0>(glue,name0.str());
│ │ │ │ +
139
│ │ │ │ +
140 std::ostringstream name1;
│ │ │ │ +
141 name1 << path;
│ │ │ │ +
142 name1 << "/target.surf" << std::setw(3) << std::setfill('0') << appendix;
│ │ │ │ +
143
│ │ │ │ +
144 writeIntersections<Glue,1>(glue, name1.str());
│ │ │ │ +
145 }
│ │ │ │ +
│ │ │ │ +
146
│ │ │ │ +
147};
│ │ │ │ +
│ │ │ │ +
148
│ │ │ │ +
149} // namespace GridGlue
│ │ │ │ +
150} // namespace Dune
│ │ │ │ +
151
│ │ │ │ +
152#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ -
void printVector(const std::vector< T > &v, std::string name, int rank)
Definition gridglue.cc:168
│ │ │ │ -
void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data)
apply an operator locally to a difstributed data set
Definition ringcomm.hh:297
│ │ │ │ -
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │ -
void mergePatches(const std::vector< Dune::FieldVector< ctype, dimworld > > &patch0coords, const std::vector< unsigned int > &patch0entities, const std::vector< Dune::GeometryType > &patch0types, const int patch0rank, const std::vector< Dune::FieldVector< ctype, dimworld > > &patch1coords, const std::vector< unsigned int > &patch1entities, const std::vector< Dune::GeometryType > &patch1types, const int patch1rank)
after building the merged grid the intersection can be updated through this method (for internal use)
Definition gridglue.cc:179
│ │ │ │ -
void communicate(Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > &data, Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const
Communicate information on the MergedGrid of a GridGlue.
Definition gridglue.cc:300
│ │ │ │ -
void build()
Definition gridglue.cc:36
│ │ │ │ -
void extractGrid(const Extractor &extractor, std::vector< Dune::FieldVector< ctype, dimworld > > &coords, std::vector< unsigned int > &faces, std::vector< Dune::GeometryType > &geometryTypes) const
Definition gridglue.cc:265
│ │ │ │ -
std::conditional_t< side==0, P0, std::conditional_t< side==1, P1, void > > GridPatch
Definition gridglue.hh:96
│ │ │ │ -
storage class for Dune::GridGlue::Intersection related data
Definition intersection.hh:38
│ │ │ │ -
Definition gridgluecommunicate.hh:26
│ │ │ │ -
describes the features of a data handle for communication in parallel runs using the GridGlue::commun...
Definition gridgluecommunicate.hh:77
│ │ │ │ -
size_t size(RISType &i) const
Definition gridgluecommunicate.hh:92
│ │ │ │ -
void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, size_t n)
Definition gridgluecommunicate.hh:118
│ │ │ │ -
void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) const
pack data from user to message buffer
Definition gridgluecommunicate.hh:104
│ │ │ │ -
Definition gridgluecommunicate.hh:141
│ │ │ │ -
forward gather scatter to user defined CommInfo class
Definition gridgluecommunicate.hh:194
│ │ │ │ -
collects all GridGlue data requried for communication
Definition gridgluecommunicate.hh:272
│ │ │ │ -
Dune::CommunicationDirection dir
Definition gridgluecommunicate.hh:288
│ │ │ │ -
::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data
Definition gridgluecommunicate.hh:282
│ │ │ │ -
const GridGlue * gridglue
Definition gridgluecommunicate.hh:281
│ │ │ │ -
Provides codimension-independent methods for grid extraction.
Definition extractor.hh:46
│ │ │ │ -
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ -
void getFaces(std::vector< VertexVector > &faces) const
Get the corners of the extracted subentities.
Definition extractor.hh:304
│ │ │ │ -
void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const
Get the list of geometry types.
Definition extractor.hh:293
│ │ │ │ -
void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) const
getter for the coordinates array
Definition extractor.hh:275
│ │ │ │ +
Write remote intersections to a AmiraMesh file for debugging purposes.
Definition gridglueamirawriter.hh:21
│ │ │ │ +
static void write(const Glue &glue, const std::string &path, int appendix=1)
Definition gridglueamirawriter.hh:131
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,584 +1,165 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -gridglue.cc │ │ │ │ │ +gridglueamirawriter.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ +2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -5/* IMPLEMENTATION OF CLASS G R I D G L U E */ │ │ │ │ │ -6 │ │ │ │ │ -7#include "_i_n_t_e_r_s_e_c_t_i_o_n_._h_h" │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include "../gridglue.hh" │ │ │ │ │ -11#if HAVE_MPI │ │ │ │ │ -12#include "../common/ringcomm.hh" │ │ │ │ │ -13#endif │ │ │ │ │ +8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH │ │ │ │ │ +9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH │ │ │ │ │ +10 │ │ │ │ │ +11#include │ │ │ │ │ +12#include │ │ │ │ │ +13#include │ │ │ │ │ 14 │ │ │ │ │ -15#include │ │ │ │ │ -16 │ │ │ │ │ -17namespace _D_u_n_e { │ │ │ │ │ -18namespace GridGlue { │ │ │ │ │ -19 │ │ │ │ │ -20template │ │ │ │ │ -_2_1_G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_G_r_i_d_G_l_u_e(const std::shared_ptr< const _G_r_i_d_P_a_t_c_h_<_0_> >& gp0, │ │ │ │ │ -const std::shared_ptr< const _G_r_i_d_P_a_t_c_h_<_1_> >& gp1, const std:: │ │ │ │ │ -shared_ptr& merger) │ │ │ │ │ -22 : patches_{gp0, gp1}, merger_(merger) │ │ │ │ │ -23{ │ │ │ │ │ -24#if HAVE_MPI │ │ │ │ │ -25 // if we have only seq. meshes don't use parallel glueing │ │ │ │ │ -26 if (gp0->gridView().comm().size() == 1 │ │ │ │ │ -27 && gp1->gridView().comm().size() == 1) │ │ │ │ │ -28 mpicomm_ = MPI_COMM_SELF; │ │ │ │ │ -29 else │ │ │ │ │ -30 mpicomm_ = MPI_COMM_WORLD; │ │ │ │ │ -31#endif // HAVE_MPI │ │ │ │ │ -32 std::cout << "GridGlue: Constructor succeeded!" << std::endl; │ │ │ │ │ -33} │ │ │ │ │ +15namespace _D_u_n_e { │ │ │ │ │ +16namespace GridGlue { │ │ │ │ │ +17 │ │ │ │ │ +_2_0class _G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r │ │ │ │ │ +21{ │ │ │ │ │ +22 │ │ │ │ │ +26 template │ │ │ │ │ +27 static void writeIntersections(const Glue& glue, const std::string& │ │ │ │ │ +filename) │ │ │ │ │ +28 { │ │ │ │ │ +29 static_assert((side==0 || side==1), "'side' can only be 0 or 1"); │ │ │ │ │ +30 │ │ │ │ │ +31 std::ofstream fgrid; │ │ │ │ │ +32 │ │ │ │ │ +33 fgrid.open(filename.c_str()); │ │ │ │ │ 34 │ │ │ │ │ -35template │ │ │ │ │ -_3_6void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_b_u_i_l_d() │ │ │ │ │ -37{ │ │ │ │ │ -38 int myrank = 0; │ │ │ │ │ -39#if HAVE_MPI │ │ │ │ │ -40 int commsize = 1; │ │ │ │ │ -41 MPI_Comm_rank(mpicomm_, &myrank); │ │ │ │ │ -42 MPI_Comm_size(mpicomm_, &commsize); │ │ │ │ │ -43#endif // HAVE_MPI │ │ │ │ │ -44 │ │ │ │ │ -45 // clear the contents from the current intersections array │ │ │ │ │ -46 { │ │ │ │ │ -47 std::vector dummy(1); // we need size 1, as we always │ │ │ │ │ -store data for the end-intersection │ │ │ │ │ -48 intersections_.swap(dummy); │ │ │ │ │ -49 } │ │ │ │ │ -50 │ │ │ │ │ -51 std::vector > patch0coords; │ │ │ │ │ -52 std::vector patch0entities; │ │ │ │ │ -53 std::vector patch0types; │ │ │ │ │ -54 std::vector > patch1coords; │ │ │ │ │ -55 std::vector patch1entities; │ │ │ │ │ -56 std::vector patch1types; │ │ │ │ │ -57 │ │ │ │ │ -58 /* │ │ │ │ │ -59 * extract global surface patchs │ │ │ │ │ -60 */ │ │ │ │ │ +35 using GridView = typename Glue::template GridView; │ │ │ │ │ +36 const int dim = GridView::dimension; │ │ │ │ │ +37 const int domdimw = GridView::dimensionworld; │ │ │ │ │ +38 │ │ │ │ │ +39 // coordinates have to be in R^3 in the VTK format │ │ │ │ │ +40 std::string coordinatePadding; │ │ │ │ │ +41 for (int i=domdimw; i<3; i++) │ │ │ │ │ +42 coordinatePadding += " 0"; │ │ │ │ │ +43 │ │ │ │ │ +44 int overlaps = glue.size(); │ │ │ │ │ +45 │ │ │ │ │ +46 if (dim==3) { │ │ │ │ │ +47 │ │ │ │ │ +48 fgrid << "# HyperSurface 0.1 ASCII \n" << std::endl; │ │ │ │ │ +49 fgrid<<"\n"; │ │ │ │ │ +50 fgrid<<"Parameters {\n"; │ │ │ │ │ +51 fgrid<<" Materials {\n"; │ │ │ │ │ +52 fgrid<<" outside {\n"; │ │ │ │ │ +53 fgrid<<" Id 0\n"; │ │ │ │ │ +54 fgrid<<" }\n"; │ │ │ │ │ +55 fgrid<<" inside {\n"; │ │ │ │ │ +56 fgrid<<" Id 1\n"; │ │ │ │ │ +57 fgrid<<" }\n"; │ │ │ │ │ +58 fgrid<<" }\n"; │ │ │ │ │ +59 fgrid<<"\n"; │ │ │ │ │ +60 fgrid<<"}\n"; │ │ │ │ │ 61 │ │ │ │ │ -62 // retrieve the coordinate and topology information from the extractors │ │ │ │ │ -63 // and apply transformations if necessary │ │ │ │ │ -64 extractGrid(patch<0>(), patch0coords, patch0entities, patch0types); │ │ │ │ │ -65 extractGrid(patch<1>(), patch1coords, patch1entities, patch1types); │ │ │ │ │ -66 │ │ │ │ │ -67 std::cout << ">>>> rank " << myrank << " coords: " │ │ │ │ │ -68 << patch0coords.size() << " and " << patch1coords.size() << std::endl; │ │ │ │ │ -69 std::cout << ">>>> rank " << myrank << " entities: " │ │ │ │ │ -70 << patch0entities.size() << " and " << patch1entities.size() << std::endl; │ │ │ │ │ -71 std::cout << ">>>> rank " << myrank << " types: " │ │ │ │ │ -72 << patch0types.size() << " and " << patch1types.size() << std::endl; │ │ │ │ │ -73 │ │ │ │ │ -74#ifdef WRITE_TO_VTK │ │ │ │ │ -75 const char prefix[] = "GridGlue::Builder::build() : "; │ │ │ │ │ -76 char patch0surf[256]; │ │ │ │ │ -77 sprintf(patch0surf, "/tmp/vtk-patch0-test-%i", myrank); │ │ │ │ │ -78 char patch1surf[256]; │ │ │ │ │ -79 sprintf(patch1surf, "/tmp/vtk-patch1-test-%i", myrank); │ │ │ │ │ -80 │ │ │ │ │ -81 // std::cout << prefix << "Writing patch0 surface to '" << patch0surf << │ │ │ │ │ -".vtk'...\n"; │ │ │ │ │ -82 // VtkSurfaceWriter vtksw(patch0surf); │ │ │ │ │ -83 // vtksw.writeSurface(patch0coords, patch0entities, grid0dim, dimworld); │ │ │ │ │ -84 // std::cout << prefix << "Done writing patch0 surface!\n"; │ │ │ │ │ -85 │ │ │ │ │ -86 // std::cout << prefix << "Writing patch1 surface to '" << patch1surf << │ │ │ │ │ -".vtk'...\n"; │ │ │ │ │ -87 // vtksw.setFilename(patch1surf); │ │ │ │ │ -88 // vtksw.writeSurface(patch1coords, patch1entities, grid1dim, dimworld); │ │ │ │ │ -89 // std::cout << prefix << "Done writing patch1 surface!\n"; │ │ │ │ │ -90#endif // WRITE_TO_VTK │ │ │ │ │ -91 │ │ │ │ │ -92 // we start with an empty set │ │ │ │ │ -93 index__sz = 0; │ │ │ │ │ -94 │ │ │ │ │ -95#if HAVE_MPI │ │ │ │ │ -96 if (commsize > 1) │ │ │ │ │ -97 { │ │ │ │ │ -98 // setup parallel indexset │ │ │ │ │ -99 patch0_is_.beginResize(); │ │ │ │ │ -100 patch1_is_.beginResize(); │ │ │ │ │ -101 } │ │ │ │ │ -102 │ │ │ │ │ -103 auto op = │ │ │ │ │ -104 [&]( │ │ │ │ │ -105 const int mergingrank, │ │ │ │ │ -106 const std::vector >& remotePatch0coords, │ │ │ │ │ -107 const std::vector& remotePatch0entities, │ │ │ │ │ -108 const std::vector& remotePatch0types, │ │ │ │ │ -109 const std::vector >& remotePatch1coords, │ │ │ │ │ -110 const std::vector& remotePatch1entities, │ │ │ │ │ -111 const std::vector& remotePatch1types │ │ │ │ │ -112 ) │ │ │ │ │ -113 { │ │ │ │ │ -114 if (remotePatch1entities.size() > 0 && patch0entities.size() > 0) │ │ │ │ │ -115 mergePatches(patch0coords, patch0entities, patch0types, myrank, │ │ │ │ │ -116 remotePatch1coords, remotePatch1entities, remotePatch1types, mergingrank); │ │ │ │ │ -117 if (mergingrank != myrank && │ │ │ │ │ -118 remotePatch0entities.size() > 0 && patch1entities.size() > 0) │ │ │ │ │ -119 mergePatches(remotePatch0coords, remotePatch0entities, remotePatch0types, │ │ │ │ │ -mergingrank, │ │ │ │ │ -120 patch1coords, patch1entities, patch1types, myrank); │ │ │ │ │ -121 }; │ │ │ │ │ -122 _P_a_r_a_l_l_e_l_:_:_M_P_I___A_l_l_A_p_p_l_y(mpicomm_, op, │ │ │ │ │ -123 patch0coords, patch0entities, patch0types, │ │ │ │ │ -124 patch1coords, patch1entities, patch1types │ │ │ │ │ -125 ); │ │ │ │ │ -126 │ │ │ │ │ -127 if (commsize > 1) │ │ │ │ │ -128 { │ │ │ │ │ -129 // finalize ParallelIndexSet & RemoteIndices │ │ │ │ │ -130 patch0_is_.endResize(); │ │ │ │ │ -131 patch1_is_.endResize(); │ │ │ │ │ -132 │ │ │ │ │ -133 // setup remote index information │ │ │ │ │ -134 remoteIndices_.setIncludeSelf(true); │ │ │ │ │ -135 // #warning add list of neighbors ... │ │ │ │ │ -136 remoteIndices_.setIndexSets(patch0_is_, patch1_is_, mpicomm_) ; │ │ │ │ │ -137 remoteIndices_.rebuild(); │ │ │ │ │ -138 │ │ │ │ │ -139 // DEBUG Print all remote indices │ │ │ │ │ -140#ifdef DEBUG_GRIDGLUE_PARALLELMERGE │ │ │ │ │ -141 for (auto it = remoteIndices_.begin(); it != remoteIndices_.end(); it++) │ │ │ │ │ -142 { │ │ │ │ │ -143 std::cout << myrank << "\tri-list\t" << it->first << std::endl; │ │ │ │ │ -144 for (auto xit = it->second.first->begin(); xit != it->second.first->end(); │ │ │ │ │ -++xit) │ │ │ │ │ -145 std::cout << myrank << "\tri-list 1 \t" << it->first << "\t" << *xit << │ │ │ │ │ -std::endl; │ │ │ │ │ -146 for (auto xit = it->second.second->begin(); xit != it->second.second->end │ │ │ │ │ -(); ++xit) │ │ │ │ │ -147 std::cout << myrank << "\tri-list 2 \t" << it->first << "\t" << *xit << │ │ │ │ │ -std::endl; │ │ │ │ │ -148 } │ │ │ │ │ -149#endif │ │ │ │ │ -150 } │ │ │ │ │ -151#else // HAVE_MPI │ │ │ │ │ -152 │ │ │ │ │ -153 if (patch1entities.size() > 0 && patch0entities.size() > 0) │ │ │ │ │ -154 { │ │ │ │ │ -155 mergePatches(patch0coords, patch0entities, patch0types, myrank, │ │ │ │ │ -156 patch1coords, patch1entities, patch1types, myrank); │ │ │ │ │ -157#ifdef CALL_MERGER_TWICE │ │ │ │ │ -158 mergePatches(patch0coords, patch0entities, patch0types, myrank, │ │ │ │ │ -159 patch1coords, patch1entities, patch1types, myrank); │ │ │ │ │ -160#endif │ │ │ │ │ -161 } │ │ │ │ │ -162 │ │ │ │ │ -163#endif // HAVE_MPI │ │ │ │ │ -164 │ │ │ │ │ -165} │ │ │ │ │ -166 │ │ │ │ │ -167template │ │ │ │ │ -_1_6_8void _p_r_i_n_t_V_e_c_t_o_r(const std::vector & v, std::string name, int rank) │ │ │ │ │ -169{ │ │ │ │ │ -170 std::cout << rank << ": " << name << std::endl; │ │ │ │ │ -171 for (size_t i=0; i │ │ │ │ │ -_1_7_9void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_m_e_r_g_e_P_a_t_c_h_e_s( │ │ │ │ │ -180 const std::vector >& patch0coords, │ │ │ │ │ -181 const std::vector& patch0entities, │ │ │ │ │ -182 const std::vector& patch0types, │ │ │ │ │ -183 const int patch0rank, │ │ │ │ │ -184 const std::vector >& patch1coords, │ │ │ │ │ -185 const std::vector& patch1entities, │ │ │ │ │ -186 const std::vector& patch1types, │ │ │ │ │ -187 const int patch1rank) │ │ │ │ │ -188{ │ │ │ │ │ -189 │ │ │ │ │ -190 // howto handle overlap etc? │ │ │ │ │ -191 │ │ │ │ │ -192 int myrank = 0; │ │ │ │ │ -193#if HAVE_MPI │ │ │ │ │ -194 int commsize = 1; │ │ │ │ │ -195 MPI_Comm_rank(mpicomm_, &myrank); │ │ │ │ │ -196 MPI_Comm_size(mpicomm_, &commsize); │ │ │ │ │ -197#endif // HAVE_MPI │ │ │ │ │ -198 │ │ │ │ │ -199 // which patches are local? │ │ │ │ │ -200 const bool patch0local = (myrank == patch0rank); │ │ │ │ │ -201 const bool patch1local = (myrank == patch1rank); │ │ │ │ │ -202 │ │ │ │ │ -203 // remember the number of previous remote intersections │ │ │ │ │ -204 const unsigned int offset = intersections_.size()-1; │ │ │ │ │ -205 │ │ │ │ │ -206 std::cout << myrank │ │ │ │ │ -207 << " GridGlue::mergePatches : rank " << patch0rank << " / " << patch1rank │ │ │ │ │ -<< std::endl; │ │ │ │ │ -208 │ │ │ │ │ -209 // start the actual build process │ │ │ │ │ -210 merger_->build(patch0coords, patch0entities, patch0types, │ │ │ │ │ -211 patch1coords, patch1entities, patch1types); │ │ │ │ │ -212 │ │ │ │ │ -213 // append to intersections list │ │ │ │ │ -214 intersections_.resize(merger_->nSimplices() + offset + 1); │ │ │ │ │ -215 for (unsigned int i = 0; i < merger_->nSimplices(); ++i) │ │ │ │ │ -216 intersections_[offset + i] = _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a(*this, i, offset, │ │ │ │ │ -patch0local, patch1local); │ │ │ │ │ -217 │ │ │ │ │ -218 index__sz = intersections_.size() - 1; │ │ │ │ │ -219 │ │ │ │ │ -220 std::cout << myrank │ │ │ │ │ -221 << " GridGlue::mergePatches : " │ │ │ │ │ -222 << "The number of remote intersections is " << intersections_.size()-1 << │ │ │ │ │ -std::endl; │ │ │ │ │ -223 │ │ │ │ │ -224#if 0 │ │ │ │ │ -225 _p_r_i_n_t_V_e_c_t_o_r(patch0coords,"patch0coords",myrank); │ │ │ │ │ -226 _p_r_i_n_t_V_e_c_t_o_r(patch0entities,"patch0entities",myrank); │ │ │ │ │ -227 _p_r_i_n_t_V_e_c_t_o_r(patch0types,"patch0types",myrank); │ │ │ │ │ -228 _p_r_i_n_t_V_e_c_t_o_r(patch1coords,"patch1coords",myrank); │ │ │ │ │ -229 _p_r_i_n_t_V_e_c_t_o_r(patch1entities,"patch1entities",myrank); │ │ │ │ │ -230 _p_r_i_n_t_V_e_c_t_o_r(patch1types,"patch1types",myrank); │ │ │ │ │ -231#endif │ │ │ │ │ -232 │ │ │ │ │ -233#if HAVE_MPI │ │ │ │ │ -234 if (commsize > 1) │ │ │ │ │ -235 { │ │ │ │ │ -236 // update remote index sets │ │ │ │ │ -237 assert(Dune::RESIZE == patch0_is_.state()); │ │ │ │ │ -238 assert(Dune::RESIZE == patch1_is_.state()); │ │ │ │ │ -239 │ │ │ │ │ -240 for (unsigned int i = 0; i < merger_->nSimplices(); i++) │ │ │ │ │ -241 { │ │ │ │ │ -242 // #warning only handle the newest intersections / merger info │ │ │ │ │ -243 const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a & it = intersections_[i]; │ │ │ │ │ -244 _G_l_o_b_a_l_I_d gid(patch0rank, patch1rank, i); │ │ │ │ │ -245 if (it.template local<0>()) │ │ │ │ │ -246 { │ │ │ │ │ -247 Dune::PartitionType ptype = patch<0>().element(it.template index<0> │ │ │ │ │ -()).partitionType(); │ │ │ │ │ -248 patch0_is_.add (gid, LocalIndex(offset+i, ptype) ); │ │ │ │ │ -249 } │ │ │ │ │ -250 if (it.template local<1>()) │ │ │ │ │ -251 { │ │ │ │ │ -252 Dune::PartitionType ptype = patch<1>().element(it.template index<1> │ │ │ │ │ -()).partitionType(); │ │ │ │ │ -253 patch1_is_.add (gid, LocalIndex(offset+i, ptype) ); │ │ │ │ │ -254 } │ │ │ │ │ -255 } │ │ │ │ │ -256 } │ │ │ │ │ -257#endif // HAVE_MPI │ │ │ │ │ -258 │ │ │ │ │ -259 // cleanup the merger │ │ │ │ │ -260 merger_->clear(); │ │ │ │ │ -261} │ │ │ │ │ -262 │ │ │ │ │ -263template │ │ │ │ │ -264template │ │ │ │ │ -_2_6_5void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_e_x_t_r_a_c_t_G_r_i_d (const _E_x_t_r_a_c_t_o_r & extractor, │ │ │ │ │ -266 std::vector > & coords, │ │ │ │ │ -267 std::vector & entities, │ │ │ │ │ -268 std::vector& geometryTypes) const │ │ │ │ │ -269{ │ │ │ │ │ -270 std::vector tempcoords; │ │ │ │ │ -271 std::vector tempentities; │ │ │ │ │ -272 │ │ │ │ │ -273 extractor._g_e_t_C_o_o_r_d_s(tempcoords); │ │ │ │ │ -274 coords.clear(); │ │ │ │ │ -275 coords.reserve(tempcoords.size()); │ │ │ │ │ -276 │ │ │ │ │ -277 for (unsigned int i = 0; i < tempcoords.size(); ++i) │ │ │ │ │ -278 { │ │ │ │ │ -279 assert(int(dimworld) == int(_E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d)); │ │ │ │ │ -280 coords.push_back(Dune::FieldVector()); │ │ │ │ │ -281 for (size_t j = 0; j │ │ │ │ │ -299template │ │ │ │ │ -_3_0_0void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_c_o_m_m_u_n_i_c_a_t_e( │ │ │ │ │ -301 _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_D_a_t_a_H_a_n_d_l_e_I_m_p_,_D_a_t_a_T_y_p_e_I_m_p_> & data, │ │ │ │ │ -302 Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const │ │ │ │ │ -303{ │ │ │ │ │ -304 typedef _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_D_a_t_a_H_a_n_d_l_e_I_m_p_,_D_a_t_a_T_y_p_e_I_m_p_> │ │ │ │ │ -DataHandle; │ │ │ │ │ -305 typedef typename DataHandle::DataType DataType; │ │ │ │ │ -306 │ │ │ │ │ -307#if HAVE_MPI │ │ │ │ │ -308 │ │ │ │ │ -309 if (mpicomm_ != MPI_COMM_SELF) │ │ │ │ │ -310 { │ │ │ │ │ -311 /* │ │ │ │ │ -312 * P A R A L L E L V E R S I O N │ │ │ │ │ -313 */ │ │ │ │ │ -314 // setup communication interfaces │ │ │ │ │ -315 Dune::dinfo << "GridGlue: parallel communication" << std::endl; │ │ │ │ │ -316 typedef Dune::EnumItem │ │ │ │ │ -InteriorFlags; │ │ │ │ │ -317 typedef Dune::EnumItem │ │ │ │ │ -OverlapFlags; │ │ │ │ │ -318 typedef Dune::EnumRange AllFlags; │ │ │ │ │ -319 Dune::Interface interface; │ │ │ │ │ -320 assert(remoteIndices_.isSynced()); │ │ │ │ │ -321 switch (iftype) │ │ │ │ │ -322 { │ │ │ │ │ -323 case Dune::InteriorBorder_InteriorBorder_Interface : │ │ │ │ │ -324 interface.build (remoteIndices_, InteriorFlags(), InteriorFlags() ); │ │ │ │ │ -325 break; │ │ │ │ │ -326 case Dune::InteriorBorder_All_Interface : │ │ │ │ │ -327 if (dir == Dune::ForwardCommunication) │ │ │ │ │ -328 interface.build (remoteIndices_, InteriorFlags(), AllFlags() ); │ │ │ │ │ -329 else │ │ │ │ │ -330 interface.build (remoteIndices_, AllFlags(), InteriorFlags() ); │ │ │ │ │ -331 break; │ │ │ │ │ -332 case Dune::Overlap_OverlapFront_Interface : │ │ │ │ │ -333 interface.build (remoteIndices_, OverlapFlags(), OverlapFlags() ); │ │ │ │ │ -334 break; │ │ │ │ │ -335 case Dune::Overlap_All_Interface : │ │ │ │ │ -336 if (dir == Dune::ForwardCommunication) │ │ │ │ │ -337 interface.build (remoteIndices_, OverlapFlags(), AllFlags() ); │ │ │ │ │ -338 else │ │ │ │ │ -339 interface.build (remoteIndices_, AllFlags(), OverlapFlags() ); │ │ │ │ │ -340 break; │ │ │ │ │ -341 case Dune::All_All_Interface : │ │ │ │ │ -342 interface.build (remoteIndices_, AllFlags(), AllFlags() ); │ │ │ │ │ -343 break; │ │ │ │ │ -344 default : │ │ │ │ │ -345 DUNE_THROW(Dune::NotImplemented, "GridGlue::communicate for interface " << │ │ │ │ │ -iftype << " not implemented"); │ │ │ │ │ -346 } │ │ │ │ │ -347 │ │ │ │ │ -348 // setup communication info (class needed to tunnel all info to the │ │ │ │ │ -operator) │ │ │ │ │ -349 typedef _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_G_r_i_d_G_l_u_e_,_D_a_t_a_H_a_n_d_l_e_I_m_p_,_D_a_t_a_T_y_p_e_I_m_p_> │ │ │ │ │ -_C_o_m_m_I_n_f_o; │ │ │ │ │ -350 _C_o_m_m_I_n_f_o commInfo; │ │ │ │ │ -351 commInfo._d_i_r = dir; │ │ │ │ │ -352 commInfo._g_r_i_d_g_l_u_e = this; │ │ │ │ │ -353 commInfo._d_a_t_a = &data; │ │ │ │ │ -354 │ │ │ │ │ -355 // create communicator │ │ │ │ │ -356 Dune::BufferedCommunicator bComm ; │ │ │ │ │ -357 bComm.template build< CommInfo >(commInfo, commInfo, interface); │ │ │ │ │ -358 │ │ │ │ │ -359 // do communication │ │ │ │ │ -360 // choose communication direction. │ │ │ │ │ -361 if (dir == Dune::ForwardCommunication) │ │ │ │ │ -362 bComm.forward< _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_F_o_r_w_a_r_d_O_p_e_r_a_t_o_r >(commInfo, commInfo); │ │ │ │ │ -363 else │ │ │ │ │ -364 bComm.backward< _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r >(commInfo, commInfo); │ │ │ │ │ -365 } │ │ │ │ │ -366 else │ │ │ │ │ -367#endif // HAVE_MPI │ │ │ │ │ -368 { │ │ │ │ │ -369 /* │ │ │ │ │ -370 * S E Q U E N T I A L V E R S I O N │ │ │ │ │ -371 */ │ │ │ │ │ -372 Dune::dinfo << "GridGlue: sequential fallback communication" << std::endl; │ │ │ │ │ -373 │ │ │ │ │ -374 // get comm buffer size │ │ │ │ │ -375 int ssz = size() * 10; // times data per intersection │ │ │ │ │ -376 int rsz = size() * 10; │ │ │ │ │ -377 │ │ │ │ │ -378 // allocate send/receive buffer │ │ │ │ │ -379 auto sendbuffer = std::make_unique(ssz); │ │ │ │ │ -380 auto receivebuffer = std::make_unique(rsz); │ │ │ │ │ -381 │ │ │ │ │ -382 // gather │ │ │ │ │ -383 _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_<_D_a_t_a_T_y_p_e_> gatherbuffer │ │ │ │ │ -(sendbuffer.get()); │ │ │ │ │ -384 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(*this)) │ │ │ │ │ -385 { │ │ │ │ │ -386 /* │ │ │ │ │ -387 we need to have to variants depending on the communication direction. │ │ │ │ │ -388 */ │ │ │ │ │ -389 if (dir == Dune::ForwardCommunication) │ │ │ │ │ -390 { │ │ │ │ │ -391 /* │ │ │ │ │ -392 dir : Forward (grid0 -> grid1) │ │ │ │ │ -393 */ │ │ │ │ │ -394 if (in.self()) │ │ │ │ │ -395 { │ │ │ │ │ -396 data._g_a_t_h_e_r(gatherbuffer, in.inside(), in); │ │ │ │ │ -397 } │ │ │ │ │ -398 } │ │ │ │ │ -399 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ -400 { │ │ │ │ │ -401 /* │ │ │ │ │ -402 dir : Backward (grid1 -> grid0) │ │ │ │ │ -403 */ │ │ │ │ │ -404 if (in.neighbor()) │ │ │ │ │ -405 { │ │ │ │ │ -406 data._g_a_t_h_e_r(gatherbuffer, in.outside(), in.flip()); │ │ │ │ │ -407 } │ │ │ │ │ -408 } │ │ │ │ │ -409 } │ │ │ │ │ -410 │ │ │ │ │ -411 assert(ssz == rsz); │ │ │ │ │ -412 for (int i=0; i scatterbuffer │ │ │ │ │ -(receivebuffer.get()); │ │ │ │ │ -417 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(*this)) │ │ │ │ │ -418 { │ │ │ │ │ -419 /* │ │ │ │ │ -420 we need to have to variants depending on the communication direction. │ │ │ │ │ -421 */ │ │ │ │ │ -422 if (dir == Dune::ForwardCommunication) │ │ │ │ │ -423 { │ │ │ │ │ -424 /* │ │ │ │ │ -425 dir : Forward (grid0 -> grid1) │ │ │ │ │ -426 */ │ │ │ │ │ -427 if (in.neighbor()) │ │ │ │ │ -428 data._s_c_a_t_t_e_r(scatterbuffer, in.outside(), in.flip(), │ │ │ │ │ -429 data._s_i_z_e(in)); │ │ │ │ │ -430 } │ │ │ │ │ -431 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ -432 { │ │ │ │ │ -433 /* │ │ │ │ │ -434 dir : Backward (grid1 -> grid0) │ │ │ │ │ -435 */ │ │ │ │ │ -436 if (in.self()) │ │ │ │ │ -437 data._s_c_a_t_t_e_r(scatterbuffer, in.inside(), in, │ │ │ │ │ -438 data._s_i_z_e(in)); │ │ │ │ │ -439 } │ │ │ │ │ -440 } │ │ │ │ │ -441 } │ │ │ │ │ -442} │ │ │ │ │ -443 │ │ │ │ │ -444} // end namespace GridGlue │ │ │ │ │ -445} // end namespace Dune │ │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ -Model of the Intersection concept provided by GridGlue. │ │ │ │ │ +62 // //////////////////////////////////////////// │ │ │ │ │ +63 // Write vertices │ │ │ │ │ +64 // //////////////////////////////////////////// │ │ │ │ │ +65 │ │ │ │ │ +66 //use dim and not dim+1 │ │ │ │ │ +67 fgrid<<"\nVertices "<< overlaps*(dim)<<"\n"; │ │ │ │ │ +68 auto isEnd = glue.template iend(); │ │ │ │ │ +69 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt) │ │ │ │ │ +70 { │ │ │ │ │ +71 const auto& geometry = isIt->geometry(); │ │ │ │ │ +72 for (int i = 0; i < geometry.corners(); ++i) │ │ │ │ │ +73 fgrid << geometry.corner(i) << coordinatePadding << std::endl; │ │ │ │ │ +74 } │ │ │ │ │ +75 │ │ │ │ │ +76 // //////////////////////////////////////////// │ │ │ │ │ +77 // Write triangles │ │ │ │ │ +78 // //////////////////////////////////////////// │ │ │ │ │ +79 │ │ │ │ │ +80 fgrid<<"NBranchingPoints 0\n"; │ │ │ │ │ +81 fgrid<<"NVerticesOnCurves 0\n"; │ │ │ │ │ +82 fgrid<<"BoundaryCurves 0\n"; │ │ │ │ │ +83 fgrid<<"Patches 1\n"; │ │ │ │ │ +84 fgrid<<"{\n"; │ │ │ │ │ +85 fgrid<<"InnerRegion inside\n"; │ │ │ │ │ +86 fgrid<<"OuterRegion outside\n"; │ │ │ │ │ +87 fgrid<<"BoundaryID 0\n"; │ │ │ │ │ +88 fgrid<<"BranchingPoints 0"; │ │ │ │ │ +89 fgrid<<"\n"; │ │ │ │ │ +90 │ │ │ │ │ +91 fgrid<<"Triangles "<(); │ │ │ │ │ +119 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt) { │ │ │ │ │ +120 const auto& geometry = isIt->geometry(); │ │ │ │ │ +121 for (int i = 0; i <2; ++i) │ │ │ │ │ +122 fgrid << geometry.corner(i) <<" "<<0<<"\n"; │ │ │ │ │ +123 } │ │ │ │ │ +124 } │ │ │ │ │ +125 │ │ │ │ │ +126 fgrid.close(); │ │ │ │ │ +127 } │ │ │ │ │ +128 │ │ │ │ │ +129public: │ │ │ │ │ +130 template │ │ │ │ │ +_1_3_1 static void _w_r_i_t_e(const Glue& glue, const std::string& path, int │ │ │ │ │ +appendix=1) │ │ │ │ │ +132 { │ │ │ │ │ +133 std::ostringstream name0; │ │ │ │ │ +134 name0 << path; │ │ │ │ │ +135 name0 << "/domain.surf" << std::setw(3) << std::setfill('0') << appendix; │ │ │ │ │ +136 │ │ │ │ │ +137 // Write extracted grid and remote intersection on the grid1-side │ │ │ │ │ +138 writeIntersections(glue,name0.str()); │ │ │ │ │ +139 │ │ │ │ │ +140 std::ostringstream name1; │ │ │ │ │ +141 name1 << path; │ │ │ │ │ +142 name1 << "/target.surf" << std::setw(3) << std::setfill('0') << appendix; │ │ │ │ │ +143 │ │ │ │ │ +144 writeIntersections(glue, name1.str()); │ │ │ │ │ +145 } │ │ │ │ │ +146 │ │ │ │ │ +147}; │ │ │ │ │ +148 │ │ │ │ │ +149} // namespace GridGlue │ │ │ │ │ +150} // namespace Dune │ │ │ │ │ +151 │ │ │ │ │ +152#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ -IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ -> &reverse=!reversed) │ │ │ │ │ -Iterate over all intersections of a GridGlue. │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t_V_e_c_t_o_r │ │ │ │ │ -void printVector(const std::vector< T > &v, std::string name, int rank) │ │ │ │ │ -DDeeffiinniittiioonn gridglue.cc:168 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_:_:_M_P_I___A_l_l_A_p_p_l_y │ │ │ │ │ -void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data) │ │ │ │ │ -apply an operator locally to a difstributed data set │ │ │ │ │ -DDeeffiinniittiioonn ringcomm.hh:297 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ -sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ -DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_m_e_r_g_e_P_a_t_c_h_e_s │ │ │ │ │ -void mergePatches(const std::vector< Dune::FieldVector< ctype, dimworld > > │ │ │ │ │ -&patch0coords, const std::vector< unsigned int > &patch0entities, const std:: │ │ │ │ │ -vector< Dune::GeometryType > &patch0types, const int patch0rank, const std:: │ │ │ │ │ -vector< Dune::FieldVector< ctype, dimworld > > &patch1coords, const std:: │ │ │ │ │ -vector< unsigned int > &patch1entities, const std::vector< Dune::GeometryType > │ │ │ │ │ -&patch1types, const int patch1rank) │ │ │ │ │ -after building the merged grid the intersection can be updated through this │ │ │ │ │ -method (for internal use) │ │ │ │ │ -DDeeffiinniittiioonn gridglue.cc:179 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_c_o_m_m_u_n_i_c_a_t_e │ │ │ │ │ -void communicate(Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > │ │ │ │ │ -&data, Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const │ │ │ │ │ -Communicate information on the MergedGrid of a GridGlue. │ │ │ │ │ -DDeeffiinniittiioonn gridglue.cc:300 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_b_u_i_l_d │ │ │ │ │ -void build() │ │ │ │ │ -DDeeffiinniittiioonn gridglue.cc:36 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_e_x_t_r_a_c_t_G_r_i_d │ │ │ │ │ -void extractGrid(const Extractor &extractor, std::vector< Dune::FieldVector< │ │ │ │ │ -ctype, dimworld > > &coords, std::vector< unsigned int > &faces, std::vector< │ │ │ │ │ -Dune::GeometryType > &geometryTypes) const │ │ │ │ │ -DDeeffiinniittiioonn gridglue.cc:265 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_P_a_t_c_h │ │ │ │ │ -std::conditional_t< side==0, P0, std::conditional_t< side==1, P1, void > > │ │ │ │ │ -GridPatch │ │ │ │ │ -DDeeffiinniittiioonn gridglue.hh:96 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ -storage class for Dune::GridGlue::Intersection related data │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ -describes the features of a data handle for communication in parallel runs │ │ │ │ │ -using the GridGlue::commun... │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_i_z_e │ │ │ │ │ -size_t size(RISType &i) const │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_c_a_t_t_e_r │ │ │ │ │ -void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, │ │ │ │ │ -size_t n) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_g_a_t_h_e_r │ │ │ │ │ -void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) │ │ │ │ │ -const │ │ │ │ │ -pack data from user to message buffer │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ -forward gather scatter to user defined CommInfo class │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o │ │ │ │ │ -collects all GridGlue data requried for communication │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_i_r │ │ │ │ │ -Dune::CommunicationDirection dir │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:288 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_a_t_a │ │ │ │ │ -::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_g_r_i_d_g_l_u_e │ │ │ │ │ -const GridGlue * gridglue │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:281 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ -Provides codimension-independent methods for grid extraction. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ -static constexpr auto dimworld │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_F_a_c_e_s │ │ │ │ │ -void getFaces(std::vector< VertexVector > &faces) const │ │ │ │ │ -Get the corners of the extracted subentities. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:304 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_G_e_o_m_e_t_r_y_T_y_p_e_s │ │ │ │ │ -void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const │ │ │ │ │ -Get the list of geometry types. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:293 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_C_o_o_r_d_s │ │ │ │ │ -void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) │ │ │ │ │ -const │ │ │ │ │ -getter for the coordinates array │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r │ │ │ │ │ +Write remote intersections to a AmiraMesh file for debugging purposes. │ │ │ │ │ +DDeeffiinniittiioonn gridglueamirawriter.hh:21 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r_:_:_w_r_i_t_e │ │ │ │ │ +static void write(const Glue &glue, const std::string &path, int appendix=1) │ │ │ │ │ +DDeeffiinniittiioonn gridglueamirawriter.hh:131 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersection.hh File Reference │ │ │ │ +dune-grid-glue: rangegenerators.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,73 +72,41 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Macros
│ │ │ │ -
intersection.hh File Reference
│ │ │ │ +Functions
│ │ │ │ +
rangegenerators.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Model of the Intersection concept provided by GridGlue. │ │ │ │ -More...

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <optional>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include <dune/common/deprecated.hh>
│ │ │ │ -#include <dune/common/version.hh>
│ │ │ │ -#include <dune/geometry/affinegeometry.hh>
│ │ │ │ -#include <dune/geometry/referenceelements.hh>
│ │ │ │ -#include <dune/grid-glue/gridglue.hh>
│ │ │ │ +
#include <dune/common/iteratorrange.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GridGlue::IntersectionData< P0, P1 >
 storage class for Dune::GridGlue::Intersection related data More...
 
struct  Dune::GridGlue::IntersectionTraits< P0, P1, inside, outside >
 
class  Dune::GridGlue::Intersection< P0, P1, I, O >
 The intersection of two entities of the two patches of a GridGlue. More...
struct  Dune::GridGlue::Reverse< reverse >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Macros

#define ONLY_SIMPLEX_INTERSECTIONS
 

│ │ │ │ +Functions

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

Detailed Description

│ │ │ │ -

Model of the Intersection concept provided by GridGlue.

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

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ ONLY_SIMPLEX_INTERSECTIONS

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,46 +1,27 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ │ -intersection.hh File Reference │ │ │ │ │ -Model of the Intersection concept provided by GridGlue. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +rangegenerators.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ - class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_<_ _P_0_,_ _P_1_ _> │ │ │ │ │ -  storage class for _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n related data _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_<_ _P_0_,_ _P_1_,_ _i_n_s_i_d_e_,_ _o_u_t_s_i_d_e_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_<_ _P_0_,_ _P_1_,_ _I_,_ _O_ _> │ │ │ │ │ -  The intersection of two entities of the two patches of a _G_r_i_d_G_l_u_e. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_<_ _r_e_v_e_r_s_e_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _O_N_L_Y___S_I_M_P_L_E_X___I_N_T_E_R_S_E_C_T_I_O_N_S │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template<... > │ │ │ │ │ +IteratorRange<... >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s (const _G_r_i_d_G_l_u_e<... > &glue, │ │ │ │ │ + const _R_e_v_e_r_s_e<... > &reverse=!reversed) │ │ │ │ │ +  Iterate over all intersections of a _G_r_i_d_G_l_u_e. │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Model of the Intersection concept provided by GridGlue. │ │ │ │ │ - Author │ │ │ │ │ - Christian Engwer │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? OONNLLYY__SSIIMMPPLLEEXX__IINNTTEERRSSEECCTTIIOONNSS ********** │ │ │ │ │ -#define ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersection.hh Source File │ │ │ │ +dune-grid-glue: rangegenerators.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,578 +74,78 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
intersection.hh
│ │ │ │ +
rangegenerators.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ -
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
11#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH
│ │ │ │ -
12#define DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH
│ │ │ │ -
13
│ │ │ │ -
14#include <algorithm>
│ │ │ │ -
15#include <optional>
│ │ │ │ -
16#include <tuple>
│ │ │ │ -
17
│ │ │ │ -
18#include <dune/common/deprecated.hh>
│ │ │ │ -
19#include <dune/common/version.hh>
│ │ │ │ -
20#include <dune/geometry/affinegeometry.hh>
│ │ │ │ -
21#include <dune/geometry/referenceelements.hh>
│ │ │ │ - │ │ │ │ -
23
│ │ │ │ -
24#define ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ -
25
│ │ │ │ -
26namespace Dune {
│ │ │ │ -
27 namespace GridGlue {
│ │ │ │ -
28
│ │ │ │ -
29 // forward declaration
│ │ │ │ -
30 template<typename P0, typename P1>
│ │ │ │ -
31 class IntersectionIndexSet;
│ │ │ │ +Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ +
3#ifndef DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
│ │ │ │ +
4#define DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
│ │ │ │ +
5
│ │ │ │ +
6#include <dune/common/iteratorrange.hh>
│ │ │ │ +
7
│ │ │ │ +
8namespace Dune {
│ │ │ │ +
9namespace GridGlue {
│ │ │ │ +
10
│ │ │ │ +
14template<bool reverse>
│ │ │ │ +
│ │ │ │ +
15struct Reverse
│ │ │ │ +
16 : std::integral_constant<bool, reverse>
│ │ │ │ +
17{
│ │ │ │ +
18 typedef Reverse type;
│ │ │ │ +
19
│ │ │ │ +
20 constexpr
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
22 { return {}; }
│ │ │ │ +
│ │ │ │ +
23};
│ │ │ │ +
│ │ │ │ +
24
│ │ │ │ +
25#ifdef DOXYGEN
│ │ │ │ +
26
│ │ │ │ + │ │ │ │
32
│ │ │ │ -
36 template<typename P0, typename P1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
38 {
│ │ │ │ -
39 public:
│ │ │ │ -
40 typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
│ │ │ │ -
41
│ │ │ │ - │ │ │ │ -
43
│ │ │ │ -
45 static constexpr int coorddim = GridGlue::dimworld;
│ │ │ │ -
46
│ │ │ │ -
47 private:
│ │ │ │ -
48 // intermediate quantities
│ │ │ │ -
49 template<int side>
│ │ │ │ -
50 static constexpr int dim() { return GridGlue::template GridView<side>::Grid::dimension - GridGlue::template GridPatch<side>::codim; }
│ │ │ │ -
51
│ │ │ │ -
52 public:
│ │ │ │ -
54 static constexpr int mydim = dim<0>() < dim<1>() ? dim<0>() : dim<1>();
│ │ │ │ -
55
│ │ │ │ -
56 template<int side>
│ │ │ │ -
57 using GridLocalGeometry = AffineGeometry<
│ │ │ │ -
58 typename GridGlue::template GridView<side>::ctype, mydim, GridGlue::template GridView<side>::dimension>;
│ │ │ │ -
59
│ │ │ │ -
60 using Grid0LocalGeometry [[deprecated("please use GridLocalGeometry<0> instead")]] = GridLocalGeometry<0>;
│ │ │ │ -
61 using Grid1LocalGeometry [[deprecated("please use GridLocalGeometry<1> instead")]] = GridLocalGeometry<1>;
│ │ │ │ -
62
│ │ │ │ -
63 template<int side>
│ │ │ │ -
64 using GridGeometry = AffineGeometry<
│ │ │ │ -
65 typename GridGlue::template GridView<side>::ctype, mydim, GridGlue::template GridView<side>::dimensionworld>;
│ │ │ │ -
66
│ │ │ │ -
67 using Grid0Geometry [[deprecated("please use GridGeometry<0> instead")]] = GridGeometry<0>;
│ │ │ │ -
68 using Grid1Geometry [[deprecated("please use GridGeometry<1> instead")]] = GridGeometry<1>;
│ │ │ │ +
66template<...>
│ │ │ │ +
67IteratorRange<...>
│ │ │ │ +
68intersections(const GridGlue<...>& glue, const Reverse<...>& reverse = !reversed);
│ │ │ │
69
│ │ │ │ -
70 template<int side>
│ │ │ │ -
71 using GridIndexType = typename GridGlue::template GridView<side>::IndexSet::IndexType;
│ │ │ │ -
72
│ │ │ │ -
73 using Grid0IndexType [[deprecated("please use GridIndexType<0> instead")]] = GridIndexType<0>;
│ │ │ │ -
74 using Grid1IndexType [[deprecated("please use GridIndexType<1> instead")]] = GridIndexType<1>;
│ │ │ │ +
70#else
│ │ │ │ +
71
│ │ │ │ +
72namespace {
│ │ │ │ +
73const Reverse<true> reversed = {};
│ │ │ │ +
74} /* namespace */
│ │ │ │
75
│ │ │ │ -
77 IntersectionData(const GridGlue& glue, unsigned int mergeindex, unsigned int offset, bool grid0local, bool grid1local);
│ │ │ │ -
78
│ │ │ │ -
80 IntersectionData() = default;
│ │ │ │ -
81
│ │ │ │ -
82 /* Accessor Functions */
│ │ │ │ +
76template<typename P0, typename P1, bool reverse = false>
│ │ │ │ +
77IteratorRange< typename GridGlue<P0, P1>::template IntersectionIterator<reverse ? 1 : 0> >
│ │ │ │ +
78intersections(const GridGlue<P0, P1>& glue, const Reverse<reverse>& = {})
│ │ │ │ +
79{
│ │ │ │ +
80 const static int side = reverse ? 1 : 0;
│ │ │ │ +
81 return {glue.template ibegin<side>(), glue.template iend<side>()};
│ │ │ │ +
82}
│ │ │ │
83
│ │ │ │ -
84 template<int side>
│ │ │ │ -
│ │ │ │ -
85 const GridLocalGeometry<side>& localGeometry(unsigned int parentId = 0) const
│ │ │ │ -
86 { return *std::get<side>(sideData_).gridlocalgeom[parentId]; }
│ │ │ │ -
│ │ │ │ -
87
│ │ │ │ -
88 template<int side>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
90 { return *std::get<side>(sideData_).gridgeom; }
│ │ │ │ -
│ │ │ │ -
91
│ │ │ │ -
92 template<int side>
│ │ │ │ -
│ │ │ │ -
93 bool local() const
│ │ │ │ -
94 { return std::get<side>(sideData_).gridlocal; }
│ │ │ │ -
│ │ │ │ -
95
│ │ │ │ -
96 template<int side>
│ │ │ │ -
│ │ │ │ -
97 IndexType index(unsigned int parentId = 0) const
│ │ │ │ -
98 { return std::get<side>(sideData_).gridindices[parentId]; }
│ │ │ │ -
│ │ │ │ -
99
│ │ │ │ -
100 template<int side>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
102 { return std::get<side>(sideData_).gridindices.size(); }
│ │ │ │ -
│ │ │ │ -
103
│ │ │ │ -
104 private:
│ │ │ │ -
105 template<int side>
│ │ │ │ -
106 void initializeGeometry(const GridGlue& glue, unsigned mergeindex);
│ │ │ │ -
107
│ │ │ │ -
108 /* M E M B E R V A R I A B L E S */
│ │ │ │ -
109
│ │ │ │ -
110 public:
│ │ │ │ - │ │ │ │ -
113
│ │ │ │ -
114 private:
│ │ │ │ -
115 template<int side>
│ │ │ │ -
116 struct SideData {
│ │ │ │ -
118 bool gridlocal = false;
│ │ │ │ -
119
│ │ │ │ -
121 std::vector< GridIndexType<side> > gridindices;
│ │ │ │ -
122
│ │ │ │ -
124 std::vector< std::optional< GridLocalGeometry<side> > > gridlocalgeom;
│ │ │ │ -
125
│ │ │ │ -
133 std::optional< GridGeometry<side> > gridgeom;
│ │ │ │ -
134 };
│ │ │ │ -
135
│ │ │ │ -
136 std::tuple< SideData<0>, SideData<1> > sideData_;
│ │ │ │ -
137 };
│ │ │ │ -
│ │ │ │ -
138
│ │ │ │ -
139 template<typename P0, typename P1>
│ │ │ │ -
140 template<int side>
│ │ │ │ -
141 void IntersectionData<P0, P1>::initializeGeometry(const GridGlue& glue, unsigned mergeindex)
│ │ │ │ -
142 {
│ │ │ │ -
143 auto& data = std::get<side>(sideData_);
│ │ │ │ -
144
│ │ │ │ -
145 const unsigned n_parents = glue.merger_->template parents<side>(mergeindex);
│ │ │ │ -
146
│ │ │ │ -
147 // init containers
│ │ │ │ -
148 data.gridindices.resize(n_parents);
│ │ │ │ -
149 data.gridlocalgeom.resize(n_parents);
│ │ │ │ -
150
│ │ │ │ -
151 // default values
│ │ │ │ -
152 data.gridindices[0] = 0;
│ │ │ │ -
153
│ │ │ │ -
154 static constexpr int nSimplexCorners = mydim + 1;
│ │ │ │ -
155 using ctype = typename GridGlue::ctype;
│ │ │ │ -
156
│ │ │ │ -
157 // initialize the local and the global geometries of grid `side`
│ │ │ │ -
158
│ │ │ │ -
159 // compute the coordinates of the subface's corners in codim 0 entity local coordinates
│ │ │ │ -
160 static constexpr int elementdim = GridGlue::template GridView<side>::template Codim<0>::Geometry::mydimension;
│ │ │ │ -
161
│ │ │ │ -
162 // coordinates within the subentity that contains the remote intersection
│ │ │ │ -
163 std::array<Dune::FieldVector< ctype, dim<side>() >, nSimplexCorners> corners_subEntity_local;
│ │ │ │ -
164
│ │ │ │ -
165 for (unsigned int par = 0; par < n_parents; ++par) {
│ │ │ │ -
166 for (int i = 0; i < nSimplexCorners; ++i)
│ │ │ │ -
167 corners_subEntity_local[i] = glue.merger_->template parentLocal<side>(mergeindex, i, par);
│ │ │ │ -
168
│ │ │ │ -
169 // Coordinates of the remote intersection corners wrt the element coordinate system
│ │ │ │ -
170 std::array<Dune::FieldVector<ctype, elementdim>, nSimplexCorners> corners_element_local;
│ │ │ │ -
171
│ │ │ │ -
172 if (data.gridlocal) {
│ │ │ │ -
173 data.gridindices[par] = glue.merger_->template parent<side>(mergeindex,par);
│ │ │ │ -
174
│ │ │ │ -
175 typename GridGlue::template GridPatch<side>::LocalGeometry
│ │ │ │ -
176 gridLocalGeometry = glue.template patch<side>().geometryLocal(data.gridindices[par]);
│ │ │ │ -
177 for (std::size_t i=0; i<corners_subEntity_local.size(); i++) {
│ │ │ │ -
178 corners_element_local[i] = gridLocalGeometry.global(corners_subEntity_local[i]);
│ │ │ │ -
179 }
│ │ │ │ -
180
│ │ │ │ -
181 // set the corners of the local geometry
│ │ │ │ -
182#ifdef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ -
183# if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ -
184 const Dune::GeometryType type = Dune::GeometryTypes::simplex(mydim);
│ │ │ │ -
185# else
│ │ │ │ -
186 const Dune::GeometryType type(Dune::GeometryType::simplex, mydim);
│ │ │ │ -
187# endif
│ │ │ │ -
188#else
│ │ │ │ -
189#error Not Implemented
│ │ │ │ -
190#endif
│ │ │ │ -
191 data.gridlocalgeom[par].emplace(type, corners_element_local);
│ │ │ │ -
192
│ │ │ │ -
193 // Add world geometry only for 0th parent
│ │ │ │ -
194 if (par == 0) {
│ │ │ │ -
195 typename GridGlue::template GridPatch<side>::Geometry
│ │ │ │ -
196 gridWorldGeometry = glue.template patch<side>().geometry(data.gridindices[par]);
│ │ │ │ -
197
│ │ │ │ -
198 // world coordinates of the remote intersection corners
│ │ │ │ -
199 std::array<Dune::FieldVector<ctype, GridGlue::template GridView<side>::dimensionworld>, nSimplexCorners> corners_global;
│ │ │ │ -
200
│ │ │ │ -
201 for (std::size_t i=0; i<corners_subEntity_local.size(); i++) {
│ │ │ │ -
202 corners_global[i] = gridWorldGeometry.global(corners_subEntity_local[i]);
│ │ │ │ -
203 }
│ │ │ │ -
204
│ │ │ │ -
205 data.gridgeom.emplace(type, corners_global);
│ │ │ │ -
206 }
│ │ │ │ -
207 }
│ │ │ │ -
208 }
│ │ │ │ -
209 }
│ │ │ │ -
210
│ │ │ │ -
212 template<typename P0, typename P1>
│ │ │ │ -
│ │ │ │ -
213 IntersectionData<P0, P1>::IntersectionData(const GridGlue& glue, unsigned int mergeindex, unsigned int offset,
│ │ │ │ -
214 bool grid0local, bool grid1local)
│ │ │ │ -
215 : index_(mergeindex+offset)
│ │ │ │ -
216 {
│ │ │ │ -
217 // if an invalid index is given do not proceed!
│ │ │ │ -
218 // (happens when the parent GridGlue initializes the "end"-Intersection)
│ │ │ │ -
219 assert (0 <= mergeindex || mergeindex < glue.index__sz);
│ │ │ │ -
220
│ │ │ │ -
221 std::get<0>(sideData_).gridlocal = grid0local;
│ │ │ │ -
222 std::get<1>(sideData_).gridlocal = grid1local;
│ │ │ │ -
223
│ │ │ │ -
224 initializeGeometry<0>(glue, mergeindex);
│ │ │ │ -
225 initializeGeometry<1>(glue, mergeindex);
│ │ │ │ -
226 }
│ │ │ │ -
│ │ │ │ -
227
│ │ │ │ -
232 template<typename P0, typename P1, int inside, int outside>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
234 {
│ │ │ │ - │ │ │ │ - │ │ │ │ -
237
│ │ │ │ -
238 using InsideGridView = typename GridGlue::template GridView<inside>;
│ │ │ │ -
239 using OutsideGridView = typename GridGlue::template GridView<outside>;
│ │ │ │ -
240
│ │ │ │ -
241 using InsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<inside>;
│ │ │ │ -
242 using OutsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<outside>;
│ │ │ │ -
243
│ │ │ │ -
244 using Geometry = typename IntersectionData::template GridGeometry<inside>;
│ │ │ │ -
245 using OutsideGeometry = typename IntersectionData::template GridGeometry<outside>;
│ │ │ │ -
246
│ │ │ │ -
247 static constexpr auto coorddim = IntersectionData::coorddim;
│ │ │ │ -
248 static constexpr auto mydim = IntersectionData::mydim;
│ │ │ │ -
249 static constexpr int insidePatch = inside;
│ │ │ │ -
250 static constexpr int outsidePatch = outside;
│ │ │ │ -
251
│ │ │ │ -
252 using ctype = typename GridGlue::ctype;
│ │ │ │ -
253 using LocalCoordinate = Dune::FieldVector<ctype, mydim>;
│ │ │ │ -
254 using GlobalCoordinate = Dune::FieldVector<ctype, coorddim>;
│ │ │ │ -
255 };
│ │ │ │ -
│ │ │ │ -
256
│ │ │ │ -
259 template<typename P0, typename P1, int I, int O>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
261 {
│ │ │ │ -
262
│ │ │ │ -
263 public:
│ │ │ │ -
264
│ │ │ │ - │ │ │ │ -
266
│ │ │ │ -
267 typedef typename Traits::GridGlue GridGlue;
│ │ │ │ - │ │ │ │ -
269
│ │ │ │ -
270
│ │ │ │ - │ │ │ │ - │ │ │ │ -
273
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
277
│ │ │ │ -
278 typedef typename Traits::Geometry Geometry;
│ │ │ │ -
279 typedef typename Traits::ctype ctype;
│ │ │ │ -
280
│ │ │ │ -
281 typedef typename InsideGridView::Traits::template Codim<0>::Entity InsideEntity;
│ │ │ │ -
282 typedef typename OutsideGridView::Traits::template Codim<0>::Entity OutsideEntity;
│ │ │ │ -
283
│ │ │ │ - │ │ │ │ - │ │ │ │ -
286
│ │ │ │ -
288 static constexpr auto coorddim = Traits::coorddim;
│ │ │ │ -
289
│ │ │ │ -
291 static constexpr auto mydim = Traits::mydim;
│ │ │ │ -
292
│ │ │ │ -
294 static constexpr int insidePatch = Traits::insidePatch;
│ │ │ │ -
295
│ │ │ │ -
297 static constexpr int outsidePatch = Traits::outsidePatch;
│ │ │ │ -
298
│ │ │ │ -
299 // typedef unsigned int IndexType;
│ │ │ │ -
300
│ │ │ │ -
301 private:
│ │ │ │ -
305 static constexpr int codimensionWorld = coorddim - mydim;
│ │ │ │ -
306
│ │ │ │ -
307 public:
│ │ │ │ -
308 /* C O N S T R U C T O R S */
│ │ │ │ -
309
│ │ │ │ -
│ │ │ │ -
311 Intersection(const GridGlue* glue, const IntersectionData* i) :
│ │ │ │ -
312 glue_(glue), i_(i) {}
│ │ │ │ -
│ │ │ │ -
313
│ │ │ │ -
314 /* F U N C T I O N A L I T Y */
│ │ │ │ -
315
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
319 inside(unsigned int parentId = 0) const
│ │ │ │ -
320 {
│ │ │ │ -
321 assert(self());
│ │ │ │ -
322 return glue_->template patch<I>().element(i_->template index<I>(parentId));
│ │ │ │ -
323 }
│ │ │ │ -
│ │ │ │ -
324
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
328 outside(unsigned int parentId = 0) const
│ │ │ │ -
329 {
│ │ │ │ -
330 assert(neighbor());
│ │ │ │ -
331 return glue_->template patch<O>().element(i_->template index<O>(parentId));
│ │ │ │ -
332 }
│ │ │ │ -
│ │ │ │ -
333
│ │ │ │ -
│ │ │ │ -
335 bool conforming() const
│ │ │ │ -
336 {
│ │ │ │ -
337 throw Dune::NotImplemented();
│ │ │ │ -
338 }
│ │ │ │ -
│ │ │ │ -
339
│ │ │ │ -
│ │ │ │ -
342 const InsideLocalGeometry& geometryInInside(unsigned int parentId = 0) const
│ │ │ │ -
343 {
│ │ │ │ -
344 return i_->template localGeometry<I>(parentId);
│ │ │ │ -
345 }
│ │ │ │ -
│ │ │ │ -
346
│ │ │ │ -
│ │ │ │ -
349 const OutsideLocalGeometry& geometryInOutside(unsigned int parentId = 0) const
│ │ │ │ -
350 {
│ │ │ │ -
351 return i_->template localGeometry<O>(parentId);
│ │ │ │ -
352 }
│ │ │ │ -
│ │ │ │ -
353
│ │ │ │ -
│ │ │ │ -
360 const Geometry& geometry() const
│ │ │ │ -
361 {
│ │ │ │ -
362 return i_->template geometry<I>();
│ │ │ │ -
363 }
│ │ │ │ -
│ │ │ │ -
364
│ │ │ │ -
│ │ │ │ -
371 const OutsideGeometry& geometryOutside() const // DUNE_DEPRECATED
│ │ │ │ -
372 {
│ │ │ │ -
373 return i_->template geometry<O>();
│ │ │ │ -
374 }
│ │ │ │ -
│ │ │ │ -
375
│ │ │ │ -
│ │ │ │ -
377 Dune::GeometryType type() const
│ │ │ │ -
378 {
│ │ │ │ -
379 #ifdef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ -
380 # if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ -
381 return Dune::GeometryTypes::simplex(mydim);
│ │ │ │ -
382 # else
│ │ │ │ -
383 static const Dune::GeometryType type(Dune::GeometryType::simplex, mydim);
│ │ │ │ -
384 return type;
│ │ │ │ -
385 # endif
│ │ │ │ -
386 #else
│ │ │ │ -
387 #error Not Implemented
│ │ │ │ -
388 #endif
│ │ │ │ -
389 }
│ │ │ │ -
│ │ │ │ -
390
│ │ │ │ -
391
│ │ │ │ -
│ │ │ │ -
393 bool self() const
│ │ │ │ -
394 {
│ │ │ │ -
395 return i_->template local<I>();
│ │ │ │ -
396 }
│ │ │ │ -
│ │ │ │ -
397
│ │ │ │ -
│ │ │ │ -
399 size_t neighbor(unsigned int g = 0) const
│ │ │ │ -
400 {
│ │ │ │ -
401 if (g == 0 && i_->template local<O>()) {
│ │ │ │ -
402 return i_->template parents<O>();
│ │ │ │ -
403 } else if (g == 1 && i_->template local<I>()) {
│ │ │ │ -
404 return i_->template parents<I>();
│ │ │ │ -
405 }
│ │ │ │ -
406 return 0;
│ │ │ │ -
407 }
│ │ │ │ -
│ │ │ │ -
408
│ │ │ │ -
│ │ │ │ -
410 int indexInInside(unsigned int parentId = 0) const
│ │ │ │ -
411 {
│ │ │ │ -
412 assert(self());
│ │ │ │ -
413 return glue_->template patch<I>().indexInInside(i_->template index<I>(parentId));
│ │ │ │ -
414 }
│ │ │ │ -
│ │ │ │ -
415
│ │ │ │ -
│ │ │ │ -
417 int indexInOutside(unsigned int parentId = 0) const
│ │ │ │ -
418 {
│ │ │ │ -
419 assert(neighbor());
│ │ │ │ -
420 return glue_->template patch<O>().indexInInside(i_->template index<O>(parentId));
│ │ │ │ -
421 }
│ │ │ │ -
│ │ │ │ -
422
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
428 {
│ │ │ │ -
429 GlobalCoordinate normal;
│ │ │ │ -
430
│ │ │ │ -
431 if (codimensionWorld == 0)
│ │ │ │ -
432 DUNE_THROW(Dune::Exception, "There is no normal vector to a full-dimensional intersection");
│ │ │ │ -
433 else if (codimensionWorld == 1) {
│ │ │ │ -
434 /* TODO: Implement the general n-ary cross product here */
│ │ │ │ -
435 const auto jacobianTransposed = geometry().jacobianTransposed(local);
│ │ │ │ -
436 if (mydim==1) {
│ │ │ │ -
437 normal[0] = - jacobianTransposed[0][1];
│ │ │ │ -
438 normal[1] = jacobianTransposed[0][0];
│ │ │ │ -
439 } else if (mydim==2) {
│ │ │ │ -
440 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][1]);
│ │ │ │ -
441 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][0]);
│ │ │ │ -
442 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - jacobianTransposed[0][1] * jacobianTransposed[1][0]);
│ │ │ │ -
443 } else
│ │ │ │ -
444 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for " << mydim << "-dimensional intersections yet");
│ │ │ │ -
445 } else
│ │ │ │ -
446 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for intersections with codim >= 2 yet");
│ │ │ │ -
447
│ │ │ │ -
448 return normal;
│ │ │ │ -
449 }
│ │ │ │ -
│ │ │ │ -
450
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
456 {
│ │ │ │ -
457 GlobalCoordinate normal = outerNormal(local);
│ │ │ │ -
458 normal /= normal.two_norm();
│ │ │ │ -
459 return normal;
│ │ │ │ -
460 }
│ │ │ │ -
│ │ │ │ -
461
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
467 {
│ │ │ │ -
468 return (unitOuterNormal(local) *= geometry().integrationElement(local));
│ │ │ │ -
469 }
│ │ │ │ -
│ │ │ │ -
470
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
476 {
│ │ │ │ -
477 return unitOuterNormal(ReferenceElements<ctype,mydim>::general(type()).position(0,0));
│ │ │ │ -
478 }
│ │ │ │ -
│ │ │ │ -
479
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
484 {
│ │ │ │ -
485 return Intersection<P0,P1,O,I>(glue_,i_);
│ │ │ │ -
486 }
│ │ │ │ -
│ │ │ │ -
487
│ │ │ │ -
488#ifdef QUICKHACK_INDEX
│ │ │ │ -
489 typedef typename GridGlue::IndexType IndexType;
│ │ │ │ -
490
│ │ │ │ -
491 IndexType index() const
│ │ │ │ -
492 {
│ │ │ │ -
493 return i_->index_;
│ │ │ │ -
494 }
│ │ │ │ -
495
│ │ │ │ -
496#endif
│ │ │ │ -
497
│ │ │ │ -
498 private:
│ │ │ │ -
499
│ │ │ │ -
500 friend class IntersectionIndexSet<P0,P1>;
│ │ │ │ -
501
│ │ │ │ -
502 /* M E M B E R V A R I A B L E S */
│ │ │ │ -
503
│ │ │ │ -
505 const GridGlue* glue_;
│ │ │ │ -
506
│ │ │ │ -
508 const IntersectionData* i_;
│ │ │ │ -
509 };
│ │ │ │ -
│ │ │ │ -
510
│ │ │ │ -
511
│ │ │ │ -
512 } // end namespace GridGlue
│ │ │ │ -
513} // end namespace Dune
│ │ │ │ -
514
│ │ │ │ -
515#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH
│ │ │ │ -
Central component of the module implementing the coupling of two grids.
│ │ │ │ +
84#endif // DOXYGEN
│ │ │ │ +
85
│ │ │ │ +
86} /* namespace GridGlue */
│ │ │ │ +
87} /* namespace Dune */
│ │ │ │ +
88
│ │ │ │ +
89#endif
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ +
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │ -
unsigned int IndexType
Definition gridglue.hh:147
│ │ │ │ -
PromotionTraits< typenameGridView< 0 >::ctype, typenameGridView< 1 >::ctype >::PromotedType ctype
The type used for coordinates.
Definition gridglue.hh:171
│ │ │ │ -
static constexpr int dimworld
export the world dimension This is the maximum of the extractors' world dimensions.
Definition gridglue.hh:166
│ │ │ │ -
storage class for Dune::GridGlue::Intersection related data
Definition intersection.hh:38
│ │ │ │ -
GridGlue::IndexType IndexType
Definition intersection.hh:42
│ │ │ │ -
AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, GridGlue::template GridView< side >::dimensionworld > GridGeometry
Definition intersection.hh:65
│ │ │ │ -
const GridLocalGeometry< side > & localGeometry(unsigned int parentId=0) const
Definition intersection.hh:85
│ │ │ │ -
static constexpr int coorddim
Dimension of the world space of the intersection.
Definition intersection.hh:45
│ │ │ │ -
GridGeometry< 0 > Grid0Geometry
Definition intersection.hh:67
│ │ │ │ -
typename GridGlue::template GridView< side >::IndexSet::IndexType GridIndexType
Definition intersection.hh:71
│ │ │ │ -
IndexType index(unsigned int parentId=0) const
Definition intersection.hh:97
│ │ │ │ -
IndexType parents() const
Definition intersection.hh:101
│ │ │ │ -
GridLocalGeometry< 1 > Grid1LocalGeometry
Definition intersection.hh:61
│ │ │ │ -
const GridGeometry< side > & geometry() const
Definition intersection.hh:89
│ │ │ │ -
bool local() const
Definition intersection.hh:93
│ │ │ │ -
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition intersection.hh:40
│ │ │ │ -
static constexpr int mydim
Dimension of the intersection.
Definition intersection.hh:54
│ │ │ │ -
AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, GridGlue::template GridView< side >::dimension > GridLocalGeometry
Definition intersection.hh:58
│ │ │ │ -
GridLocalGeometry< 0 > Grid0LocalGeometry
Definition intersection.hh:60
│ │ │ │ -
IndexType index_
index of this intersection after GridGlue interface
Definition intersection.hh:112
│ │ │ │ -
GridIndexType< 1 > Grid1IndexType
Definition intersection.hh:74
│ │ │ │ -
GridGeometry< 1 > Grid1Geometry
Definition intersection.hh:68
│ │ │ │ -
GridIndexType< 0 > Grid0IndexType
Definition intersection.hh:73
│ │ │ │ -
IntersectionData()=default
Default Constructor.
│ │ │ │ -
The intersection of two entities of the two patches of a GridGlue.
Definition intersection.hh:261
│ │ │ │ -
Traits::OutsideLocalGeometry OutsideLocalGeometry
Definition intersection.hh:275
│ │ │ │ -
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition intersection.hh:483
│ │ │ │ -
bool conforming() const
Return true if intersection is conforming.
Definition intersection.hh:335
│ │ │ │ -
InsideGridView::Traits::template Codim< 0 >::Entity InsideEntity
Definition intersection.hh:281
│ │ │ │ -
Traits::GridGlue GridGlue
Definition intersection.hh:267
│ │ │ │ -
int indexInOutside(unsigned int parentId=0) const
Local number of codim 1 entity in outside() Entity where intersection is contained in.
Definition intersection.hh:417
│ │ │ │ -
int indexInInside(unsigned int parentId=0) const
Local number of codim 1 entity in the inside() Entity where intersection is contained in.
Definition intersection.hh:410
│ │ │ │ -
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition intersection.hh:393
│ │ │ │ -
static constexpr auto mydim
dimension of the intersection
Definition intersection.hh:291
│ │ │ │ -
static constexpr int outsidePatch
outside patch
Definition intersection.hh:297
│ │ │ │ -
Dune::GeometryType type() const
Type of reference element for this intersection.
Definition intersection.hh:377
│ │ │ │ -
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition intersection.hh:319
│ │ │ │ -
Traits::LocalCoordinate LocalCoordinate
Definition intersection.hh:284
│ │ │ │ -
const OutsideLocalGeometry & geometryInOutside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the outside() element.
Definition intersection.hh:349
│ │ │ │ -
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return a unit outer normal.
Definition intersection.hh:455
│ │ │ │ -
Traits::ctype ctype
Definition intersection.hh:279
│ │ │ │ -
IntersectionTraits< P0, P1, I, O > Traits
Definition intersection.hh:265
│ │ │ │ -
Traits::IntersectionData IntersectionData
Definition intersection.hh:268
│ │ │ │ -
Traits::GlobalCoordinate GlobalCoordinate
Definition intersection.hh:285
│ │ │ │ -
Traits::OutsideGeometry OutsideGeometry
Definition intersection.hh:276
│ │ │ │ -
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition intersection.hh:399
│ │ │ │ -
Intersection(const GridGlue *glue, const IntersectionData *i)
Constructor for a given Dataset.
Definition intersection.hh:311
│ │ │ │ -
static constexpr int insidePatch
inside patch
Definition intersection.hh:294
│ │ │ │ -
Traits::Geometry Geometry
Definition intersection.hh:278
│ │ │ │ -
OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity
Definition intersection.hh:282
│ │ │ │ -
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition intersection.hh:328
│ │ │ │ -
const Geometry & geometry() const
Geometric information about this intersection as part of the inside grid.
Definition intersection.hh:360
│ │ │ │ -
Traits::InsideLocalGeometry InsideLocalGeometry
Definition intersection.hh:272
│ │ │ │ -
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition intersection.hh:427
│ │ │ │ -
const OutsideGeometry & geometryOutside() const
Geometric information about this intersection as part of the outside grid.
Definition intersection.hh:371
│ │ │ │ -
Traits::OutsideGridView OutsideGridView
Definition intersection.hh:274
│ │ │ │ -
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
Return an outer normal with the length of the integration element.
Definition intersection.hh:466
│ │ │ │ -
Traits::InsideGridView InsideGridView
Definition intersection.hh:271
│ │ │ │ -
const InsideLocalGeometry & geometryInInside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the inside() element.
Definition intersection.hh:342
│ │ │ │ -
GlobalCoordinate centerUnitOuterNormal() const
Unit outer normal at the center of the intersection.
Definition intersection.hh:475
│ │ │ │ -
static constexpr auto coorddim
dimension of the world space of the intersection
Definition intersection.hh:288
│ │ │ │ -
Definition intersection.hh:234
│ │ │ │ -
static constexpr int insidePatch
Definition intersection.hh:249
│ │ │ │ -
Dune::FieldVector< ctype, mydim > LocalCoordinate
Definition intersection.hh:253
│ │ │ │ -
static constexpr auto coorddim
Definition intersection.hh:247
│ │ │ │ -
typename IntersectionData::template GridGeometry< outside > OutsideGeometry
Definition intersection.hh:245
│ │ │ │ -
typename GridGlue::ctype ctype
Definition intersection.hh:252
│ │ │ │ -
typename GridGlue::template GridView< outside > OutsideGridView
Definition intersection.hh:239
│ │ │ │ -
Dune::FieldVector< ctype, coorddim > GlobalCoordinate
Definition intersection.hh:254
│ │ │ │ -
typename IntersectionData::template GridLocalGeometry< outside > OutsideLocalGeometry
Definition intersection.hh:242
│ │ │ │ -
typename GridGlue::template GridView< inside > InsideGridView
Definition intersection.hh:238
│ │ │ │ -
typename IntersectionData::template GridGeometry< inside > Geometry
Definition intersection.hh:244
│ │ │ │ -
typename IntersectionData::template GridLocalGeometry< inside > InsideLocalGeometry
Definition intersection.hh:241
│ │ │ │ -
static constexpr int outsidePatch
Definition intersection.hh:250
│ │ │ │ -
static constexpr auto mydim
Definition intersection.hh:248
│ │ │ │ +
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ +
Definition rangegenerators.hh:17
│ │ │ │ +
const Reverse< true > reversed
Definition rangegenerators.hh:31
│ │ │ │ +
Reverse type
Definition rangegenerators.hh:18
│ │ │ │ +
constexpr Reverse<!reverse > operator!() const
Definition rangegenerators.hh:21
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,752 +1,88 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -intersection.hh │ │ │ │ │ +rangegenerators.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ +2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -11#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH │ │ │ │ │ -12#define DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH │ │ │ │ │ -13 │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17 │ │ │ │ │ -18#include │ │ │ │ │ -19#include │ │ │ │ │ -20#include │ │ │ │ │ -21#include │ │ │ │ │ -22#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ -23 │ │ │ │ │ -_2_4#define ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ -25 │ │ │ │ │ -26namespace _D_u_n_e { │ │ │ │ │ -27 namespace GridGlue { │ │ │ │ │ -28 │ │ │ │ │ -29 // forward declaration │ │ │ │ │ -30 template │ │ │ │ │ -31 class IntersectionIndexSet; │ │ │ │ │ +3#ifndef DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH │ │ │ │ │ +4#define DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include │ │ │ │ │ +7 │ │ │ │ │ +8namespace _D_u_n_e { │ │ │ │ │ +9namespace GridGlue { │ │ │ │ │ +10 │ │ │ │ │ +14template │ │ │ │ │ +_1_5struct _R_e_v_e_r_s_e │ │ │ │ │ +16 : std::integral_constant │ │ │ │ │ +17{ │ │ │ │ │ +_1_8 typedef _R_e_v_e_r_s_e _t_y_p_e; │ │ │ │ │ +19 │ │ │ │ │ +20 constexpr │ │ │ │ │ +_2_1 _R_e_v_e_r_s_e_<_!_r_e_v_e_r_s_e_> _o_p_e_r_a_t_o_r_!() const │ │ │ │ │ +22 { return {}; } │ │ │ │ │ +23}; │ │ │ │ │ +24 │ │ │ │ │ +25#ifdef DOXYGEN │ │ │ │ │ +26 │ │ │ │ │ +_3_1const _R_e_v_e_r_s_e_<_t_r_u_e_> _r_e_v_e_r_s_e_d; │ │ │ │ │ 32 │ │ │ │ │ -36 template │ │ │ │ │ -_3_7 class _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ -38 { │ │ │ │ │ -39 public: │ │ │ │ │ -_4_0 typedef ::Dune::GridGlue::GridGlue _G_r_i_d_G_l_u_e; │ │ │ │ │ -41 │ │ │ │ │ -_4_2 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e _I_n_d_e_x_T_y_p_e; │ │ │ │ │ -43 │ │ │ │ │ -_4_5 static constexpr int _c_o_o_r_d_d_i_m = _G_r_i_d_G_l_u_e_:_:_d_i_m_w_o_r_l_d; │ │ │ │ │ -46 │ │ │ │ │ -47 private: │ │ │ │ │ -48 // intermediate quantities │ │ │ │ │ -49 template │ │ │ │ │ -50 static constexpr int dim() { return GridGlue::template GridView:: │ │ │ │ │ -Grid::dimension - GridGlue::template GridPatch::codim; } │ │ │ │ │ -51 │ │ │ │ │ -52 public: │ │ │ │ │ -_5_4 static constexpr int _m_y_d_i_m = dim<0>() < dim<1>() ? dim<0>() : dim<1>(); │ │ │ │ │ -55 │ │ │ │ │ -56 template │ │ │ │ │ -_5_7 using _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y = AffineGeometry< │ │ │ │ │ -58 typename GridGlue::template GridView::ctype, _m_y_d_i_m, GridGlue::template │ │ │ │ │ -GridView::dimension>; │ │ │ │ │ -59 │ │ │ │ │ -_6_0 using _G_r_i_d_0_L_o_c_a_l_G_e_o_m_e_t_r_y [[deprecated("please use GridLocalGeometry<0> │ │ │ │ │ -instead")]] = _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_0_>; │ │ │ │ │ -_6_1 using _G_r_i_d_1_L_o_c_a_l_G_e_o_m_e_t_r_y [[deprecated("please use GridLocalGeometry<1> │ │ │ │ │ -instead")]] = _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_1_>; │ │ │ │ │ -62 │ │ │ │ │ -63 template │ │ │ │ │ -_6_4 using _G_r_i_d_G_e_o_m_e_t_r_y = AffineGeometry< │ │ │ │ │ -65 typename GridGlue::template GridView::ctype, _m_y_d_i_m, GridGlue::template │ │ │ │ │ -GridView::dimensionworld>; │ │ │ │ │ -66 │ │ │ │ │ -_6_7 using _G_r_i_d_0_G_e_o_m_e_t_r_y [[deprecated("please use GridGeometry<0> instead")]] = │ │ │ │ │ -_G_r_i_d_G_e_o_m_e_t_r_y_<_0_>; │ │ │ │ │ -_6_8 using _G_r_i_d_1_G_e_o_m_e_t_r_y [[deprecated("please use GridGeometry<1> instead")]] = │ │ │ │ │ -_G_r_i_d_G_e_o_m_e_t_r_y_<_1_>; │ │ │ │ │ +66template<...> │ │ │ │ │ +67IteratorRange<...> │ │ │ │ │ +_6_8_i_n_t_e_r_s_e_c_t_i_o_n_s(const _G_r_i_d_G_l_u_e_<_._._._>& glue, const _R_e_v_e_r_s_e_<_._._._>& reverse = │ │ │ │ │ +!reversed); │ │ │ │ │ 69 │ │ │ │ │ -70 template │ │ │ │ │ -_7_1 using _G_r_i_d_I_n_d_e_x_T_y_p_e = typename GridGlue::template GridView::IndexSet:: │ │ │ │ │ -IndexType; │ │ │ │ │ -72 │ │ │ │ │ -_7_3 using _G_r_i_d_0_I_n_d_e_x_T_y_p_e [[deprecated("please use GridIndexType<0> instead")]] = │ │ │ │ │ -_G_r_i_d_I_n_d_e_x_T_y_p_e_<_0_>; │ │ │ │ │ -_7_4 using _G_r_i_d_1_I_n_d_e_x_T_y_p_e [[deprecated("please use GridIndexType<1> instead")]] = │ │ │ │ │ -_G_r_i_d_I_n_d_e_x_T_y_p_e_<_1_>; │ │ │ │ │ +70#else │ │ │ │ │ +71 │ │ │ │ │ +72namespace { │ │ │ │ │ +73const _R_e_v_e_r_s_e_<_t_r_u_e_> reversed = {}; │ │ │ │ │ +74} /* namespace */ │ │ │ │ │ 75 │ │ │ │ │ -77 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a(const _G_r_i_d_G_l_u_e& glue, unsigned int mergeindex, unsigned int │ │ │ │ │ -offset, bool grid0local, bool grid1local); │ │ │ │ │ -78 │ │ │ │ │ -_8_0 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a() = default; │ │ │ │ │ -81 │ │ │ │ │ -82 /* Accessor Functions */ │ │ │ │ │ +76template │ │ │ │ │ +77IteratorRange< typename GridGlue::template │ │ │ │ │ +IntersectionIterator > │ │ │ │ │ +78_i_n_t_e_r_s_e_c_t_i_o_n_s(const GridGlue& glue, const Reverse& = {}) │ │ │ │ │ +79{ │ │ │ │ │ +80 const static int side = reverse ? 1 : 0; │ │ │ │ │ +81 return {glue.template ibegin(), glue.template iend()}; │ │ │ │ │ +82} │ │ │ │ │ 83 │ │ │ │ │ -84 template │ │ │ │ │ -_8_5 const _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_s_i_d_e_>& _l_o_c_a_l_G_e_o_m_e_t_r_y(unsigned int parentId = 0) │ │ │ │ │ -const │ │ │ │ │ -86 { return *std::get(sideData_).gridlocalgeom[parentId]; } │ │ │ │ │ -87 │ │ │ │ │ -88 template │ │ │ │ │ -_8_9 const _G_r_i_d_G_e_o_m_e_t_r_y_<_s_i_d_e_>& _g_e_o_m_e_t_r_y() const │ │ │ │ │ -90 { return *std::get(sideData_).gridgeom; } │ │ │ │ │ -91 │ │ │ │ │ -92 template │ │ │ │ │ -_9_3 bool _l_o_c_a_l() const │ │ │ │ │ -94 { return std::get(sideData_).gridlocal; } │ │ │ │ │ -95 │ │ │ │ │ -96 template │ │ │ │ │ -_9_7 _I_n_d_e_x_T_y_p_e _i_n_d_e_x(unsigned int parentId = 0) const │ │ │ │ │ -98 { return std::get(sideData_).gridindices[parentId]; } │ │ │ │ │ -99 │ │ │ │ │ -100 template │ │ │ │ │ -_1_0_1 _I_n_d_e_x_T_y_p_e _p_a_r_e_n_t_s() const │ │ │ │ │ -102 { return std::get(sideData_).gridindices.size(); } │ │ │ │ │ -103 │ │ │ │ │ -104 private: │ │ │ │ │ -105 template │ │ │ │ │ -106 void initializeGeometry(const _G_r_i_d_G_l_u_e& glue, unsigned mergeindex); │ │ │ │ │ -107 │ │ │ │ │ -108 /* M E M B E R V A R I A B L E S */ │ │ │ │ │ -109 │ │ │ │ │ -110 public: │ │ │ │ │ -_1_1_2 _I_n_d_e_x_T_y_p_e _i_n_d_e_x__; │ │ │ │ │ -113 │ │ │ │ │ -114 private: │ │ │ │ │ -115 template │ │ │ │ │ -116 struct SideData { │ │ │ │ │ -118 bool gridlocal = false; │ │ │ │ │ -119 │ │ │ │ │ -121 std::vector< GridIndexType > gridindices; │ │ │ │ │ -122 │ │ │ │ │ -124 std::vector< std::optional< GridLocalGeometry > > gridlocalgeom; │ │ │ │ │ -125 │ │ │ │ │ -133 std::optional< GridGeometry > gridgeom; │ │ │ │ │ -134 }; │ │ │ │ │ -135 │ │ │ │ │ -136 std::tuple< SideData<0>, SideData<1> > sideData_; │ │ │ │ │ -137 }; │ │ │ │ │ -138 │ │ │ │ │ -139 template │ │ │ │ │ -140 template │ │ │ │ │ -141 void IntersectionData::initializeGeometry(const GridGlue& glue, │ │ │ │ │ -unsigned mergeindex) │ │ │ │ │ -142 { │ │ │ │ │ -143 auto& data = std::get(sideData_); │ │ │ │ │ -144 │ │ │ │ │ -145 const unsigned n_parents = glue.merger_->template parents │ │ │ │ │ -(mergeindex); │ │ │ │ │ -146 │ │ │ │ │ -147 // init containers │ │ │ │ │ -148 data.gridindices.resize(n_parents); │ │ │ │ │ -149 data.gridlocalgeom.resize(n_parents); │ │ │ │ │ -150 │ │ │ │ │ -151 // default values │ │ │ │ │ -152 data.gridindices[0] = 0; │ │ │ │ │ -153 │ │ │ │ │ -154 static constexpr int nSimplexCorners = mydim + 1; │ │ │ │ │ -155 using ctype = typename _G_r_i_d_G_l_u_e_:_:_c_t_y_p_e; │ │ │ │ │ -156 │ │ │ │ │ -157 // initialize the local and the global geometries of grid `side` │ │ │ │ │ -158 │ │ │ │ │ -159 // compute the coordinates of the subface's corners in codim 0 entity local │ │ │ │ │ -coordinates │ │ │ │ │ -160 static constexpr int elementdim = GridGlue::template GridView:: │ │ │ │ │ -template Codim<0>::Geometry::mydimension; │ │ │ │ │ -161 │ │ │ │ │ -162 // coordinates within the subentity that contains the remote intersection │ │ │ │ │ -163 std::array() >, nSimplexCorners> │ │ │ │ │ -corners_subEntity_local; │ │ │ │ │ -164 │ │ │ │ │ -165 for (unsigned int par = 0; par < n_parents; ++par) { │ │ │ │ │ -166 for (int i = 0; i < nSimplexCorners; ++i) │ │ │ │ │ -167 corners_subEntity_local[i] = glue.merger_->template parentLocal │ │ │ │ │ -(mergeindex, i, par); │ │ │ │ │ -168 │ │ │ │ │ -169 // Coordinates of the remote intersection corners wrt the element │ │ │ │ │ -coordinate system │ │ │ │ │ -170 std::array, nSimplexCorners> │ │ │ │ │ -corners_element_local; │ │ │ │ │ -171 │ │ │ │ │ -172 if (data.gridlocal) { │ │ │ │ │ -173 data.gridindices[par] = glue.merger_->template parent │ │ │ │ │ -(mergeindex,par); │ │ │ │ │ -174 │ │ │ │ │ -175 typename GridGlue::template GridPatch::LocalGeometry │ │ │ │ │ -176 gridLocalGeometry = glue.template patch().geometryLocal │ │ │ │ │ -(data.gridindices[par]); │ │ │ │ │ -177 for (std::size_t i=0; i::Geometry │ │ │ │ │ -196 gridWorldGeometry = glue.template patch().geometry(data.gridindices │ │ │ │ │ -[par]); │ │ │ │ │ -197 │ │ │ │ │ -198 // world coordinates of the remote intersection corners │ │ │ │ │ -199 std::array:: │ │ │ │ │ -dimensionworld>, nSimplexCorners> corners_global; │ │ │ │ │ -200 │ │ │ │ │ -201 for (std::size_t i=0; i │ │ │ │ │ -_2_1_3 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_<_P_0_,_ _P_1_>_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a(const _G_r_i_d_G_l_u_e& glue, unsigned │ │ │ │ │ -int mergeindex, unsigned int offset, │ │ │ │ │ -214 bool grid0local, bool grid1local) │ │ │ │ │ -215 : index_(mergeindex+offset) │ │ │ │ │ -216 { │ │ │ │ │ -217 // if an invalid index is given do not proceed! │ │ │ │ │ -218 // (happens when the parent GridGlue initializes the "end"-Intersection) │ │ │ │ │ -219 assert (0 <= mergeindex || mergeindex < glue.index__sz); │ │ │ │ │ -220 │ │ │ │ │ -221 std::get<0>(sideData_).gridlocal = grid0local; │ │ │ │ │ -222 std::get<1>(sideData_).gridlocal = grid1local; │ │ │ │ │ -223 │ │ │ │ │ -224 initializeGeometry<0>(glue, mergeindex); │ │ │ │ │ -225 initializeGeometry<1>(glue, mergeindex); │ │ │ │ │ -226 } │ │ │ │ │ -227 │ │ │ │ │ -232 template │ │ │ │ │ -_2_3_3 struct _I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ │ -234 { │ │ │ │ │ -_2_3_5 using _G_r_i_d_G_l_u_e = _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>; │ │ │ │ │ -_2_3_6 using _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a = _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_<_P_0_,_ _P_1_>; │ │ │ │ │ -237 │ │ │ │ │ -_2_3_8 using _I_n_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ │ -_2_3_9 using _O_u_t_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ │ -240 │ │ │ │ │ -_2_4_1 using _I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ │ -GridLocalGeometry; │ │ │ │ │ -_2_4_2 using _O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ │ -GridLocalGeometry; │ │ │ │ │ -243 │ │ │ │ │ -_2_4_4 using _G_e_o_m_e_t_r_y = typename IntersectionData::template GridGeometry; │ │ │ │ │ -_2_4_5 using _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ │ -GridGeometry; │ │ │ │ │ -246 │ │ │ │ │ -_2_4_7 static constexpr auto _c_o_o_r_d_d_i_m = _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_c_o_o_r_d_d_i_m; │ │ │ │ │ -_2_4_8 static constexpr auto _m_y_d_i_m = _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_m_y_d_i_m; │ │ │ │ │ -_2_4_9 static constexpr int _i_n_s_i_d_e_P_a_t_c_h = inside; │ │ │ │ │ -_2_5_0 static constexpr int _o_u_t_s_i_d_e_P_a_t_c_h = outside; │ │ │ │ │ -251 │ │ │ │ │ -_2_5_2 using _c_t_y_p_e = typename _G_r_i_d_G_l_u_e_:_:_c_t_y_p_e; │ │ │ │ │ -_2_5_3 using _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e = Dune::FieldVector; │ │ │ │ │ -_2_5_4 using _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e = Dune::FieldVector; │ │ │ │ │ -255 }; │ │ │ │ │ -256 │ │ │ │ │ -259 template │ │ │ │ │ -_2_6_0 class _I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -261 { │ │ │ │ │ -262 │ │ │ │ │ -263 public: │ │ │ │ │ -264 │ │ │ │ │ -_2_6_5 typedef _I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_<_P_0_,_P_1_,_I_,_O_> _T_r_a_i_t_s; │ │ │ │ │ -266 │ │ │ │ │ -_2_6_7 typedef typename _T_r_a_i_t_s_:_:_G_r_i_d_G_l_u_e _G_r_i_d_G_l_u_e; │ │ │ │ │ -_2_6_8 typedef typename _T_r_a_i_t_s_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a; │ │ │ │ │ -269 │ │ │ │ │ -270 │ │ │ │ │ -_2_7_1 typedef typename _T_r_a_i_t_s_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w _I_n_s_i_d_e_G_r_i_d_V_i_e_w; │ │ │ │ │ -_2_7_2 typedef typename _T_r_a_i_t_s_:_:_I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y _I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y; │ │ │ │ │ -273 │ │ │ │ │ -_2_7_4 typedef typename _T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_r_i_d_V_i_e_w _O_u_t_s_i_d_e_G_r_i_d_V_i_e_w; │ │ │ │ │ -_2_7_5 typedef typename _T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y _O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y; │ │ │ │ │ -_2_7_6 typedef typename _T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y; │ │ │ │ │ -277 │ │ │ │ │ -_2_7_8 typedef typename _T_r_a_i_t_s_:_:_G_e_o_m_e_t_r_y _G_e_o_m_e_t_r_y; │ │ │ │ │ -_2_7_9 typedef typename _T_r_a_i_t_s_:_:_c_t_y_p_e _c_t_y_p_e; │ │ │ │ │ -280 │ │ │ │ │ -_2_8_1 typedef typename InsideGridView::Traits::template Codim<0>::Entity │ │ │ │ │ -_I_n_s_i_d_e_E_n_t_i_t_y; │ │ │ │ │ -_2_8_2 typedef typename OutsideGridView::Traits::template Codim<0>::Entity │ │ │ │ │ -_O_u_t_s_i_d_e_E_n_t_i_t_y; │ │ │ │ │ -283 │ │ │ │ │ -_2_8_4 typedef typename _T_r_a_i_t_s_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e; │ │ │ │ │ -_2_8_5 typedef typename _T_r_a_i_t_s_:_:_G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e; │ │ │ │ │ -286 │ │ │ │ │ -_2_8_8 static constexpr auto _c_o_o_r_d_d_i_m = _T_r_a_i_t_s_:_:_c_o_o_r_d_d_i_m; │ │ │ │ │ -289 │ │ │ │ │ -_2_9_1 static constexpr auto _m_y_d_i_m = _T_r_a_i_t_s_:_:_m_y_d_i_m; │ │ │ │ │ -292 │ │ │ │ │ -_2_9_4 static constexpr int _i_n_s_i_d_e_P_a_t_c_h = _T_r_a_i_t_s_:_:_i_n_s_i_d_e_P_a_t_c_h; │ │ │ │ │ -295 │ │ │ │ │ -_2_9_7 static constexpr int _o_u_t_s_i_d_e_P_a_t_c_h = _T_r_a_i_t_s_:_:_o_u_t_s_i_d_e_P_a_t_c_h; │ │ │ │ │ -298 │ │ │ │ │ -299 // typedef unsigned int IndexType; │ │ │ │ │ -300 │ │ │ │ │ -301 private: │ │ │ │ │ -305 static constexpr int codimensionWorld = _c_o_o_r_d_d_i_m - _m_y_d_i_m; │ │ │ │ │ -306 │ │ │ │ │ -307 public: │ │ │ │ │ -308 /* C O N S T R U C T O R S */ │ │ │ │ │ -309 │ │ │ │ │ -_3_1_1 _I_n_t_e_r_s_e_c_t_i_o_n(const _G_r_i_d_G_l_u_e* glue, const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a* i) : │ │ │ │ │ -312 glue_(glue), i_(i) {} │ │ │ │ │ -313 │ │ │ │ │ -314 /* F U N C T I O N A L I T Y */ │ │ │ │ │ -315 │ │ │ │ │ -318 _I_n_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ -_3_1_9 _i_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ -320 { │ │ │ │ │ -321 assert(_s_e_l_f()); │ │ │ │ │ -322 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ │ -323 } │ │ │ │ │ -324 │ │ │ │ │ -327 _O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ -_3_2_8 _o_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ -329 { │ │ │ │ │ -330 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ │ -331 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ │ -332 } │ │ │ │ │ -333 │ │ │ │ │ -_3_3_5 bool _c_o_n_f_o_r_m_i_n_g() const │ │ │ │ │ -336 { │ │ │ │ │ -337 throw Dune::NotImplemented(); │ │ │ │ │ -338 } │ │ │ │ │ -339 │ │ │ │ │ -_3_4_2 const _I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y_I_n_I_n_s_i_d_e(unsigned int parentId = 0) │ │ │ │ │ -const │ │ │ │ │ -343 { │ │ │ │ │ -344 return i_->template localGeometry(parentId); │ │ │ │ │ -345 } │ │ │ │ │ -346 │ │ │ │ │ -_3_4_9 const _O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y_I_n_O_u_t_s_i_d_e(unsigned int parentId = 0) │ │ │ │ │ -const │ │ │ │ │ -350 { │ │ │ │ │ -351 return i_->template localGeometry(parentId); │ │ │ │ │ -352 } │ │ │ │ │ -353 │ │ │ │ │ -_3_6_0 const _G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y() const │ │ │ │ │ -361 { │ │ │ │ │ -362 return i_->template geometry(); │ │ │ │ │ -363 } │ │ │ │ │ -364 │ │ │ │ │ -_3_7_1 const _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y_O_u_t_s_i_d_e() const // DUNE_DEPRECATED │ │ │ │ │ -372 { │ │ │ │ │ -373 return i_->template geometry(); │ │ │ │ │ -374 } │ │ │ │ │ -375 │ │ │ │ │ -_3_7_7 Dune::GeometryType _t_y_p_e() const │ │ │ │ │ -378 { │ │ │ │ │ -379 #ifdef ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ -380 # if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6) │ │ │ │ │ -381 return Dune::GeometryTypes::simplex(_m_y_d_i_m); │ │ │ │ │ -382 # else │ │ │ │ │ -383 static const Dune::GeometryType _t_y_p_e(Dune::GeometryType::simplex, _m_y_d_i_m); │ │ │ │ │ -384 return _t_y_p_e; │ │ │ │ │ -385 # endif │ │ │ │ │ -386 #else │ │ │ │ │ -387 #error Not Implemented │ │ │ │ │ -388 #endif │ │ │ │ │ -389 } │ │ │ │ │ -390 │ │ │ │ │ -391 │ │ │ │ │ -_3_9_3 bool _s_e_l_f() const │ │ │ │ │ -394 { │ │ │ │ │ -395 return i_->template local(); │ │ │ │ │ -396 } │ │ │ │ │ -397 │ │ │ │ │ -_3_9_9 size_t _n_e_i_g_h_b_o_r(unsigned int g = 0) const │ │ │ │ │ -400 { │ │ │ │ │ -401 if (g == 0 && i_->template local()) { │ │ │ │ │ -402 return i_->template parents(); │ │ │ │ │ -403 } else if (g == 1 && i_->template local()) { │ │ │ │ │ -404 return i_->template parents(); │ │ │ │ │ -405 } │ │ │ │ │ -406 return 0; │ │ │ │ │ -407 } │ │ │ │ │ -408 │ │ │ │ │ -_4_1_0 int _i_n_d_e_x_I_n_I_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ -411 { │ │ │ │ │ -412 assert(_s_e_l_f()); │ │ │ │ │ -413 return glue_->template patch().indexInInside(i_->template index │ │ │ │ │ -(parentId)); │ │ │ │ │ -414 } │ │ │ │ │ -415 │ │ │ │ │ -_4_1_7 int _i_n_d_e_x_I_n_O_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ -418 { │ │ │ │ │ -419 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ │ -420 return glue_->template patch().indexInInside(i_->template index │ │ │ │ │ -(parentId)); │ │ │ │ │ -421 } │ │ │ │ │ -422 │ │ │ │ │ -_4_2_7 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _o_u_t_e_r_N_o_r_m_a_l(const _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e &local) const │ │ │ │ │ -428 { │ │ │ │ │ -429 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e normal; │ │ │ │ │ -430 │ │ │ │ │ -431 if (codimensionWorld == 0) │ │ │ │ │ -432 DUNE_THROW(Dune::Exception, "There is no normal vector to a full- │ │ │ │ │ -dimensional intersection"); │ │ │ │ │ -433 else if (codimensionWorld == 1) { │ │ │ │ │ -434 /* TODO: Implement the general n-ary cross product here */ │ │ │ │ │ -435 const auto jacobianTransposed = _g_e_o_m_e_t_r_y().jacobianTransposed(local); │ │ │ │ │ -436 if (_m_y_d_i_m==1) { │ │ │ │ │ -437 normal[0] = - jacobianTransposed[0][1]; │ │ │ │ │ -438 normal[1] = jacobianTransposed[0][0]; │ │ │ │ │ -439 } else if (_m_y_d_i_m==2) { │ │ │ │ │ -440 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - │ │ │ │ │ -jacobianTransposed[0][2] * jacobianTransposed[1][1]); │ │ │ │ │ -441 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - │ │ │ │ │ -jacobianTransposed[0][2] * jacobianTransposed[1][0]); │ │ │ │ │ -442 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - │ │ │ │ │ -jacobianTransposed[0][1] * jacobianTransposed[1][0]); │ │ │ │ │ -443 } else │ │ │ │ │ -444 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ │ -'outerNormal' method for " << _m_y_d_i_m << "-dimensional intersections yet"); │ │ │ │ │ -445 } else │ │ │ │ │ -446 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ │ -'outerNormal' method for intersections with codim >= 2 yet"); │ │ │ │ │ -447 │ │ │ │ │ -448 return normal; │ │ │ │ │ -449 } │ │ │ │ │ -450 │ │ │ │ │ -_4_5_5 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _u_n_i_t_O_u_t_e_r_N_o_r_m_a_l(const _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e &local) const │ │ │ │ │ -456 { │ │ │ │ │ -457 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e normal = _o_u_t_e_r_N_o_r_m_a_l(local); │ │ │ │ │ -458 normal /= normal.two_norm(); │ │ │ │ │ -459 return normal; │ │ │ │ │ -460 } │ │ │ │ │ -461 │ │ │ │ │ -_4_6_6 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _i_n_t_e_g_r_a_t_i_o_n_O_u_t_e_r_N_o_r_m_a_l(const _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e &local) const │ │ │ │ │ -467 { │ │ │ │ │ -468 return (_u_n_i_t_O_u_t_e_r_N_o_r_m_a_l(local) *= _g_e_o_m_e_t_r_y().integrationElement(local)); │ │ │ │ │ -469 } │ │ │ │ │ -470 │ │ │ │ │ -_4_7_5 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _c_e_n_t_e_r_U_n_i_t_O_u_t_e_r_N_o_r_m_a_l () const │ │ │ │ │ -476 { │ │ │ │ │ -477 return _u_n_i_t_O_u_t_e_r_N_o_r_m_a_l(ReferenceElements::general(_t_y_p_e │ │ │ │ │ -()).position(0,0)); │ │ │ │ │ -478 } │ │ │ │ │ -479 │ │ │ │ │ -_4_8_3 _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_> _f_l_i_p() const │ │ │ │ │ -484 { │ │ │ │ │ -485 return _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_>(glue_,i_); │ │ │ │ │ -486 } │ │ │ │ │ -487 │ │ │ │ │ -488#ifdef QUICKHACK_INDEX │ │ │ │ │ -489 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e IndexType; │ │ │ │ │ -490 │ │ │ │ │ -491 IndexType index() const │ │ │ │ │ -492 { │ │ │ │ │ -493 return i_->_i_n_d_e_x__; │ │ │ │ │ -494 } │ │ │ │ │ -495 │ │ │ │ │ -496#endif │ │ │ │ │ -497 │ │ │ │ │ -498 private: │ │ │ │ │ -499 │ │ │ │ │ -500 friend class IntersectionIndexSet; │ │ │ │ │ -501 │ │ │ │ │ -502 /* M E M B E R V A R I A B L E S */ │ │ │ │ │ -503 │ │ │ │ │ -505 const _G_r_i_d_G_l_u_e* glue_; │ │ │ │ │ -506 │ │ │ │ │ -508 const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a* i_; │ │ │ │ │ -509 }; │ │ │ │ │ -510 │ │ │ │ │ -511 │ │ │ │ │ -512 } // end namespace GridGlue │ │ │ │ │ -513} // end namespace Dune │ │ │ │ │ -514 │ │ │ │ │ -515#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH │ │ │ │ │ -_g_r_i_d_g_l_u_e_._h_h │ │ │ │ │ -Central component of the module implementing the coupling of two grids. │ │ │ │ │ +84#endif // DOXYGEN │ │ │ │ │ +85 │ │ │ │ │ +86} /* namespace GridGlue */ │ │ │ │ │ +87} /* namespace Dune */ │ │ │ │ │ +88 │ │ │ │ │ +89#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ +> &reverse=!reversed) │ │ │ │ │ +Iterate over all intersections of a GridGlue. │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ -unsigned int IndexType │ │ │ │ │ -DDeeffiinniittiioonn gridglue.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_c_t_y_p_e │ │ │ │ │ -PromotionTraits< typenameGridView< 0 >::ctype, typenameGridView< 1 >::ctype >:: │ │ │ │ │ -PromotedType ctype │ │ │ │ │ -The type used for coordinates. │ │ │ │ │ -DDeeffiinniittiioonn gridglue.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ -static constexpr int dimworld │ │ │ │ │ -export the world dimension This is the maximum of the extractors' world │ │ │ │ │ -dimensions. │ │ │ │ │ -DDeeffiinniittiioonn gridglue.hh:166 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ -storage class for Dune::GridGlue::Intersection related data │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ -GridGlue::IndexType IndexType │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:42 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_G_e_o_m_e_t_r_y │ │ │ │ │ -AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, │ │ │ │ │ -GridGlue::template GridView< side >::dimensionworld > GridGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:65 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_l_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -const GridLocalGeometry< side > & localGeometry(unsigned int parentId=0) const │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:85 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_c_o_o_r_d_d_i_m │ │ │ │ │ -static constexpr int coorddim │ │ │ │ │ -Dimension of the world space of the intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_0_G_e_o_m_e_t_r_y │ │ │ │ │ -GridGeometry< 0 > Grid0Geometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_I_n_d_e_x_T_y_p_e │ │ │ │ │ -typename GridGlue::template GridView< side >::IndexSet::IndexType GridIndexType │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:71 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_i_n_d_e_x │ │ │ │ │ -IndexType index(unsigned int parentId=0) const │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:97 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_p_a_r_e_n_t_s │ │ │ │ │ -IndexType parents() const │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:101 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_1_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -GridLocalGeometry< 1 > Grid1LocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_g_e_o_m_e_t_r_y │ │ │ │ │ -const GridGeometry< side > & geometry() const │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_l_o_c_a_l │ │ │ │ │ -bool local() const │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ -::Dune::GridGlue::GridGlue< P0, P1 > GridGlue │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:40 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_m_y_d_i_m │ │ │ │ │ -static constexpr int mydim │ │ │ │ │ -Dimension of the intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, │ │ │ │ │ -GridGlue::template GridView< side >::dimension > GridLocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_0_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -GridLocalGeometry< 0 > Grid0LocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_i_n_d_e_x__ │ │ │ │ │ -IndexType index_ │ │ │ │ │ -index of this intersection after GridGlue interface │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:112 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_1_I_n_d_e_x_T_y_p_e │ │ │ │ │ -GridIndexType< 1 > Grid1IndexType │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_1_G_e_o_m_e_t_r_y │ │ │ │ │ -GridGeometry< 1 > Grid1Geometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:68 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_0_I_n_d_e_x_T_y_p_e │ │ │ │ │ -GridIndexType< 0 > Grid0IndexType │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ -IntersectionData()=default │ │ │ │ │ -Default Constructor. │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -The intersection of two entities of the two patches of a GridGlue. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -Traits::OutsideLocalGeometry OutsideLocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_f_l_i_p │ │ │ │ │ -Intersection< P0, P1, O, I > flip() const │ │ │ │ │ -Return a copy of the intersection with inside and outside switched. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:483 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_o_n_f_o_r_m_i_n_g │ │ │ │ │ -bool conforming() const │ │ │ │ │ -Return true if intersection is conforming. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:335 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ -InsideGridView::Traits::template Codim< 0 >::Entity InsideEntity │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:281 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ -Traits::GridGlue GridGlue │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:267 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_d_e_x_I_n_O_u_t_s_i_d_e │ │ │ │ │ -int indexInOutside(unsigned int parentId=0) const │ │ │ │ │ -Local number of codim 1 entity in outside() Entity where intersection is │ │ │ │ │ -contained in. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:417 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_d_e_x_I_n_I_n_s_i_d_e │ │ │ │ │ -int indexInInside(unsigned int parentId=0) const │ │ │ │ │ -Local number of codim 1 entity in the inside() Entity where intersection is │ │ │ │ │ -contained in. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:410 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_s_e_l_f │ │ │ │ │ -bool self() const │ │ │ │ │ -For parallel computations: Return true if inside() entity exists locally. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:393 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_m_y_d_i_m │ │ │ │ │ -static constexpr auto mydim │ │ │ │ │ -dimension of the intersection │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:291 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_s_i_d_e_P_a_t_c_h │ │ │ │ │ -static constexpr int outsidePatch │ │ │ │ │ -outside patch │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:297 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_t_y_p_e │ │ │ │ │ -Dune::GeometryType type() const │ │ │ │ │ -Type of reference element for this intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:377 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_s_i_d_e │ │ │ │ │ -InsideEntity inside(unsigned int parentId=0) const │ │ │ │ │ -Return element on the inside of this intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:319 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ -Traits::LocalCoordinate LocalCoordinate │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:284 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y_I_n_O_u_t_s_i_d_e │ │ │ │ │ -const OutsideLocalGeometry & geometryInOutside(unsigned int parentId=0) const │ │ │ │ │ -Geometric information about this intersection in local coordinates of the │ │ │ │ │ -outside() element. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:349 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_u_n_i_t_O_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ -GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const │ │ │ │ │ -Return a unit outer normal. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:455 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_t_y_p_e │ │ │ │ │ -Traits::ctype ctype │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:279 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_T_r_a_i_t_s │ │ │ │ │ -IntersectionTraits< P0, P1, I, O > Traits │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:265 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ -Traits::IntersectionData IntersectionData │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:268 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ -Traits::GlobalCoordinate GlobalCoordinate │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:285 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y │ │ │ │ │ -Traits::OutsideGeometry OutsideGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_n_e_i_g_h_b_o_r │ │ │ │ │ -size_t neighbor(unsigned int g=0) const │ │ │ │ │ -Return number of embeddings into local grid0 (grid1) entities. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:399 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -Intersection(const GridGlue *glue, const IntersectionData *i) │ │ │ │ │ -Constructor for a given Dataset. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:311 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_s_i_d_e_P_a_t_c_h │ │ │ │ │ -static constexpr int insidePatch │ │ │ │ │ -inside patch │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:294 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_G_e_o_m_e_t_r_y │ │ │ │ │ -Traits::Geometry Geometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:278 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ -OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_s_i_d_e │ │ │ │ │ -OutsideEntity outside(unsigned int parentId=0) const │ │ │ │ │ -Return element on the outside of this intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:328 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y │ │ │ │ │ -const Geometry & geometry() const │ │ │ │ │ -Geometric information about this intersection as part of the inside grid. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:360 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -Traits::InsideLocalGeometry InsideLocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ -GlobalCoordinate outerNormal(const LocalCoordinate &local) const │ │ │ │ │ -Return an outer normal (length not necessarily 1) │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:427 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y_O_u_t_s_i_d_e │ │ │ │ │ -const OutsideGeometry & geometryOutside() const │ │ │ │ │ -Geometric information about this intersection as part of the outside grid. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:371 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ -Traits::OutsideGridView OutsideGridView │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:274 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_t_e_g_r_a_t_i_o_n_O_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ -GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const │ │ │ │ │ -Return an outer normal with the length of the integration element. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:466 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ -Traits::InsideGridView InsideGridView │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:271 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y_I_n_I_n_s_i_d_e │ │ │ │ │ -const InsideLocalGeometry & geometryInInside(unsigned int parentId=0) const │ │ │ │ │ -Geometric information about this intersection in local coordinates of the │ │ │ │ │ -inside() element. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:342 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_e_n_t_e_r_U_n_i_t_O_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ -GlobalCoordinate centerUnitOuterNormal() const │ │ │ │ │ -Unit outer normal at the center of the intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:475 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_o_o_r_d_d_i_m │ │ │ │ │ -static constexpr auto coorddim │ │ │ │ │ -dimension of the world space of the intersection │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:288 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:234 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_i_n_s_i_d_e_P_a_t_c_h │ │ │ │ │ -static constexpr int insidePatch │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:249 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ -Dune::FieldVector< ctype, mydim > LocalCoordinate │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:253 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_o_r_d_d_i_m │ │ │ │ │ -static constexpr auto coorddim │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:247 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y │ │ │ │ │ -typename IntersectionData::template GridGeometry< outside > OutsideGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:245 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_c_t_y_p_e │ │ │ │ │ -typename GridGlue::ctype ctype │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:252 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ -typename GridGlue::template GridView< outside > OutsideGridView │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:239 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ -Dune::FieldVector< ctype, coorddim > GlobalCoordinate │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:254 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -typename IntersectionData::template GridLocalGeometry< outside > │ │ │ │ │ -OutsideLocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:242 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ -typename GridGlue::template GridView< inside > InsideGridView │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:238 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_G_e_o_m_e_t_r_y │ │ │ │ │ -typename IntersectionData::template GridGeometry< inside > Geometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:244 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -typename IntersectionData::template GridLocalGeometry< inside > │ │ │ │ │ -InsideLocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:241 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_o_u_t_s_i_d_e_P_a_t_c_h │ │ │ │ │ -static constexpr int outsidePatch │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:250 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_m_y_d_i_m │ │ │ │ │ -static constexpr auto mydim │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:248 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ +> &reverse=!reversed) │ │ │ │ │ +Iterate over all intersections of a GridGlue. │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e │ │ │ │ │ +DDeeffiinniittiioonn rangegenerators.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_:_:_r_e_v_e_r_s_e_d │ │ │ │ │ +const Reverse< true > reversed │ │ │ │ │ +DDeeffiinniittiioonn rangegenerators.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_:_:_t_y_p_e │ │ │ │ │ +Reverse type │ │ │ │ │ +DDeeffiinniittiioonn rangegenerators.hh:18 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_:_:_o_p_e_r_a_t_o_r_! │ │ │ │ │ +constexpr Reverse operator!() const │ │ │ │ │ +DDeeffiinniittiioonn rangegenerators.hh:21 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridgluevtkwriter.hh File Reference │ │ │ │ +dune-grid-glue: intersectioniterator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,46 +72,39 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
gridgluevtkwriter.hh File Reference
│ │ │ │ +
intersectioniterator.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Write all remote intersections to a vtk file for debugging. │ │ │ │ +

Implement iterators over GridGlue intersections. │ │ │ │ More...

│ │ │ │ -
#include <fstream>
│ │ │ │ -#include <iomanip>
│ │ │ │ -#include <type_traits>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <dune/common/classname.hh>
│ │ │ │ -#include <dune/geometry/type.hh>
│ │ │ │ -#include <dune/geometry/referenceelements.hh>
│ │ │ │ -#include <dune/grid-glue/gridglue.hh>
│ │ │ │ +
#include <dune/grid-glue/gridglue.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GridGlue::GridGlueVtkWriter
 Write remote intersections to a vtk file for debugging purposes. More...
class  Dune::GridGlue::IntersectionIterator< P0, P1, inside, outside >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

Write all remote intersections to a vtk file for debugging.

│ │ │ │ +

Implement iterators over GridGlue intersections.

│ │ │ │ +
Author
Christian Engwer
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,32 +2,25 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -gridgluevtkwriter.hh File Reference │ │ │ │ │ -Write all remote intersections to a vtk file for debugging. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +intersectioniterator.hh File Reference │ │ │ │ │ +Implement iterators over GridGlue intersections. _M_o_r_e_._._. │ │ │ │ │ #include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r │ │ │ │ │ -  Write remote intersections to a vtk file for debugging purposes. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_ _P_0_,_ _P_1_,_ _i_n_s_i_d_e_,_ _o_u_t_s_i_d_e_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Write all remote intersections to a vtk file for debugging. │ │ │ │ │ +Implement iterators over GridGlue intersections. │ │ │ │ │ + Author │ │ │ │ │ + Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridgluevtkwriter.hh Source File │ │ │ │ +dune-grid-glue: intersectioniterator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,318 +74,95 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
gridgluevtkwriter.hh
│ │ │ │ +
intersectioniterator.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
5/*
│ │ │ │ -
6 * Filename: GridGlueVtkWriter.hh
│ │ │ │ -
7 * Version: 1.0
│ │ │ │ -
8 * Created on: Mar 5, 2009
│ │ │ │ -
9 * Author: Gerrit Buse
│ │ │ │ -
10 * ---------------------------------
│ │ │ │ -
11 * Project: dune-grid-glue
│ │ │ │ -
12 * Description: Class thought to make graphical debugging of couplings easier.
│ │ │ │ -
13 *
│ │ │ │ -
14 */
│ │ │ │ -
20#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH
│ │ │ │ -
21#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH
│ │ │ │ -
22
│ │ │ │ -
23
│ │ │ │ -
24#include <fstream>
│ │ │ │ -
25#include <iomanip>
│ │ │ │ -
26#include <type_traits>
│ │ │ │ -
27#include <vector>
│ │ │ │ -
28
│ │ │ │ -
29#include <dune/common/classname.hh>
│ │ │ │ -
30#include <dune/geometry/type.hh>
│ │ │ │ -
31#include <dune/geometry/referenceelements.hh>
│ │ │ │ -
32
│ │ │ │ - │ │ │ │ -
34
│ │ │ │ -
35namespace Dune {
│ │ │ │ -
36namespace GridGlue {
│ │ │ │ -
37
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
41{
│ │ │ │ -
42
│ │ │ │ -
46 template <class Glue, int side>
│ │ │ │ -
47 static void writeExtractedPart(const Glue& glue, const std::string& filename)
│ │ │ │ -
48 {
│ │ │ │ -
49 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
│ │ │ │ -
50
│ │ │ │ -
51 std::ofstream fgrid;
│ │ │ │ -
52
│ │ │ │ -
53 fgrid.open(filename.c_str());
│ │ │ │ -
54
│ │ │ │ -
55 using GridView = typename Glue::template GridView<side>;
│ │ │ │ -
56 using Extractor = typename Glue::template GridPatch<side>;
│ │ │ │ -
57
│ │ │ │ -
58 typedef typename GridView::ctype ctype;
│ │ │ │ -
59
│ │ │ │ -
60 const int domdimw = GridView::dimensionworld;
│ │ │ │ -
61 const int patchDim = Extractor::dim - Extractor::codim;
│ │ │ │ -
62
│ │ │ │ -
63 // coordinates have to be in R^3 in the VTK format
│ │ │ │ -
64 std::string coordinatePadding;
│ │ │ │ -
65 for (int i=domdimw; i<3; i++)
│ │ │ │ -
66 coordinatePadding += " 0";
│ │ │ │ -
67
│ │ │ │ -
68 fgrid << "# vtk DataFile Version 2.0\nFilename: " << filename << "\nASCII" << std::endl;
│ │ │ │ -
69
│ │ │ │ -
70 // WRITE POINTS
│ │ │ │ -
71 // ----------------
│ │ │ │ -
72 std::vector<typename Extractor::Coords> coords;
│ │ │ │ -
73 glue.template patch<side>().getCoords(coords);
│ │ │ │ -
74
│ │ │ │ -
75 fgrid << ((patchDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET POLYDATA") << std::endl;
│ │ │ │ -
76 fgrid << "POINTS " << coords.size() << " " << Dune::className<ctype>() << std::endl;
│ │ │ │ -
77
│ │ │ │ -
78 for (size_t i=0; i<coords.size(); i++)
│ │ │ │ -
79 fgrid << coords[i] << coordinatePadding << std::endl;
│ │ │ │ -
80
│ │ │ │ -
81 fgrid << std::endl;
│ │ │ │ -
82
│ │ │ │ -
83 // WRITE POLYGONS
│ │ │ │ -
84 // ----------------
│ │ │ │ -
85
│ │ │ │ -
86 std::vector<typename Extractor::VertexVector> faces;
│ │ │ │ -
87 std::vector<Dune::GeometryType> geometryTypes;
│ │ │ │ -
88 glue.template patch<side>().getFaces(faces);
│ │ │ │ -
89 glue.template patch<side>().getGeometryTypes(geometryTypes);
│ │ │ │ -
90
│ │ │ │ -
91 unsigned int faceCornerCount = 0;
│ │ │ │ -
92 for (size_t i=0; i<faces.size(); i++)
│ │ │ │ -
93 faceCornerCount += faces[i].size();
│ │ │ │ -
94
│ │ │ │ -
95 fgrid << ((patchDim==3) ? "CELLS " : "POLYGONS ")
│ │ │ │ -
96 << geometryTypes.size() << " " << geometryTypes.size() + faceCornerCount << std::endl;
│ │ │ │ -
97
│ │ │ │ -
98 for (size_t i=0; i<faces.size(); i++) {
│ │ │ │ -
99
│ │ │ │ -
100 fgrid << faces[i].size();
│ │ │ │ -
101
│ │ │ │ -
102 // vtk expects the vertices to by cyclically ordered
│ │ │ │ -
103 // therefore unfortunately we have to deal with several element types on a case-by-case basis
│ │ │ │ -
104 if (geometryTypes[i].isSimplex()) {
│ │ │ │ -
105 for (int j=0; j<patchDim+1; j++)
│ │ │ │ -
106 fgrid << " " << faces[i][j];
│ │ │ │ -
107
│ │ │ │ -
108 } else if (geometryTypes[i].isQuadrilateral()) {
│ │ │ │ -
109 fgrid << " " << faces[i][0] << " " << faces[i][1]
│ │ │ │ -
110 << " " << faces[i][3] << " " << faces[i][2];
│ │ │ │ -
111
│ │ │ │ -
112 } else if (geometryTypes[i].isPyramid()) {
│ │ │ │ -
113 fgrid << " " << faces[i][0] << " " << faces[i][1]
│ │ │ │ -
114 << " " << faces[i][3] << " " << faces[i][2] << " " << faces[i][4];
│ │ │ │ -
115
│ │ │ │ -
116 } else if (geometryTypes[i].isPrism()) {
│ │ │ │ -
117 fgrid << " " << faces[i][0] << " " << faces[i][2] << " " << faces[i][1]
│ │ │ │ -
118 << " " << faces[i][3] << " " << faces[i][5] << " " << faces[i][4];
│ │ │ │ -
119
│ │ │ │ -
120 } else if (geometryTypes[i].isHexahedron()) {
│ │ │ │ -
121 fgrid << " " << faces[i][0] << " " << faces[i][1]
│ │ │ │ -
122 << " " << faces[i][3] << " " << faces[i][2]
│ │ │ │ -
123 << " " << faces[i][4] << " " << faces[i][5]
│ │ │ │ -
124 << " " << faces[i][7] << " " << faces[i][6];
│ │ │ │ -
125
│ │ │ │ -
126 } else {
│ │ │ │ -
127 DUNE_THROW(Dune::NotImplemented, "Geometry type " << geometryTypes[i] << " not supported yet");
│ │ │ │ -
128 }
│ │ │ │ -
129
│ │ │ │ -
130 fgrid << std::endl;
│ │ │ │ -
131 }
│ │ │ │ -
132
│ │ │ │ -
133 fgrid << std::endl;
│ │ │ │ -
134
│ │ │ │ -
135 // 3d VTK files need an extra section specifying the CELL_TYPES aka GeometryTypes
│ │ │ │ -
136 if (patchDim==3) {
│ │ │ │ -
137
│ │ │ │ -
138 fgrid << "CELL_TYPES " << geometryTypes.size() << std::endl;
│ │ │ │ -
139
│ │ │ │ -
140 for (size_t i=0; i<geometryTypes.size(); i++) {
│ │ │ │ -
141 if (geometryTypes[i].isSimplex())
│ │ │ │ -
142 fgrid << "10" << std::endl;
│ │ │ │ -
143 else if (geometryTypes[i].isHexahedron())
│ │ │ │ -
144 fgrid << "12" << std::endl;
│ │ │ │ -
145 else if (geometryTypes[i].isPrism())
│ │ │ │ -
146 fgrid << "13" << std::endl;
│ │ │ │ -
147 else if (geometryTypes[i].isPyramid())
│ │ │ │ -
148 fgrid << "14" << std::endl;
│ │ │ │ -
149 else
│ │ │ │ -
150 DUNE_THROW(Dune::NotImplemented, "Geometry type " << geometryTypes[i] << " not supported yet");
│ │ │ │ -
151
│ │ │ │ -
152 }
│ │ │ │ -
153
│ │ │ │ -
154 }
│ │ │ │ -
155
│ │ │ │ -
156#if 0
│ │ │ │ -
157 // WRITE CELL DATA
│ │ │ │ -
158 // ---------------
│ │ │ │ -
159 ctype accum = 0.0, delta = 1.0 / (ctype) (gridSubEntityData.size()-1);
│ │ │ │ -
160
│ │ │ │ -
161 fgrid << "CELL_DATA " << gridSubEntityData.size() << std::endl;
│ │ │ │ -
162 fgrid << "SCALARS property_coding " << Dune::className<ctype>() << " 1" << std::endl;
│ │ │ │ -
163 fgrid << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ -
164
│ │ │ │ -
165 for (typename GridSubEntityData::const_iterator sEIt = gridSubEntityData.begin();
│ │ │ │ -
166 sEIt != gridSubEntityData.end();
│ │ │ │ -
167 ++sEIt, accum += delta)
│ │ │ │ -
168 {
│ │ │ │ -
169 // "encode" the parent with one color...
│ │ │ │ -
170 fgrid << accum << std::endl;
│ │ │ │ -
171 }
│ │ │ │ -
172#endif
│ │ │ │ -
173 fgrid.close();
│ │ │ │ -
174 }
│ │ │ │ -
175
│ │ │ │ -
176
│ │ │ │ -
180 template <class Glue, int side>
│ │ │ │ -
181 static void writeIntersections(const Glue& glue, const std::string& filename)
│ │ │ │ -
182 {
│ │ │ │ -
183 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
│ │ │ │ -
184
│ │ │ │ -
185 std::ofstream fmerged;
│ │ │ │ -
186
│ │ │ │ -
187 fmerged.open(filename.c_str());
│ │ │ │ -
188
│ │ │ │ -
189 using GridView = typename Glue::template GridView<side>;
│ │ │ │ -
190 typedef typename GridView::ctype ctype;
│ │ │ │ -
191
│ │ │ │ -
192 const int domdimw = GridView::dimensionworld;
│ │ │ │ -
193 const int intersectionDim = Glue::Intersection::mydim;
│ │ │ │ -
194
│ │ │ │ -
195 // coordinates have to be in R^3 in the VTK format
│ │ │ │ -
196 std::string coordinatePadding;
│ │ │ │ -
197 for (int i=domdimw; i<3; i++)
│ │ │ │ -
198 coordinatePadding += " 0";
│ │ │ │ -
199
│ │ │ │ -
200 int overlaps = glue.size();
│ │ │ │ -
201
│ │ │ │ -
202 // WRITE POINTS
│ │ │ │ -
203 // ----------------
│ │ │ │ -
204 using Extractor = typename Glue::template GridPatch<0>;
│ │ │ │ -
205 std::vector<typename Extractor::Coords> coords;
│ │ │ │ -
206 glue.template patch<side>().getCoords(coords);
│ │ │ │ -
207
│ │ │ │ -
208 // the merged grid (i.e. the set of remote intersections
│ │ │ │ -
209 fmerged << "# vtk DataFile Version 2.0\nFilename: " << filename << "\nASCII" << std::endl;
│ │ │ │ -
210 fmerged << ((intersectionDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET POLYDATA") << std::endl;
│ │ │ │ -
211 fmerged << "POINTS " << overlaps*(intersectionDim+1) << " " << Dune::className<ctype>() << std::endl;
│ │ │ │ -
212
│ │ │ │ -
213 for (const auto& intersection : intersections(glue, Reverse<side == 1>{}))
│ │ │ │ -
214 {
│ │ │ │ -
215 const auto& geometry = intersection.geometry();
│ │ │ │ -
216 for (int i = 0; i < geometry.corners(); ++i)
│ │ │ │ -
217 fmerged << geometry.corner(i) << coordinatePadding << std::endl;
│ │ │ │ -
218 }
│ │ │ │ -
219
│ │ │ │ -
220 // WRITE POLYGONS
│ │ │ │ -
221 // ----------------
│ │ │ │ -
222
│ │ │ │ -
223 std::vector<typename Extractor::VertexVector> faces;
│ │ │ │ -
224 std::vector<Dune::GeometryType> geometryTypes;
│ │ │ │ -
225 glue.template patch<side>().getFaces(faces);
│ │ │ │ -
226 glue.template patch<side>().getGeometryTypes(geometryTypes);
│ │ │ │ -
227
│ │ │ │ -
228 unsigned int faceCornerCount = 0;
│ │ │ │ -
229 for (size_t i=0; i<faces.size(); i++)
│ │ │ │ -
230 faceCornerCount += faces[i].size();
│ │ │ │ -
231
│ │ │ │ -
232 int grid0SimplexCorners = intersectionDim+1;
│ │ │ │ -
233 fmerged << ((intersectionDim==3) ? "CELLS " : "POLYGONS ")
│ │ │ │ -
234 << overlaps << " " << (grid0SimplexCorners+1)*overlaps << std::endl;
│ │ │ │ -
235
│ │ │ │ -
236 for (int i = 0; i < overlaps; ++i) {
│ │ │ │ -
237 fmerged << grid0SimplexCorners;
│ │ │ │ -
238 for (int j=0; j<grid0SimplexCorners; j++)
│ │ │ │ -
239 fmerged << " " << grid0SimplexCorners*i+j;
│ │ │ │ -
240 fmerged << std::endl;
│ │ │ │ -
241 }
│ │ │ │ -
242
│ │ │ │ -
243 // 3d VTK files need an extra section specifying the CELL_TYPES aka GeometryTypes
│ │ │ │ -
244 if (intersectionDim==3) {
│ │ │ │ -
245
│ │ │ │ -
246 fmerged << "CELL_TYPES " << overlaps << std::endl;
│ │ │ │ -
247
│ │ │ │ -
248 for (int i = 0; i < overlaps; i++)
│ │ │ │ -
249 fmerged << "10" << std::endl;
│ │ │ │ -
250
│ │ │ │ -
251 }
│ │ │ │ -
252
│ │ │ │ -
253#if 0
│ │ │ │ -
254 // WRITE CELL DATA
│ │ │ │ -
255 // ---------------
│ │ │ │ -
256 ctype accum = 0.0, delta = 1.0 / (ctype) (gridSubEntityData.size()-1);
│ │ │ │ -
257
│ │ │ │ -
258 fmerged << "CELL_DATA " << overlaps << std::endl;
│ │ │ │ -
259 fmerged << "SCALARS property_coding " << Dune::className<ctype>() << " 1" << std::endl;
│ │ │ │ -
260 fmerged << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ -
261
│ │ │ │ -
262 for (typename GridSubEntityData::const_iterator sEIt = gridSubEntityData.begin();
│ │ │ │ -
263 sEIt != gridSubEntityData.end();
│ │ │ │ -
264 ++sEIt, accum += delta)
│ │ │ │ -
265 {
│ │ │ │ -
266 // ...and mark all of its merged grid parts with the same color
│ │ │ │ -
267 for (int j = 0; j < sEIt->first.second; ++j)
│ │ │ │ -
268 fmerged << accum << std::endl;
│ │ │ │ -
269 }
│ │ │ │ -
270#endif
│ │ │ │ -
271 fmerged.close();
│ │ │ │ -
272 }
│ │ │ │ -
273
│ │ │ │ -
274public:
│ │ │ │ -
275 template<typename Glue>
│ │ │ │ -
│ │ │ │ -
276 static void write(const Glue& glue, const std::string& filenameTrunk)
│ │ │ │ -
277 {
│ │ │ │ -
278
│ │ │ │ -
279 // Write extracted grid and remote intersection on the grid0-side
│ │ │ │ -
280 writeExtractedPart<Glue,0>(glue,
│ │ │ │ -
281 filenameTrunk + "-grid0.vtk");
│ │ │ │ -
282
│ │ │ │ -
283 writeIntersections<Glue,0>(glue,
│ │ │ │ -
284 filenameTrunk + "-intersections-grid0.vtk");
│ │ │ │ -
285
│ │ │ │ -
286 // Write extracted grid and remote intersection on the grid1-side
│ │ │ │ -
287 writeExtractedPart<Glue,1>(glue,
│ │ │ │ -
288 filenameTrunk + "-grid1.vtk");
│ │ │ │ -
289
│ │ │ │ -
290 writeIntersections<Glue,1>(glue,
│ │ │ │ -
291 filenameTrunk + "-intersections-grid1.vtk");
│ │ │ │ -
292
│ │ │ │ -
293 }
│ │ │ │ -
│ │ │ │ -
294
│ │ │ │ -
295};
│ │ │ │ -
│ │ │ │ -
296
│ │ │ │ -
297} /* namespace GridGlue */
│ │ │ │ -
298} /* namespace Dune */
│ │ │ │ -
299
│ │ │ │ -
300#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH
│ │ │ │ +
12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │ +
13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │ +
14
│ │ │ │ + │ │ │ │ +
16
│ │ │ │ +
17namespace Dune {
│ │ │ │ +
18 namespace GridGlue {
│ │ │ │ +
19
│ │ │ │ +
21 template<typename P0, typename P1, int inside, int outside>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
23 public Dune::ForwardIteratorFacade< IntersectionIterator<P0,P1,inside,outside>,
│ │ │ │ +
24 const Intersection<P0,P1,inside,outside> >
│ │ │ │ +
25 {
│ │ │ │ +
26 public:
│ │ │ │ +
27
│ │ │ │ +
28 typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
│ │ │ │ +
29 typedef ::Dune::GridGlue::Intersection<P0,P1,inside,outside> Intersection;
│ │ │ │ +
30
│ │ │ │ +
│ │ │ │ +
31 IntersectionIterator(const GridGlue * glue, unsigned int i)
│ │ │ │ +
32 : glue_(glue),
│ │ │ │ +
33 index_(i),
│ │ │ │ +
34 intersection_(glue_, & glue_->intersections_[index_])
│ │ │ │ +
35 {}
│ │ │ │ +
│ │ │ │ +
36
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
38 {
│ │ │ │ +
39 assert(("never dereference the end iterator" &&
│ │ │ │ +
40 index_ != glue_->index__sz));
│ │ │ │ +
41 return intersection_;
│ │ │ │ +
42 }
│ │ │ │ +
│ │ │ │ +
43
│ │ │ │ +
│ │ │ │ +
44 void increment()
│ │ │ │ +
45 {
│ │ │ │ +
46 intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);
│ │ │ │ +
47 }
│ │ │ │ +
│ │ │ │ +
48
│ │ │ │ +
│ │ │ │ +
49 bool equals(const IntersectionIterator& iter) const
│ │ │ │ +
50 {
│ │ │ │ +
51 return iter.index_ == index_;
│ │ │ │ +
52 }
│ │ │ │ +
│ │ │ │ +
53
│ │ │ │ +
54 private:
│ │ │ │ +
55
│ │ │ │ +
56 const GridGlue* glue_;
│ │ │ │ +
57 unsigned int index_;
│ │ │ │ +
58
│ │ │ │ +
59 Intersection intersection_;
│ │ │ │ +
60 };
│ │ │ │ +
│ │ │ │ +
61
│ │ │ │ +
62 } // end namespace GridGlue
│ │ │ │ +
63} // end namespace Dune
│ │ │ │ +
64
│ │ │ │ +
65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │
Central component of the module implementing the coupling of two grids.
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ -
Write remote intersections to a vtk file for debugging purposes.
Definition gridgluevtkwriter.hh:41
│ │ │ │ -
static void write(const Glue &glue, const std::string &filenameTrunk)
Definition gridgluevtkwriter.hh:276
│ │ │ │ -
Definition rangegenerators.hh:17
│ │ │ │ -
Provides codimension-independent methods for grid extraction.
Definition extractor.hh:46
│ │ │ │ -
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │ -
void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) const
getter for the coordinates array
Definition extractor.hh:275
│ │ │ │ -
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │ +
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │ + │ │ │ │ +
Definition intersectioniterator.hh:25
│ │ │ │ +
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition intersectioniterator.hh:28
│ │ │ │ +
const Intersection & dereference() const
Definition intersectioniterator.hh:37
│ │ │ │ +
void increment()
Definition intersectioniterator.hh:44
│ │ │ │ +
::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection
Definition intersectioniterator.hh:29
│ │ │ │ +
IntersectionIterator(const GridGlue *glue, unsigned int i)
Definition intersectioniterator.hh:31
│ │ │ │ +
bool equals(const IntersectionIterator &iter) const
Definition intersectioniterator.hh:49
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,349 +1,99 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -gridgluevtkwriter.hh │ │ │ │ │ +intersectioniterator.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -5/* │ │ │ │ │ -6 * Filename: GridGlueVtkWriter.hh │ │ │ │ │ -7 * Version: 1.0 │ │ │ │ │ -8 * Created on: Mar 5, 2009 │ │ │ │ │ -9 * Author: Gerrit Buse │ │ │ │ │ -10 * --------------------------------- │ │ │ │ │ -11 * Project: dune-grid-glue │ │ │ │ │ -12 * Description: Class thought to make graphical debugging of couplings │ │ │ │ │ -easier. │ │ │ │ │ -13 * │ │ │ │ │ -14 */ │ │ │ │ │ -20#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH │ │ │ │ │ -21#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH │ │ │ │ │ -22 │ │ │ │ │ -23 │ │ │ │ │ -24#include │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27#include │ │ │ │ │ -28 │ │ │ │ │ -29#include │ │ │ │ │ -30#include │ │ │ │ │ -31#include │ │ │ │ │ -32 │ │ │ │ │ -33#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ -34 │ │ │ │ │ -35namespace _D_u_n_e { │ │ │ │ │ -36namespace GridGlue { │ │ │ │ │ -37 │ │ │ │ │ -_4_0class _G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r │ │ │ │ │ -41{ │ │ │ │ │ -42 │ │ │ │ │ -46 template │ │ │ │ │ -47 static void writeExtractedPart(const Glue& glue, const std::string& │ │ │ │ │ -filename) │ │ │ │ │ -48 { │ │ │ │ │ -49 static_assert((side==0 || side==1), "'side' can only be 0 or 1"); │ │ │ │ │ -50 │ │ │ │ │ -51 std::ofstream fgrid; │ │ │ │ │ -52 │ │ │ │ │ -53 fgrid.open(filename.c_str()); │ │ │ │ │ -54 │ │ │ │ │ -55 using GridView = typename Glue::template GridView; │ │ │ │ │ -56 using _E_x_t_r_a_c_t_o_r = typename Glue::template GridPatch; │ │ │ │ │ -57 │ │ │ │ │ -58 typedef typename GridView::ctype ctype; │ │ │ │ │ -59 │ │ │ │ │ -60 const int domdimw = GridView::dimensionworld; │ │ │ │ │ -61 const int patchDim = _E_x_t_r_a_c_t_o_r_:_:_d_i_m - _E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m; │ │ │ │ │ -62 │ │ │ │ │ -63 // coordinates have to be in R^3 in the VTK format │ │ │ │ │ -64 std::string coordinatePadding; │ │ │ │ │ -65 for (int i=domdimw; i<3; i++) │ │ │ │ │ -66 coordinatePadding += " 0"; │ │ │ │ │ -67 │ │ │ │ │ -68 fgrid << "# vtk DataFile Version 2.0\nFilename: " << filename << "\nASCII" │ │ │ │ │ -<< std::endl; │ │ │ │ │ -69 │ │ │ │ │ -70 // WRITE POINTS │ │ │ │ │ -71 // ---------------- │ │ │ │ │ -72 std::vector coords; │ │ │ │ │ -73 glue.template patch()._g_e_t_C_o_o_r_d_s(coords); │ │ │ │ │ -74 │ │ │ │ │ -75 fgrid << ((patchDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET POLYDATA") │ │ │ │ │ -<< std::endl; │ │ │ │ │ -76 fgrid << "POINTS " << coords.size() << " " << Dune::className() << │ │ │ │ │ -std::endl; │ │ │ │ │ -77 │ │ │ │ │ -78 for (size_t i=0; i faces; │ │ │ │ │ -87 std::vector geometryTypes; │ │ │ │ │ -88 glue.template patch().getFaces(faces); │ │ │ │ │ -89 glue.template patch().getGeometryTypes(geometryTypes); │ │ │ │ │ -90 │ │ │ │ │ -91 unsigned int faceCornerCount = 0; │ │ │ │ │ -92 for (size_t i=0; i() << " 1" << │ │ │ │ │ -std::endl; │ │ │ │ │ -163 fgrid << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ -164 │ │ │ │ │ -165 for (typename GridSubEntityData::const_iterator sEIt = │ │ │ │ │ -gridSubEntityData.begin(); │ │ │ │ │ -166 sEIt != gridSubEntityData.end(); │ │ │ │ │ -167 ++sEIt, accum += delta) │ │ │ │ │ -168 { │ │ │ │ │ -169 // "encode" the parent with one color... │ │ │ │ │ -170 fgrid << accum << std::endl; │ │ │ │ │ -171 } │ │ │ │ │ -172#endif │ │ │ │ │ -173 fgrid.close(); │ │ │ │ │ -174 } │ │ │ │ │ -175 │ │ │ │ │ -176 │ │ │ │ │ -180 template │ │ │ │ │ -181 static void writeIntersections(const Glue& glue, const std::string& │ │ │ │ │ -filename) │ │ │ │ │ -182 { │ │ │ │ │ -183 static_assert((side==0 || side==1), "'side' can only be 0 or 1"); │ │ │ │ │ -184 │ │ │ │ │ -185 std::ofstream fmerged; │ │ │ │ │ -186 │ │ │ │ │ -187 fmerged.open(filename.c_str()); │ │ │ │ │ -188 │ │ │ │ │ -189 using GridView = typename Glue::template GridView; │ │ │ │ │ -190 typedef typename GridView::ctype ctype; │ │ │ │ │ -191 │ │ │ │ │ -192 const int domdimw = GridView::dimensionworld; │ │ │ │ │ -193 const int intersectionDim = Glue::Intersection::mydim; │ │ │ │ │ -194 │ │ │ │ │ -195 // coordinates have to be in R^3 in the VTK format │ │ │ │ │ -196 std::string coordinatePadding; │ │ │ │ │ -197 for (int i=domdimw; i<3; i++) │ │ │ │ │ -198 coordinatePadding += " 0"; │ │ │ │ │ -199 │ │ │ │ │ -200 int overlaps = glue.size(); │ │ │ │ │ -201 │ │ │ │ │ -202 // WRITE POINTS │ │ │ │ │ -203 // ---------------- │ │ │ │ │ -204 using _E_x_t_r_a_c_t_o_r = typename Glue::template GridPatch<0>; │ │ │ │ │ -205 std::vector coords; │ │ │ │ │ -206 glue.template patch()._g_e_t_C_o_o_r_d_s(coords); │ │ │ │ │ -207 │ │ │ │ │ -208 // the merged grid (i.e. the set of remote intersections │ │ │ │ │ -209 fmerged << "# vtk DataFile Version 2.0\nFilename: " << filename << │ │ │ │ │ -"\nASCII" << std::endl; │ │ │ │ │ -210 fmerged << ((intersectionDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET │ │ │ │ │ -POLYDATA") << std::endl; │ │ │ │ │ -211 fmerged << "POINTS " << overlaps*(intersectionDim+1) << " " << Dune:: │ │ │ │ │ -className() << std::endl; │ │ │ │ │ -212 │ │ │ │ │ -213 for (const auto& intersection : _i_n_t_e_r_s_e_c_t_i_o_n_s(glue, _R_e_v_e_r_s_e_<_s_i_d_e_ _=_=_ _1_>{})) │ │ │ │ │ -214 { │ │ │ │ │ -215 const auto& geometry = intersection.geometry(); │ │ │ │ │ -216 for (int i = 0; i < geometry.corners(); ++i) │ │ │ │ │ -217 fmerged << geometry.corner(i) << coordinatePadding << std::endl; │ │ │ │ │ -218 } │ │ │ │ │ -219 │ │ │ │ │ -220 // WRITE POLYGONS │ │ │ │ │ -221 // ---------------- │ │ │ │ │ -222 │ │ │ │ │ -223 std::vector faces; │ │ │ │ │ -224 std::vector geometryTypes; │ │ │ │ │ -225 glue.template patch().getFaces(faces); │ │ │ │ │ -226 glue.template patch().getGeometryTypes(geometryTypes); │ │ │ │ │ -227 │ │ │ │ │ -228 unsigned int faceCornerCount = 0; │ │ │ │ │ -229 for (size_t i=0; i() << " 1" │ │ │ │ │ -<< std::endl; │ │ │ │ │ -260 fmerged << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ -261 │ │ │ │ │ -262 for (typename GridSubEntityData::const_iterator sEIt = │ │ │ │ │ -gridSubEntityData.begin(); │ │ │ │ │ -263 sEIt != gridSubEntityData.end(); │ │ │ │ │ -264 ++sEIt, accum += delta) │ │ │ │ │ -265 { │ │ │ │ │ -266 // ...and mark all of its merged grid parts with the same color │ │ │ │ │ -267 for (int j = 0; j < sEIt->first.second; ++j) │ │ │ │ │ -268 fmerged << accum << std::endl; │ │ │ │ │ -269 } │ │ │ │ │ -270#endif │ │ │ │ │ -271 fmerged.close(); │ │ │ │ │ -272 } │ │ │ │ │ -273 │ │ │ │ │ -274public: │ │ │ │ │ -275 template │ │ │ │ │ -_2_7_6 static void _w_r_i_t_e(const Glue& glue, const std::string& filenameTrunk) │ │ │ │ │ -277 { │ │ │ │ │ -278 │ │ │ │ │ -279 // Write extracted grid and remote intersection on the grid0-side │ │ │ │ │ -280 writeExtractedPart(glue, │ │ │ │ │ -281 filenameTrunk + "-grid0.vtk"); │ │ │ │ │ -282 │ │ │ │ │ -283 writeIntersections(glue, │ │ │ │ │ -284 filenameTrunk + "-intersections-grid0.vtk"); │ │ │ │ │ -285 │ │ │ │ │ -286 // Write extracted grid and remote intersection on the grid1-side │ │ │ │ │ -287 writeExtractedPart(glue, │ │ │ │ │ -288 filenameTrunk + "-grid1.vtk"); │ │ │ │ │ -289 │ │ │ │ │ -290 writeIntersections(glue, │ │ │ │ │ -291 filenameTrunk + "-intersections-grid1.vtk"); │ │ │ │ │ -292 │ │ │ │ │ -293 } │ │ │ │ │ -294 │ │ │ │ │ -295}; │ │ │ │ │ -296 │ │ │ │ │ -297} /* namespace GridGlue */ │ │ │ │ │ -298} /* namespace Dune */ │ │ │ │ │ -299 │ │ │ │ │ -300#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH │ │ │ │ │ +12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ +13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ +14 │ │ │ │ │ +15#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ +16 │ │ │ │ │ +17namespace _D_u_n_e { │ │ │ │ │ +18 namespace GridGlue { │ │ │ │ │ +19 │ │ │ │ │ +21 template │ │ │ │ │ +_2_2 class _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r : │ │ │ │ │ +23 public Dune::ForwardIteratorFacade< │ │ │ │ │ +IntersectionIterator, │ │ │ │ │ +24 const Intersection > │ │ │ │ │ +25 { │ │ │ │ │ +26 public: │ │ │ │ │ +27 │ │ │ │ │ +_2_8 typedef ::Dune::GridGlue::GridGlue _G_r_i_d_G_l_u_e; │ │ │ │ │ +_2_9 typedef ::Dune::GridGlue::Intersection _I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ +30 │ │ │ │ │ +_3_1 _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r(const _G_r_i_d_G_l_u_e * glue, unsigned int i) │ │ │ │ │ +32 : glue_(glue), │ │ │ │ │ +33 index_(i), │ │ │ │ │ +34 intersection_(glue_, & glue_->intersections_[index_]) │ │ │ │ │ +35 {} │ │ │ │ │ +36 │ │ │ │ │ +_3_7 const _I_n_t_e_r_s_e_c_t_i_o_n& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ +38 { │ │ │ │ │ +39 assert(("never dereference the end iterator" && │ │ │ │ │ +40 index_ != glue_->index__sz)); │ │ │ │ │ +41 return intersection_; │ │ │ │ │ +42 } │ │ │ │ │ +43 │ │ │ │ │ +_4_4 void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ +45 { │ │ │ │ │ +46 intersection_ = _I_n_t_e_r_s_e_c_t_i_o_n(glue_, & glue_->intersections_[++index_]); │ │ │ │ │ +47 } │ │ │ │ │ +48 │ │ │ │ │ +_4_9 bool _e_q_u_a_l_s(const _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r& iter) const │ │ │ │ │ +50 { │ │ │ │ │ +51 return iter.index_ == index_; │ │ │ │ │ +52 } │ │ │ │ │ +53 │ │ │ │ │ +54 private: │ │ │ │ │ +55 │ │ │ │ │ +56 const _G_r_i_d_G_l_u_e* glue_; │ │ │ │ │ +57 unsigned int index_; │ │ │ │ │ +58 │ │ │ │ │ +59 _I_n_t_e_r_s_e_c_t_i_o_n intersection_; │ │ │ │ │ +60 }; │ │ │ │ │ +61 │ │ │ │ │ +62 } // end namespace GridGlue │ │ │ │ │ +63} // end namespace Dune │ │ │ │ │ +64 │ │ │ │ │ +65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ _g_r_i_d_g_l_u_e_._h_h │ │ │ │ │ Central component of the module implementing the coupling of two grids. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ -IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ -> &reverse=!reversed) │ │ │ │ │ -Iterate over all intersections of a GridGlue. │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r │ │ │ │ │ -Write remote intersections to a vtk file for debugging purposes. │ │ │ │ │ -DDeeffiinniittiioonn gridgluevtkwriter.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r_:_:_w_r_i_t_e │ │ │ │ │ -static void write(const Glue &glue, const std::string &filenameTrunk) │ │ │ │ │ -DDeeffiinniittiioonn gridgluevtkwriter.hh:276 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e │ │ │ │ │ -DDeeffiinniittiioonn rangegenerators.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ -Provides codimension-independent methods for grid extraction. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m │ │ │ │ │ -static constexpr auto codim │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_C_o_o_r_d_s │ │ │ │ │ -void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) │ │ │ │ │ -const │ │ │ │ │ -getter for the coordinates array │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m │ │ │ │ │ -static constexpr auto dim │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ +sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ +DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_<_ _P_0_,_ _P_1_,_ _i_n_s_i_d_e_,_ _o_u_t_s_i_d_e_ _> │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn intersectioniterator.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ +::Dune::GridGlue::GridGlue< P0, P1 > GridGlue │ │ │ │ │ +DDeeffiinniittiioonn intersectioniterator.hh:28 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ +const Intersection & dereference() const │ │ │ │ │ +DDeeffiinniittiioonn intersectioniterator.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ +void increment() │ │ │ │ │ +DDeeffiinniittiioonn intersectioniterator.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection │ │ │ │ │ +DDeeffiinniittiioonn intersectioniterator.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ +IntersectionIterator(const GridGlue *glue, unsigned int i) │ │ │ │ │ +DDeeffiinniittiioonn intersectioniterator.hh:31 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ +bool equals(const IntersectionIterator &iter) const │ │ │ │ │ +DDeeffiinniittiioonn intersectioniterator.hh:49 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectioniterator.hh File Reference │ │ │ │ +dune-grid-glue: gridgluecommunicate.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,39 +71,73 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
intersectioniterator.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Typedefs | │ │ │ │ +Functions
│ │ │ │ +
gridgluecommunicate.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

Implement iterators over GridGlue intersections. │ │ │ │ +

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

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

Go to the source code of this file.

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

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Typedefs

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

│ │ │ │ +Functions

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

Detailed Description

│ │ │ │ -

Implement iterators over GridGlue intersections.

│ │ │ │ +

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

│ │ │ │
Author
Christian Engwer
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,26 +1,61 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -intersectioniterator.hh File Reference │ │ │ │ │ -Implement iterators over GridGlue intersections. _M_o_r_e_._._. │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +gridgluecommunicate.hh File Reference │ │ │ │ │ +Describes the parallel communication interface class for _D_u_n_e_:_:_G_r_i_d_G_l_u_e. │ │ │ │ │ +_M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_<_ _P_0_,_ _P_1_,_ _i_n_s_i_d_e_,_ _o_u_t_s_i_d_e_ _> │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ +  describes the features of a data handle for communication in parallel │ │ │ │ │ + runs using the _G_r_i_d_G_l_u_e_:_:_c_o_m_m_u_n_i_c_a_t_e methods. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_<_ _D_T_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_<_ _d_i_r_ _> │ │ │ │ │ +  forward gather scatter to user defined _C_o_m_m_I_n_f_o class _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ +  collects all _G_r_i_d_G_l_u_e data requried for communication _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_, │ │ │ │ │ + _D_a_t_a_T_y_p_e_I_m_p_ _>_ _> │ │ │ │ │ +  specialization of the CommPolicy struct, required for the │ │ │ │ │ + ParallelIndexsets _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ +TTyyppeeddeeffss │ │ │ │ │ + typedef std::pair< int, int >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_a_n_k_P_a_i_r │ │ │ │ │ +  │ │ │ │ │ +typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r< Dune:: │ │ │ │ │ + ForwardCommunication >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_F_o_r_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ +  │ │ │ │ │ +typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r< Dune:: │ │ │ │ │ + BackwardCommunication >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +std::ostream &  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _G_l_o_b_a_l_I_d │ │ │ │ │ + &id) │ │ │ │ │ +  │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implement iterators over GridGlue intersections. │ │ │ │ │ +Describes the parallel communication interface class for _D_u_n_e_:_:_G_r_i_d_G_l_u_e. │ │ │ │ │ Author │ │ │ │ │ Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectioniterator.hh Source File │ │ │ │ +dune-grid-glue: gridgluecommunicate.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,95 +74,365 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
intersectioniterator.hh
│ │ │ │ +
gridgluecommunicate.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │ -
13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │ +
5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
│ │ │ │ +
6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
│ │ │ │ +
7
│ │ │ │ +
13#include <type_traits>
│ │ │ │
14
│ │ │ │ - │ │ │ │ -
16
│ │ │ │ -
17namespace Dune {
│ │ │ │ -
18 namespace GridGlue {
│ │ │ │ +
15#include <dune/common/bartonnackmanifcheck.hh>
│ │ │ │ +
16#include <dune/common/parallel/communicator.hh>
│ │ │ │ +
17#include <dune/grid/common/datahandleif.hh>
│ │ │ │ +
18#include <dune/grid/common/gridenums.hh>
│ │ │ │
19
│ │ │ │ -
21 template<typename P0, typename P1, int inside, int outside>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
23 public Dune::ForwardIteratorFacade< IntersectionIterator<P0,P1,inside,outside>,
│ │ │ │ -
24 const Intersection<P0,P1,inside,outside> >
│ │ │ │ -
25 {
│ │ │ │ -
26 public:
│ │ │ │ -
27
│ │ │ │ -
28 typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
│ │ │ │ -
29 typedef ::Dune::GridGlue::Intersection<P0,P1,inside,outside> Intersection;
│ │ │ │ -
30
│ │ │ │ -
│ │ │ │ -
31 IntersectionIterator(const GridGlue * glue, unsigned int i)
│ │ │ │ -
32 : glue_(glue),
│ │ │ │ -
33 index_(i),
│ │ │ │ -
34 intersection_(glue_, & glue_->intersections_[index_])
│ │ │ │ -
35 {}
│ │ │ │ -
│ │ │ │ -
36
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
38 {
│ │ │ │ -
39 assert(("never dereference the end iterator" &&
│ │ │ │ -
40 index_ != glue_->index__sz));
│ │ │ │ -
41 return intersection_;
│ │ │ │ +
20
│ │ │ │ +
21namespace Dune {
│ │ │ │ +
22 namespace GridGlue {
│ │ │ │ +
23
│ │ │ │ +
24 typedef std::pair<int, int> RankPair;
│ │ │ │ +
│ │ │ │ +
25 struct GlobalId : public std::pair<RankPair, unsigned int>
│ │ │ │ +
26 {
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
31 this->first.first = 0;
│ │ │ │ +
32 this->first.second = 0;
│ │ │ │ +
33 this->second = 0;
│ │ │ │ +
34 }
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
38 GlobalId(int i) {
│ │ │ │ +
39 this->first.first = i;
│ │ │ │ +
40 this->first.second = i;
│ │ │ │ +
41 this->second = 0;
│ │ │ │
42 }
│ │ │ │
│ │ │ │ -
43
│ │ │ │ -
│ │ │ │ -
44 void increment()
│ │ │ │ -
45 {
│ │ │ │ -
46 intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);
│ │ │ │ -
47 }
│ │ │ │ -
│ │ │ │ -
48
│ │ │ │ -
│ │ │ │ -
49 bool equals(const IntersectionIterator& iter) const
│ │ │ │ -
50 {
│ │ │ │ -
51 return iter.index_ == index_;
│ │ │ │ +
│ │ │ │ +
48 GlobalId(int i, int j, unsigned int n) {
│ │ │ │ +
49 this->first.first = std::min(i,j);
│ │ │ │ +
50 this->first.second = std::max(i,j);
│ │ │ │ +
51 this->second = n;
│ │ │ │
52 }
│ │ │ │
│ │ │ │ -
53
│ │ │ │ -
54 private:
│ │ │ │ -
55
│ │ │ │ -
56 const GridGlue* glue_;
│ │ │ │ -
57 unsigned int index_;
│ │ │ │ -
58
│ │ │ │ -
59 Intersection intersection_;
│ │ │ │ -
60 };
│ │ │ │ -
│ │ │ │ -
61
│ │ │ │ -
62 } // end namespace GridGlue
│ │ │ │ -
63} // end namespace Dune
│ │ │ │ -
64
│ │ │ │ -
65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │ -
Central component of the module implementing the coupling of two grids.
│ │ │ │ +
53 };
│ │ │ │ +
│ │ │ │ +
54
│ │ │ │ +
│ │ │ │ +
55 inline std::ostream& operator<<(std::ostream& os, const GlobalId & id)
│ │ │ │ +
56 {
│ │ │ │ +
57 os << "("
│ │ │ │ +
58 << id.first.first << "," << id.first.second << ","
│ │ │ │ +
59 << id.second << ")";
│ │ │ │ +
60 return os;
│ │ │ │ +
61 }
│ │ │ │ +
│ │ │ │ +
62
│ │ │ │ +
75 template <class DataHandleImp, class DataTypeImp>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
77 {
│ │ │ │ +
78 public:
│ │ │ │ +
80 typedef DataTypeImp DataType;
│ │ │ │ +
81
│ │ │ │ +
82 protected:
│ │ │ │ +
83 // one should not create an explicit instance of this inteface object
│ │ │ │ + │ │ │ │ +
85
│ │ │ │ +
86 public:
│ │ │ │ +
87
│ │ │ │ +
91 template<class RISType>
│ │ │ │ +
│ │ │ │ +
92 size_t size (RISType& i) const
│ │ │ │ +
93 {
│ │ │ │ +
94 CHECK_INTERFACE_IMPLEMENTATION((asImp().size(i)));
│ │ │ │ +
95 return asImp().size(i);
│ │ │ │ +
96 }
│ │ │ │ +
│ │ │ │ +
97
│ │ │ │ +
103 template<class MessageBufferImp, class EntityType, class RISType>
│ │ │ │ +
│ │ │ │ +
104 void gather (MessageBufferImp& buff, const EntityType& e, const RISType & i) const
│ │ │ │ +
105 {
│ │ │ │ +
106 MessageBufferIF<MessageBufferImp> buffIF(buff);
│ │ │ │ +
107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().gather(buffIF,e,i)));
│ │ │ │ +
108 }
│ │ │ │ +
│ │ │ │ +
109
│ │ │ │ +
117 template<class MessageBufferImp, class EntityType, class RISType>
│ │ │ │ +
│ │ │ │ +
118 void scatter (MessageBufferImp& buff, const EntityType& e, const RISType & i, size_t n)
│ │ │ │ +
119 {
│ │ │ │ +
120 MessageBufferIF<MessageBufferImp> buffIF(buff);
│ │ │ │ +
121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().scatter(buffIF,e,i,n)));
│ │ │ │ +
122 }
│ │ │ │ +
│ │ │ │ +
123
│ │ │ │ +
124 private:
│ │ │ │ +
126 DataHandleImp& asImp () {
│ │ │ │ +
127 return static_cast<DataHandleImp &> (*this);
│ │ │ │ +
128 }
│ │ │ │ +
130 const DataHandleImp& asImp () const
│ │ │ │ +
131 {
│ │ │ │ +
132 return static_cast<const DataHandleImp &>(*this);
│ │ │ │ +
133 }
│ │ │ │ +
134 }; // end class CommDataHandleIF
│ │ │ │ +
│ │ │ │ +
135
│ │ │ │ +
140 template<typename DT>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
142 public:
│ │ │ │ +
143 typedef DT value_type;
│ │ │ │ +
144
│ │ │ │ +
145 // Constructor
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
147 {
│ │ │ │ +
148 a=p;
│ │ │ │ +
149 i=0;
│ │ │ │ +
150 j=0;
│ │ │ │ +
151 }
│ │ │ │ +
│ │ │ │ +
152
│ │ │ │ +
153 // write data to message buffer, acts like a stream !
│ │ │ │ +
154 template<class Y>
│ │ │ │ +
│ │ │ │ +
155 void write (const Y& data)
│ │ │ │ +
156 {
│ │ │ │ +
157 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
│ │ │ │ +
158 a[i++] = data;
│ │ │ │ +
159 }
│ │ │ │ +
│ │ │ │ +
160
│ │ │ │ +
161 // read data from message buffer, acts like a stream !
│ │ │ │ +
162 template<class Y>
│ │ │ │ +
│ │ │ │ +
163 void read (Y& data) const
│ │ │ │ +
164 {
│ │ │ │ +
165 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
│ │ │ │ +
166 data = a[j++];
│ │ │ │ +
167 }
│ │ │ │ +
│ │ │ │ +
168
│ │ │ │ +
169 size_t counter() const { return i; }
│ │ │ │ +
170
│ │ │ │ +
│ │ │ │ +
171 void clear()
│ │ │ │ +
172 {
│ │ │ │ +
173 i = 0;
│ │ │ │ +
174 j = 0;
│ │ │ │ +
175 }
│ │ │ │ +
│ │ │ │ +
176
│ │ │ │ +
177 // we need access to these variables in an assertion
│ │ │ │ +
178#ifdef NDEBUG
│ │ │ │ +
179 private:
│ │ │ │ +
180#endif
│ │ │ │ +
181 DT *a;
│ │ │ │ +
182 size_t i;
│ │ │ │ +
183 mutable size_t j;
│ │ │ │ +
184 };
│ │ │ │ +
│ │ │ │ +
185
│ │ │ │ +
192 template<int dir>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
194 {
│ │ │ │ +
195 public:
│ │ │ │ +
196 template<class CommInfo>
│ │ │ │ +
│ │ │ │ +
197 static const typename CommInfo::DataType& gather(const CommInfo& commInfo, size_t i, size_t j = 0)
│ │ │ │ +
198 {
│ │ │ │ +
199 // get Intersection
│ │ │ │ +
200 typedef typename CommInfo::GridGlue::Intersection Intersection;
│ │ │ │ +
201 Intersection ris(commInfo.gridglue->getIntersection(i));
│ │ │ │ +
202
│ │ │ │ +
203 // fill buffer if we have a new intersection
│ │ │ │ +
204 if (j == 0)
│ │ │ │ +
205 {
│ │ │ │ +
206 commInfo.mbuffer.clear();
│ │ │ │ +
207 if (dir == Dune::ForwardCommunication)
│ │ │ │ +
208 {
│ │ │ │ +
209 // read from grid0
│ │ │ │ +
210 if(ris.self())
│ │ │ │ +
211 commInfo.data->gather(commInfo.mbuffer, ris.inside(), ris);
│ │ │ │ +
212 }
│ │ │ │ +
213 else // (dir == Dune::BackwardCommunication)
│ │ │ │ +
214 {
│ │ │ │ +
215 // read from grid1
│ │ │ │ +
216 if(ris.neighbor())
│ │ │ │ +
217 commInfo.data->gather(commInfo.mbuffer, ris.outside(), ris.flip());
│ │ │ │ +
218 }
│ │ │ │ +
219 }
│ │ │ │ +
220
│ │ │ │ +
221 // return the j'th value in the buffer
│ │ │ │ +
222 assert(j < commInfo.mbuffer.i);
│ │ │ │ +
223 return commInfo.buffer[j];
│ │ │ │ +
224 }
│ │ │ │ +
│ │ │ │ +
225
│ │ │ │ +
226 template<class CommInfo>
│ │ │ │ +
│ │ │ │ +
227 static void scatter(CommInfo& commInfo, const typename CommInfo::DataType& v, std::size_t i, std::size_t j = 0)
│ │ │ │ +
228 {
│ │ │ │ +
229 // extract GridGlue objects...
│ │ │ │ +
230 typedef typename CommInfo::GridGlue::Intersection Intersection;
│ │ │ │ +
231 Intersection ris(commInfo.gridglue->getIntersection(i));
│ │ │ │ +
232
│ │ │ │ +
233 // get size if we have a new intersection
│ │ │ │ +
234 if (j == 0)
│ │ │ │ +
235 {
│ │ │ │ +
236 commInfo.mbuffer.clear();
│ │ │ │ +
237 commInfo.currentsize = commInfo.data->size(ris);
│ │ │ │ +
238 }
│ │ │ │ +
239
│ │ │ │ +
240 // write entry to buffer
│ │ │ │ +
241 commInfo.buffer[j] = v;
│ │ │ │ +
242
│ │ │ │ +
243 // write back the buffer if we are at the end of this intersection
│ │ │ │ +
244 if (j == commInfo.currentsize-1)
│ │ │ │ +
245 {
│ │ │ │ +
246 if (dir == Dune::ForwardCommunication)
│ │ │ │ +
247 {
│ │ │ │ +
248 // write to grid1
│ │ │ │ +
249 if(ris.neighbor())
│ │ │ │ +
250 commInfo.data->scatter(commInfo.mbuffer, ris.outside(), ris.flip(), commInfo.currentsize);
│ │ │ │ +
251 }
│ │ │ │ +
252 else // (dir == Dune::BackwardCommunication)
│ │ │ │ +
253 {
│ │ │ │ +
254 // write to grid0
│ │ │ │ +
255 if(ris.self())
│ │ │ │ +
256 commInfo.data->scatter(commInfo.mbuffer, ris.inside(), ris, commInfo.currentsize);
│ │ │ │ +
257 }
│ │ │ │ +
258 assert(commInfo.mbuffer.j <= commInfo.currentsize);
│ │ │ │ +
259 }
│ │ │ │ +
260 }
│ │ │ │ +
│ │ │ │ +
261 };
│ │ │ │ +
│ │ │ │ +
262
│ │ │ │ + │ │ │ │ + │ │ │ │ +
265
│ │ │ │ +
270 template <typename GG, class DataHandleImp, class DataTypeImp>
│ │ │ │ +
│ │ │ │ +
271 struct CommInfo
│ │ │ │ +
272 {
│ │ │ │ +
273 typedef DataTypeImp value_type;
│ │ │ │ +
274 typedef GG GridGlue;
│ │ │ │ +
275 typedef DataTypeImp DataType;
│ │ │ │ +
276
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
278 {}
│ │ │ │ +
│ │ │ │ +
279
│ │ │ │ +
280 // tunnel information to the policy and the operators
│ │ │ │ + │ │ │ │ + │ │ │ │ +
283
│ │ │ │ +
284 // state variables
│ │ │ │ +
285 std::vector<DataType> buffer;
│ │ │ │ +
286 mutable ::Dune::GridGlue::StreamingMessageBuffer<DataType> mbuffer;
│ │ │ │ + │ │ │ │ +
288 Dune::CommunicationDirection dir;
│ │ │ │ +
289 };
│ │ │ │ +
│ │ │ │ +
290
│ │ │ │ +
291 } // end namespace GridGlue
│ │ │ │ +
292
│ │ │ │ +
293#if HAVE_MPI
│ │ │ │ +
298 template<typename GG, class DataHandleImp, class DataTypeImp>
│ │ │ │ +
│ │ │ │ +
299 struct CommPolicy< ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> >
│ │ │ │ +
300 {
│ │ │ │ +
304 typedef ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> Type;
│ │ │ │ +
305
│ │ │ │ +
309 typedef DataTypeImp IndexedType;
│ │ │ │ +
310
│ │ │ │ +
314 // typedef SizeOne IndexedTypeFlag;
│ │ │ │ +
315 typedef VariableSize IndexedTypeFlag;
│ │ │ │ +
316
│ │ │ │ +
│ │ │ │ +
320 static size_t getSize(const Type& commInfo, size_t i)
│ │ │ │ +
321 {
│ │ │ │ +
322 // get Intersection
│ │ │ │ +
323 typedef typename Type::GridGlue::Intersection Intersection;
│ │ │ │ +
324 Intersection ris(commInfo.gridglue->getIntersection(i));
│ │ │ │ +
325
│ │ │ │ +
326 // ask data handle for size
│ │ │ │ +
327 return commInfo.data->size(ris);
│ │ │ │ +
328 }
│ │ │ │ +
│ │ │ │ +
329 };
│ │ │ │ +
│ │ │ │ +
330#endif
│ │ │ │ +
331
│ │ │ │ +
332} // end namespace Dune
│ │ │ │ +
333#endif
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │ - │ │ │ │ -
Definition intersectioniterator.hh:25
│ │ │ │ -
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition intersectioniterator.hh:28
│ │ │ │ -
const Intersection & dereference() const
Definition intersectioniterator.hh:37
│ │ │ │ -
void increment()
Definition intersectioniterator.hh:44
│ │ │ │ -
::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection
Definition intersectioniterator.hh:29
│ │ │ │ -
IntersectionIterator(const GridGlue *glue, unsigned int i)
Definition intersectioniterator.hh:31
│ │ │ │ -
bool equals(const IntersectionIterator &iter) const
Definition intersectioniterator.hh:49
│ │ │ │ +
CommunicationOperator< Dune::BackwardCommunication > BackwardOperator
Definition gridgluecommunicate.hh:264
│ │ │ │ +
CommunicationOperator< Dune::ForwardCommunication > ForwardOperator
Definition gridgluecommunicate.hh:263
│ │ │ │ +
std::pair< int, int > RankPair
Definition gridgluecommunicate.hh:24
│ │ │ │ +
std::ostream & operator<<(std::ostream &os, const GlobalId &id)
Definition gridgluecommunicate.hh:55
│ │ │ │ +
The intersection of two entities of the two patches of a GridGlue.
Definition intersection.hh:261
│ │ │ │ +
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition intersection.hh:483
│ │ │ │ +
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition intersection.hh:393
│ │ │ │ +
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition intersection.hh:319
│ │ │ │ +
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition intersection.hh:399
│ │ │ │ +
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition intersection.hh:328
│ │ │ │ +
Definition gridgluecommunicate.hh:26
│ │ │ │ +
GlobalId(int i)
Definition gridgluecommunicate.hh:38
│ │ │ │ +
GlobalId()
Definition gridgluecommunicate.hh:30
│ │ │ │ +
GlobalId(int i, int j, unsigned int n)
Definition gridgluecommunicate.hh:48
│ │ │ │ +
describes the features of a data handle for communication in parallel runs using the GridGlue::commun...
Definition gridgluecommunicate.hh:77
│ │ │ │ +
size_t size(RISType &i) const
Definition gridgluecommunicate.hh:92
│ │ │ │ +
void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, size_t n)
Definition gridgluecommunicate.hh:118
│ │ │ │ +
void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) const
pack data from user to message buffer
Definition gridgluecommunicate.hh:104
│ │ │ │ +
DataTypeImp DataType
data type of data to communicate
Definition gridgluecommunicate.hh:80
│ │ │ │ +
CommDataHandle()
Definition gridgluecommunicate.hh:84
│ │ │ │ +
Definition gridgluecommunicate.hh:141
│ │ │ │ +
size_t j
Definition gridgluecommunicate.hh:183
│ │ │ │ +
StreamingMessageBuffer(DT *p)
Definition gridgluecommunicate.hh:146
│ │ │ │ +
DT * a
Definition gridgluecommunicate.hh:181
│ │ │ │ +
size_t counter() const
Definition gridgluecommunicate.hh:169
│ │ │ │ +
void write(const Y &data)
Definition gridgluecommunicate.hh:155
│ │ │ │ +
void read(Y &data) const
Definition gridgluecommunicate.hh:163
│ │ │ │ +
DT value_type
Definition gridgluecommunicate.hh:143
│ │ │ │ +
size_t i
Definition gridgluecommunicate.hh:182
│ │ │ │ +
void clear()
Definition gridgluecommunicate.hh:171
│ │ │ │ +
forward gather scatter to user defined CommInfo class
Definition gridgluecommunicate.hh:194
│ │ │ │ +
static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v, std::size_t i, std::size_t j=0)
Definition gridgluecommunicate.hh:227
│ │ │ │ +
static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i, size_t j=0)
Definition gridgluecommunicate.hh:197
│ │ │ │ +
collects all GridGlue data requried for communication
Definition gridgluecommunicate.hh:272
│ │ │ │ +
Dune::CommunicationDirection dir
Definition gridgluecommunicate.hh:288
│ │ │ │ +
DataTypeImp value_type
Definition gridgluecommunicate.hh:273
│ │ │ │ +
DataTypeImp DataType
Definition gridgluecommunicate.hh:275
│ │ │ │ +
::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data
Definition gridgluecommunicate.hh:282
│ │ │ │ +
GG GridGlue
Definition gridgluecommunicate.hh:274
│ │ │ │ +
size_t currentsize
Definition gridgluecommunicate.hh:287
│ │ │ │ +
CommInfo()
Definition gridgluecommunicate.hh:277
│ │ │ │ +
mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer
Definition gridgluecommunicate.hh:286
│ │ │ │ +
const GridGlue * gridglue
Definition gridgluecommunicate.hh:281
│ │ │ │ +
std::vector< DataType > buffer
Definition gridgluecommunicate.hh:285
│ │ │ │ +
static size_t getSize(const Type &commInfo, size_t i)
Get the number of objects at an intersection.
Definition gridgluecommunicate.hh:320
│ │ │ │ +
DataTypeImp IndexedType
The datatype that should be communicated.
Definition gridgluecommunicate.hh:309
│ │ │ │ +
::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type
The type of the GridGlueCommInfo.
Definition gridgluecommunicate.hh:304
│ │ │ │ +
VariableSize IndexedTypeFlag
Each intersection can communicate a different number of objects.
Definition gridgluecommunicate.hh:315
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,99 +1,442 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -intersectioniterator.hh │ │ │ │ │ +gridgluecommunicate.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ -13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ +5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH │ │ │ │ │ +6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH │ │ │ │ │ +7 │ │ │ │ │ +13#include │ │ │ │ │ 14 │ │ │ │ │ -15#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ -16 │ │ │ │ │ -17namespace _D_u_n_e { │ │ │ │ │ -18 namespace GridGlue { │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18#include │ │ │ │ │ 19 │ │ │ │ │ -21 template │ │ │ │ │ -_2_2 class _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r : │ │ │ │ │ -23 public Dune::ForwardIteratorFacade< │ │ │ │ │ -IntersectionIterator, │ │ │ │ │ -24 const Intersection > │ │ │ │ │ -25 { │ │ │ │ │ -26 public: │ │ │ │ │ -27 │ │ │ │ │ -_2_8 typedef ::Dune::GridGlue::GridGlue _G_r_i_d_G_l_u_e; │ │ │ │ │ -_2_9 typedef ::Dune::GridGlue::Intersection _I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ -30 │ │ │ │ │ -_3_1 _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r(const _G_r_i_d_G_l_u_e * glue, unsigned int i) │ │ │ │ │ -32 : glue_(glue), │ │ │ │ │ -33 index_(i), │ │ │ │ │ -34 intersection_(glue_, & glue_->intersections_[index_]) │ │ │ │ │ -35 {} │ │ │ │ │ -36 │ │ │ │ │ -_3_7 const _I_n_t_e_r_s_e_c_t_i_o_n& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ │ -38 { │ │ │ │ │ -39 assert(("never dereference the end iterator" && │ │ │ │ │ -40 index_ != glue_->index__sz)); │ │ │ │ │ -41 return intersection_; │ │ │ │ │ +20 │ │ │ │ │ +21namespace _D_u_n_e { │ │ │ │ │ +22 namespace GridGlue { │ │ │ │ │ +23 │ │ │ │ │ +_2_4 typedef std::pair _R_a_n_k_P_a_i_r; │ │ │ │ │ +_2_5 struct _G_l_o_b_a_l_I_d : public std::pair │ │ │ │ │ +26 { │ │ │ │ │ +_3_0 _G_l_o_b_a_l_I_d() { │ │ │ │ │ +31 this->first.first = 0; │ │ │ │ │ +32 this->first.second = 0; │ │ │ │ │ +33 this->second = 0; │ │ │ │ │ +34 } │ │ │ │ │ +_3_8 _G_l_o_b_a_l_I_d(int i) { │ │ │ │ │ +39 this->first.first = i; │ │ │ │ │ +40 this->first.second = i; │ │ │ │ │ +41 this->second = 0; │ │ │ │ │ 42 } │ │ │ │ │ -43 │ │ │ │ │ -_4_4 void _i_n_c_r_e_m_e_n_t() │ │ │ │ │ -45 { │ │ │ │ │ -46 intersection_ = _I_n_t_e_r_s_e_c_t_i_o_n(glue_, & glue_->intersections_[++index_]); │ │ │ │ │ -47 } │ │ │ │ │ -48 │ │ │ │ │ -_4_9 bool _e_q_u_a_l_s(const _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r& iter) const │ │ │ │ │ -50 { │ │ │ │ │ -51 return iter.index_ == index_; │ │ │ │ │ +_4_8 _G_l_o_b_a_l_I_d(int i, int j, unsigned int n) { │ │ │ │ │ +49 this->first.first = std::min(i,j); │ │ │ │ │ +50 this->first.second = std::max(i,j); │ │ │ │ │ +51 this->second = n; │ │ │ │ │ 52 } │ │ │ │ │ -53 │ │ │ │ │ -54 private: │ │ │ │ │ -55 │ │ │ │ │ -56 const _G_r_i_d_G_l_u_e* glue_; │ │ │ │ │ -57 unsigned int index_; │ │ │ │ │ -58 │ │ │ │ │ -59 _I_n_t_e_r_s_e_c_t_i_o_n intersection_; │ │ │ │ │ -60 }; │ │ │ │ │ -61 │ │ │ │ │ -62 } // end namespace GridGlue │ │ │ │ │ -63} // end namespace Dune │ │ │ │ │ -64 │ │ │ │ │ -65#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ -_g_r_i_d_g_l_u_e_._h_h │ │ │ │ │ -Central component of the module implementing the coupling of two grids. │ │ │ │ │ +53 }; │ │ │ │ │ +54 │ │ │ │ │ +_5_5 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _G_l_o_b_a_l_I_d & id) │ │ │ │ │ +56 { │ │ │ │ │ +57 os << "(" │ │ │ │ │ +58 << id.first.first << "," << id.first.second << "," │ │ │ │ │ +59 << id.second << ")"; │ │ │ │ │ +60 return os; │ │ │ │ │ +61 } │ │ │ │ │ +62 │ │ │ │ │ +75 template │ │ │ │ │ +_7_6 class _C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ +77 { │ │ │ │ │ +78 public: │ │ │ │ │ +_8_0 typedef DataTypeImp _D_a_t_a_T_y_p_e; │ │ │ │ │ +81 │ │ │ │ │ +82 protected: │ │ │ │ │ +83 // one should not create an explicit instance of this inteface object │ │ │ │ │ +_8_4 _C_o_m_m_D_a_t_a_H_a_n_d_l_e() {} │ │ │ │ │ +85 │ │ │ │ │ +86 public: │ │ │ │ │ +87 │ │ │ │ │ +91 template │ │ │ │ │ +_9_2 size_t _s_i_z_e (RISType& i) const │ │ │ │ │ +93 { │ │ │ │ │ +94 CHECK_INTERFACE_IMPLEMENTATION((asImp()._s_i_z_e(i))); │ │ │ │ │ +95 return asImp().size(i); │ │ │ │ │ +96 } │ │ │ │ │ +97 │ │ │ │ │ +103 template │ │ │ │ │ +_1_0_4 void _g_a_t_h_e_r (MessageBufferImp& buff, const EntityType& e, const RISType & │ │ │ │ │ +i) const │ │ │ │ │ +105 { │ │ │ │ │ +106 MessageBufferIF buffIF(buff); │ │ │ │ │ +107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp()._g_a_t_h_e_r(buffIF,e,i))); │ │ │ │ │ +108 } │ │ │ │ │ +109 │ │ │ │ │ +117 template │ │ │ │ │ +_1_1_8 void _s_c_a_t_t_e_r (MessageBufferImp& buff, const EntityType& e, const RISType & │ │ │ │ │ +i, size_t n) │ │ │ │ │ +119 { │ │ │ │ │ +120 MessageBufferIF buffIF(buff); │ │ │ │ │ +121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp()._s_c_a_t_t_e_r(buffIF,e,i,n))); │ │ │ │ │ +122 } │ │ │ │ │ +123 │ │ │ │ │ +124 private: │ │ │ │ │ +126 DataHandleImp& asImp () { │ │ │ │ │ +127 return static_cast (*this); │ │ │ │ │ +128 } │ │ │ │ │ +130 const DataHandleImp& asImp () const │ │ │ │ │ +131 { │ │ │ │ │ +132 return static_cast(*this); │ │ │ │ │ +133 } │ │ │ │ │ +134 }; // end class CommDataHandleIF │ │ │ │ │ +135 │ │ │ │ │ +140 template │ │ │ │ │ +_1_4_1 class _S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r { │ │ │ │ │ +142 public: │ │ │ │ │ +_1_4_3 typedef DT _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +144 │ │ │ │ │ +145 // Constructor │ │ │ │ │ +_1_4_6 _S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r (DT *p) │ │ │ │ │ +147 { │ │ │ │ │ +148 _a=p; │ │ │ │ │ +149 _i=0; │ │ │ │ │ +150 _j=0; │ │ │ │ │ +151 } │ │ │ │ │ +152 │ │ │ │ │ +153 // write data to message buffer, acts like a stream ! │ │ │ │ │ +154 template │ │ │ │ │ +_1_5_5 void _w_r_i_t_e (const Y& data) │ │ │ │ │ +156 { │ │ │ │ │ +157 static_assert(std::is_same::value, "DataType mismatch"); │ │ │ │ │ +158 _a[_i++] = data; │ │ │ │ │ +159 } │ │ │ │ │ +160 │ │ │ │ │ +161 // read data from message buffer, acts like a stream ! │ │ │ │ │ +162 template │ │ │ │ │ +_1_6_3 void _r_e_a_d (Y& data) const │ │ │ │ │ +164 { │ │ │ │ │ +165 static_assert(std::is_same::value, "DataType mismatch"); │ │ │ │ │ +166 data = _a[_j++]; │ │ │ │ │ +167 } │ │ │ │ │ +168 │ │ │ │ │ +_1_6_9 size_t _c_o_u_n_t_e_r() const { return _i; } │ │ │ │ │ +170 │ │ │ │ │ +_1_7_1 void _c_l_e_a_r() │ │ │ │ │ +172 { │ │ │ │ │ +173 _i = 0; │ │ │ │ │ +174 _j = 0; │ │ │ │ │ +175 } │ │ │ │ │ +176 │ │ │ │ │ +177 // we need access to these variables in an assertion │ │ │ │ │ +178#ifdef NDEBUG │ │ │ │ │ +179 private: │ │ │ │ │ +180#endif │ │ │ │ │ +_1_8_1 DT *_a; │ │ │ │ │ +_1_8_2 size_t _i; │ │ │ │ │ +_1_8_3 mutable size_t _j; │ │ │ │ │ +184 }; │ │ │ │ │ +185 │ │ │ │ │ +192 template │ │ │ │ │ +_1_9_3 class _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ +194 { │ │ │ │ │ +195 public: │ │ │ │ │ +196 template │ │ │ │ │ +_1_9_7 static const typename _C_o_m_m_I_n_f_o_:_:_D_a_t_a_T_y_p_e& _g_a_t_h_e_r(const _C_o_m_m_I_n_f_o& commInfo, │ │ │ │ │ +size_t i, size_t j = 0) │ │ │ │ │ +198 { │ │ │ │ │ +199 // get Intersection │ │ │ │ │ +200 typedef typename CommInfo::GridGlue::Intersection _I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ +201 _I_n_t_e_r_s_e_c_t_i_o_n ris(commInfo._g_r_i_d_g_l_u_e->getIntersection(i)); │ │ │ │ │ +202 │ │ │ │ │ +203 // fill buffer if we have a new intersection │ │ │ │ │ +204 if (j == 0) │ │ │ │ │ +205 { │ │ │ │ │ +206 commInfo._m_b_u_f_f_e_r._c_l_e_a_r(); │ │ │ │ │ +207 if (dir == Dune::ForwardCommunication) │ │ │ │ │ +208 { │ │ │ │ │ +209 // read from grid0 │ │ │ │ │ +210 if(ris._s_e_l_f()) │ │ │ │ │ +211 commInfo._d_a_t_a->gather(commInfo._m_b_u_f_f_e_r, ris._i_n_s_i_d_e(), ris); │ │ │ │ │ +212 } │ │ │ │ │ +213 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ +214 { │ │ │ │ │ +215 // read from grid1 │ │ │ │ │ +216 if(ris._n_e_i_g_h_b_o_r()) │ │ │ │ │ +217 commInfo._d_a_t_a->gather(commInfo._m_b_u_f_f_e_r, ris._o_u_t_s_i_d_e(), ris._f_l_i_p()); │ │ │ │ │ +218 } │ │ │ │ │ +219 } │ │ │ │ │ +220 │ │ │ │ │ +221 // return the j'th value in the buffer │ │ │ │ │ +222 assert(j < commInfo._m_b_u_f_f_e_r._i); │ │ │ │ │ +223 return commInfo._b_u_f_f_e_r[j]; │ │ │ │ │ +224 } │ │ │ │ │ +225 │ │ │ │ │ +226 template │ │ │ │ │ +_2_2_7 static void _s_c_a_t_t_e_r(_C_o_m_m_I_n_f_o& commInfo, const typename _C_o_m_m_I_n_f_o_:_:_D_a_t_a_T_y_p_e& │ │ │ │ │ +v, std::size_t i, std::size_t j = 0) │ │ │ │ │ +228 { │ │ │ │ │ +229 // extract GridGlue objects... │ │ │ │ │ +230 typedef typename CommInfo::GridGlue::Intersection _I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ +231 _I_n_t_e_r_s_e_c_t_i_o_n ris(commInfo._g_r_i_d_g_l_u_e->getIntersection(i)); │ │ │ │ │ +232 │ │ │ │ │ +233 // get size if we have a new intersection │ │ │ │ │ +234 if (j == 0) │ │ │ │ │ +235 { │ │ │ │ │ +236 commInfo._m_b_u_f_f_e_r._c_l_e_a_r(); │ │ │ │ │ +237 commInfo._c_u_r_r_e_n_t_s_i_z_e = commInfo._d_a_t_a->size(ris); │ │ │ │ │ +238 } │ │ │ │ │ +239 │ │ │ │ │ +240 // write entry to buffer │ │ │ │ │ +241 commInfo._b_u_f_f_e_r[j] = v; │ │ │ │ │ +242 │ │ │ │ │ +243 // write back the buffer if we are at the end of this intersection │ │ │ │ │ +244 if (j == commInfo._c_u_r_r_e_n_t_s_i_z_e-1) │ │ │ │ │ +245 { │ │ │ │ │ +246 if (dir == Dune::ForwardCommunication) │ │ │ │ │ +247 { │ │ │ │ │ +248 // write to grid1 │ │ │ │ │ +249 if(ris._n_e_i_g_h_b_o_r()) │ │ │ │ │ +250 commInfo._d_a_t_a->scatter(commInfo._m_b_u_f_f_e_r, ris._o_u_t_s_i_d_e(), ris._f_l_i_p(), │ │ │ │ │ +commInfo._c_u_r_r_e_n_t_s_i_z_e); │ │ │ │ │ +251 } │ │ │ │ │ +252 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ +253 { │ │ │ │ │ +254 // write to grid0 │ │ │ │ │ +255 if(ris._s_e_l_f()) │ │ │ │ │ +256 commInfo._d_a_t_a->scatter(commInfo._m_b_u_f_f_e_r, ris._i_n_s_i_d_e(), ris, │ │ │ │ │ +commInfo._c_u_r_r_e_n_t_s_i_z_e); │ │ │ │ │ +257 } │ │ │ │ │ +258 assert(commInfo._m_b_u_f_f_e_r._j <= commInfo._c_u_r_r_e_n_t_s_i_z_e); │ │ │ │ │ +259 } │ │ │ │ │ +260 } │ │ │ │ │ +261 }; │ │ │ │ │ +262 │ │ │ │ │ +_2_6_3 typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_<_D_u_n_e_:_:_F_o_r_w_a_r_d_C_o_m_m_u_n_i_c_a_t_i_o_n_> _F_o_r_w_a_r_d_O_p_e_r_a_t_o_r; │ │ │ │ │ +_2_6_4 typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_<_D_u_n_e_:_:_B_a_c_k_w_a_r_d_C_o_m_m_u_n_i_c_a_t_i_o_n_> │ │ │ │ │ +_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r; │ │ │ │ │ +265 │ │ │ │ │ +270 template │ │ │ │ │ +_2_7_1 struct _C_o_m_m_I_n_f_o │ │ │ │ │ +272 { │ │ │ │ │ +_2_7_3 typedef DataTypeImp _v_a_l_u_e___t_y_p_e; │ │ │ │ │ +_2_7_4 typedef GG _G_r_i_d_G_l_u_e; │ │ │ │ │ +_2_7_5 typedef DataTypeImp _D_a_t_a_T_y_p_e; │ │ │ │ │ +276 │ │ │ │ │ +_2_7_7 _C_o_m_m_I_n_f_o() : _b_u_f_f_e_r(100), _m_b_u_f_f_e_r(&_b_u_f_f_e_r[0]) │ │ │ │ │ +278 {} │ │ │ │ │ +279 │ │ │ │ │ +280 // tunnel information to the policy and the operators │ │ │ │ │ +_2_8_1 const _G_r_i_d_G_l_u_e * _g_r_i_d_g_l_u_e; │ │ │ │ │ +_2_8_2 _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_> * _d_a_t_a; │ │ │ │ │ +283 │ │ │ │ │ +284 // state variables │ │ │ │ │ +_2_8_5 std::vector _b_u_f_f_e_r; │ │ │ │ │ +_2_8_6 mutable ::Dune::GridGlue::StreamingMessageBuffer _m_b_u_f_f_e_r; │ │ │ │ │ +_2_8_7 size_t _c_u_r_r_e_n_t_s_i_z_e; │ │ │ │ │ +_2_8_8 Dune::CommunicationDirection _d_i_r; │ │ │ │ │ +289 }; │ │ │ │ │ +290 │ │ │ │ │ +291 } // end namespace GridGlue │ │ │ │ │ +292 │ │ │ │ │ +293#if HAVE_MPI │ │ │ │ │ +298 template │ │ │ │ │ +_2_9_9 struct CommPolicy< ::_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o > │ │ │ │ │ +300 { │ │ │ │ │ +_3_0_4 typedef ::Dune::GridGlue::CommInfo _T_y_p_e; │ │ │ │ │ +305 │ │ │ │ │ +_3_0_9 typedef DataTypeImp _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ +310 │ │ │ │ │ +314 // typedef SizeOne IndexedTypeFlag; │ │ │ │ │ +_3_1_5 typedef VariableSize _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ +316 │ │ │ │ │ +_3_2_0 static size_t _g_e_t_S_i_z_e(const _T_y_p_e& commInfo, size_t i) │ │ │ │ │ +321 { │ │ │ │ │ +322 // get Intersection │ │ │ │ │ +323 typedef typename Type::GridGlue::Intersection Intersection; │ │ │ │ │ +324 Intersection ris(commInfo._g_r_i_d_g_l_u_e->getIntersection(i)); │ │ │ │ │ +325 │ │ │ │ │ +326 // ask data handle for size │ │ │ │ │ +327 return commInfo._d_a_t_a->size(ris); │ │ │ │ │ +328 } │ │ │ │ │ +329 }; │ │ │ │ │ +330#endif │ │ │ │ │ +331 │ │ │ │ │ +332} // end namespace Dune │ │ │ │ │ +333#endif │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ -sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ -DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_<_ _P_0_,_ _P_1_,_ _i_n_s_i_d_e_,_ _o_u_t_s_i_d_e_ _> │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn intersectioniterator.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ -::Dune::GridGlue::GridGlue< P0, P1 > GridGlue │ │ │ │ │ -DDeeffiinniittiioonn intersectioniterator.hh:28 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ │ -const Intersection & dereference() const │ │ │ │ │ -DDeeffiinniittiioonn intersectioniterator.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ │ -void increment() │ │ │ │ │ -DDeeffiinniittiioonn intersectioniterator.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection │ │ │ │ │ -DDeeffiinniittiioonn intersectioniterator.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r │ │ │ │ │ -IntersectionIterator(const GridGlue *glue, unsigned int i) │ │ │ │ │ -DDeeffiinniittiioonn intersectioniterator.hh:31 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ │ -bool equals(const IntersectionIterator &iter) const │ │ │ │ │ -DDeeffiinniittiioonn intersectioniterator.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ +CommunicationOperator< Dune::BackwardCommunication > BackwardOperator │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:264 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_F_o_r_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ +CommunicationOperator< Dune::ForwardCommunication > ForwardOperator │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:263 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_a_n_k_P_a_i_r │ │ │ │ │ +std::pair< int, int > RankPair │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ +std::ostream & operator<<(std::ostream &os, const GlobalId &id) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +The intersection of two entities of the two patches of a GridGlue. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:261 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_f_l_i_p │ │ │ │ │ +Intersection< P0, P1, O, I > flip() const │ │ │ │ │ +Return a copy of the intersection with inside and outside switched. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:483 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_s_e_l_f │ │ │ │ │ +bool self() const │ │ │ │ │ +For parallel computations: Return true if inside() entity exists locally. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:393 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_s_i_d_e │ │ │ │ │ +InsideEntity inside(unsigned int parentId=0) const │ │ │ │ │ +Return element on the inside of this intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:319 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_n_e_i_g_h_b_o_r │ │ │ │ │ +size_t neighbor(unsigned int g=0) const │ │ │ │ │ +Return number of embeddings into local grid0 (grid1) entities. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:399 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_s_i_d_e │ │ │ │ │ +OutsideEntity outside(unsigned int parentId=0) const │ │ │ │ │ +Return element on the outside of this intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ +GlobalId(int i) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ +GlobalId() │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:30 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ +GlobalId(int i, int j, unsigned int n) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:48 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ +describes the features of a data handle for communication in parallel runs │ │ │ │ │ +using the GridGlue::commun... │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_i_z_e │ │ │ │ │ +size_t size(RISType &i) const │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_c_a_t_t_e_r │ │ │ │ │ +void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, │ │ │ │ │ +size_t n) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:118 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_g_a_t_h_e_r │ │ │ │ │ +void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) │ │ │ │ │ +const │ │ │ │ │ +pack data from user to message buffer │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_D_a_t_a_T_y_p_e │ │ │ │ │ +DataTypeImp DataType │ │ │ │ │ +data type of data to communicate │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:80 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ +CommDataHandle() │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_j │ │ │ │ │ +size_t j │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:183 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r │ │ │ │ │ +StreamingMessageBuffer(DT *p) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:146 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_a │ │ │ │ │ +DT * a │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:181 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_c_o_u_n_t_e_r │ │ │ │ │ +size_t counter() const │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:169 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_w_r_i_t_e │ │ │ │ │ +void write(const Y &data) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:155 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_r_e_a_d │ │ │ │ │ +void read(Y &data) const │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:163 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +DT value_type │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:143 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_i │ │ │ │ │ +size_t i │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:182 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:171 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ +forward gather scatter to user defined CommInfo class │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ +static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v, │ │ │ │ │ +std::size_t i, std::size_t j=0) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:227 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_:_:_g_a_t_h_e_r │ │ │ │ │ +static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i, │ │ │ │ │ +size_t j=0) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:197 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o │ │ │ │ │ +collects all GridGlue data requried for communication │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:272 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_i_r │ │ │ │ │ +Dune::CommunicationDirection dir │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:288 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ +DataTypeImp value_type │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:273 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_D_a_t_a_T_y_p_e │ │ │ │ │ +DataTypeImp DataType │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_a_t_a │ │ │ │ │ +::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ +GG GridGlue │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:274 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_c_u_r_r_e_n_t_s_i_z_e │ │ │ │ │ +size_t currentsize │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:287 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_C_o_m_m_I_n_f_o │ │ │ │ │ +CommInfo() │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:277 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_m_b_u_f_f_e_r │ │ │ │ │ +mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:286 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_g_r_i_d_g_l_u_e │ │ │ │ │ +const GridGlue * gridglue │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_b_u_f_f_e_r │ │ │ │ │ +std::vector< DataType > buffer │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:285 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ +_>_:_:_g_e_t_S_i_z_e │ │ │ │ │ +static size_t getSize(const Type &commInfo, size_t i) │ │ │ │ │ +Get the number of objects at an intersection. │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:320 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ +_>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ +DataTypeImp IndexedType │ │ │ │ │ +The datatype that should be communicated. │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:309 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ +_>_:_:_T_y_p_e │ │ │ │ │ +::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type │ │ │ │ │ +The type of the GridGlueCommInfo. │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:304 │ │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ +_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ +VariableSize IndexedTypeFlag │ │ │ │ │ +Each intersection can communicate a different number of objects. │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:315 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectionindexset.hh File Reference │ │ │ │ +dune-grid-glue: intersection.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,35 +71,74 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
intersectionindexset.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Macros
│ │ │ │ +
intersection.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/grid-glue/gridglue.hh>
│ │ │ │ -#include <dune/grid-glue/adapter/intersection.hh>
│ │ │ │ + │ │ │ │ +

Model of the Intersection concept provided by GridGlue. │ │ │ │ +More...

│ │ │ │ +
#include <algorithm>
│ │ │ │ +#include <optional>
│ │ │ │ +#include <tuple>
│ │ │ │ +#include <dune/common/deprecated.hh>
│ │ │ │ +#include <dune/common/version.hh>
│ │ │ │ +#include <dune/geometry/affinegeometry.hh>
│ │ │ │ +#include <dune/geometry/referenceelements.hh>
│ │ │ │ +#include <dune/grid-glue/gridglue.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GridGlue::IntersectionIndexSet< P0, P1 >
class  Dune::GridGlue::IntersectionData< P0, P1 >
 storage class for Dune::GridGlue::Intersection related data More...
 
struct  Dune::GridGlue::IntersectionTraits< P0, P1, inside, outside >
 
class  Dune::GridGlue::Intersection< P0, P1, I, O >
 The intersection of two entities of the two patches of a GridGlue. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Macros

#define ONLY_SIMPLEX_INTERSECTIONS
 
│ │ │ │ +

Detailed Description

│ │ │ │ +

Model of the Intersection concept provided by GridGlue.

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

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ ONLY_SIMPLEX_INTERSECTIONS

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,22 +1,46 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -intersectionindexset.hh File Reference │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ │ +intersection.hh File Reference │ │ │ │ │ +Model of the Intersection concept provided by GridGlue. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_<_ _P_0_,_ _P_1_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_<_ _P_0_,_ _P_1_ _> │ │ │ │ │ +  storage class for _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n related data _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_<_ _P_0_,_ _P_1_,_ _i_n_s_i_d_e_,_ _o_u_t_s_i_d_e_ _> │ │ │ │ │ +  │ │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_<_ _P_0_,_ _P_1_,_ _I_,_ _O_ _> │ │ │ │ │ +  The intersection of two entities of the two patches of a _G_r_i_d_G_l_u_e. │ │ │ │ │ + _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _O_N_L_Y___S_I_M_P_L_E_X___I_N_T_E_R_S_E_C_T_I_O_N_S │ │ │ │ │ +  │ │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ +Model of the Intersection concept provided by GridGlue. │ │ │ │ │ + Author │ │ │ │ │ + Christian Engwer │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? OONNLLYY__SSIIMMPPLLEEXX__IINNTTEERRSSEECCTTIIOONNSS ********** │ │ │ │ │ +#define ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectionindexset.hh Source File │ │ │ │ +dune-grid-glue: intersection.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,87 +74,578 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
intersectionindexset.hh
│ │ │ │ +
intersection.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
3#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH
│ │ │ │ -
5
│ │ │ │ - │ │ │ │ - │ │ │ │ -
8
│ │ │ │ -
9#ifndef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ -
10// we currently support only one intersection type. If we want to support more,
│ │ │ │ -
11// we have to think about the semantics of our IndexSet
│ │ │ │ -
12#error Not Implemented
│ │ │ │ -
13#endif
│ │ │ │ -
14
│ │ │ │ -
15namespace Dune {
│ │ │ │ -
16 namespace GridGlue {
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ +
11#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH
│ │ │ │ +
12#define DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH
│ │ │ │ +
13
│ │ │ │ +
14#include <algorithm>
│ │ │ │ +
15#include <optional>
│ │ │ │ +
16#include <tuple>
│ │ │ │
17
│ │ │ │ -
18 template<typename P0, typename P1>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
20 {
│ │ │ │ -
21 friend class ::Dune::GridGlue::GridGlue<P0,P1>;
│ │ │ │ -
22 typedef ::Dune::GridGlue::GridGlue<P0,P1> GridGlue;
│ │ │ │ +
18#include <dune/common/deprecated.hh>
│ │ │ │ +
19#include <dune/common/version.hh>
│ │ │ │ +
20#include <dune/geometry/affinegeometry.hh>
│ │ │ │ +
21#include <dune/geometry/referenceelements.hh>
│ │ │ │ + │ │ │ │
23
│ │ │ │ -
24 public:
│ │ │ │ +
24#define ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │
25
│ │ │ │ - │ │ │ │ -
29 typedef size_t SizeType;
│ │ │ │ -
30
│ │ │ │ -
33 template<int I, int O>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
35 {
│ │ │ │ -
36 return i.i_->index_;
│ │ │ │ -
37 }
│ │ │ │ -
│ │ │ │ -
38
│ │ │ │ -
│ │ │ │ -
41 SizeType size () const
│ │ │ │ -
42 {
│ │ │ │ -
43 return glue_->size();
│ │ │ │ -
44 }
│ │ │ │ -
│ │ │ │ -
45
│ │ │ │ -
46 private:
│ │ │ │ -
47
│ │ │ │ - │ │ │ │ -
50 glue_(g) {}
│ │ │ │ +
26namespace Dune {
│ │ │ │ +
27 namespace GridGlue {
│ │ │ │ +
28
│ │ │ │ +
29 // forward declaration
│ │ │ │ +
30 template<typename P0, typename P1>
│ │ │ │ +
31 class IntersectionIndexSet;
│ │ │ │ +
32
│ │ │ │ +
36 template<typename P0, typename P1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
38 {
│ │ │ │ +
39 public:
│ │ │ │ +
40 typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
│ │ │ │ +
41
│ │ │ │ + │ │ │ │ +
43
│ │ │ │ +
45 static constexpr int coorddim = GridGlue::dimworld;
│ │ │ │ +
46
│ │ │ │ +
47 private:
│ │ │ │ +
48 // intermediate quantities
│ │ │ │ +
49 template<int side>
│ │ │ │ +
50 static constexpr int dim() { return GridGlue::template GridView<side>::Grid::dimension - GridGlue::template GridPatch<side>::codim; }
│ │ │ │
51
│ │ │ │ -
52 const GridGlue * glue_;
│ │ │ │ -
53 };
│ │ │ │ +
52 public:
│ │ │ │ +
54 static constexpr int mydim = dim<0>() < dim<1>() ? dim<0>() : dim<1>();
│ │ │ │ +
55
│ │ │ │ +
56 template<int side>
│ │ │ │ +
57 using GridLocalGeometry = AffineGeometry<
│ │ │ │ +
58 typename GridGlue::template GridView<side>::ctype, mydim, GridGlue::template GridView<side>::dimension>;
│ │ │ │ +
59
│ │ │ │ +
60 using Grid0LocalGeometry [[deprecated("please use GridLocalGeometry<0> instead")]] = GridLocalGeometry<0>;
│ │ │ │ +
61 using Grid1LocalGeometry [[deprecated("please use GridLocalGeometry<1> instead")]] = GridLocalGeometry<1>;
│ │ │ │ +
62
│ │ │ │ +
63 template<int side>
│ │ │ │ +
64 using GridGeometry = AffineGeometry<
│ │ │ │ +
65 typename GridGlue::template GridView<side>::ctype, mydim, GridGlue::template GridView<side>::dimensionworld>;
│ │ │ │ +
66
│ │ │ │ +
67 using Grid0Geometry [[deprecated("please use GridGeometry<0> instead")]] = GridGeometry<0>;
│ │ │ │ +
68 using Grid1Geometry [[deprecated("please use GridGeometry<1> instead")]] = GridGeometry<1>;
│ │ │ │ +
69
│ │ │ │ +
70 template<int side>
│ │ │ │ +
71 using GridIndexType = typename GridGlue::template GridView<side>::IndexSet::IndexType;
│ │ │ │ +
72
│ │ │ │ +
73 using Grid0IndexType [[deprecated("please use GridIndexType<0> instead")]] = GridIndexType<0>;
│ │ │ │ +
74 using Grid1IndexType [[deprecated("please use GridIndexType<1> instead")]] = GridIndexType<1>;
│ │ │ │ +
75
│ │ │ │ +
77 IntersectionData(const GridGlue& glue, unsigned int mergeindex, unsigned int offset, bool grid0local, bool grid1local);
│ │ │ │ +
78
│ │ │ │ +
80 IntersectionData() = default;
│ │ │ │ +
81
│ │ │ │ +
82 /* Accessor Functions */
│ │ │ │ +
83
│ │ │ │ +
84 template<int side>
│ │ │ │ +
│ │ │ │ +
85 const GridLocalGeometry<side>& localGeometry(unsigned int parentId = 0) const
│ │ │ │ +
86 { return *std::get<side>(sideData_).gridlocalgeom[parentId]; }
│ │ │ │
│ │ │ │ -
54
│ │ │ │ -
55 } // end namespace GridGlue
│ │ │ │ -
56} // end namespace Dune
│ │ │ │ -
57
│ │ │ │ -
58#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH
│ │ │ │ +
87
│ │ │ │ +
88 template<int side>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
90 { return *std::get<side>(sideData_).gridgeom; }
│ │ │ │ +
│ │ │ │ +
91
│ │ │ │ +
92 template<int side>
│ │ │ │ +
│ │ │ │ +
93 bool local() const
│ │ │ │ +
94 { return std::get<side>(sideData_).gridlocal; }
│ │ │ │ +
│ │ │ │ +
95
│ │ │ │ +
96 template<int side>
│ │ │ │ +
│ │ │ │ +
97 IndexType index(unsigned int parentId = 0) const
│ │ │ │ +
98 { return std::get<side>(sideData_).gridindices[parentId]; }
│ │ │ │ +
│ │ │ │ +
99
│ │ │ │ +
100 template<int side>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
102 { return std::get<side>(sideData_).gridindices.size(); }
│ │ │ │ +
│ │ │ │ +
103
│ │ │ │ +
104 private:
│ │ │ │ +
105 template<int side>
│ │ │ │ +
106 void initializeGeometry(const GridGlue& glue, unsigned mergeindex);
│ │ │ │ +
107
│ │ │ │ +
108 /* M E M B E R V A R I A B L E S */
│ │ │ │ +
109
│ │ │ │ +
110 public:
│ │ │ │ + │ │ │ │ +
113
│ │ │ │ +
114 private:
│ │ │ │ +
115 template<int side>
│ │ │ │ +
116 struct SideData {
│ │ │ │ +
118 bool gridlocal = false;
│ │ │ │ +
119
│ │ │ │ +
121 std::vector< GridIndexType<side> > gridindices;
│ │ │ │ +
122
│ │ │ │ +
124 std::vector< std::optional< GridLocalGeometry<side> > > gridlocalgeom;
│ │ │ │ +
125
│ │ │ │ +
133 std::optional< GridGeometry<side> > gridgeom;
│ │ │ │ +
134 };
│ │ │ │ +
135
│ │ │ │ +
136 std::tuple< SideData<0>, SideData<1> > sideData_;
│ │ │ │ +
137 };
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
139 template<typename P0, typename P1>
│ │ │ │ +
140 template<int side>
│ │ │ │ +
141 void IntersectionData<P0, P1>::initializeGeometry(const GridGlue& glue, unsigned mergeindex)
│ │ │ │ +
142 {
│ │ │ │ +
143 auto& data = std::get<side>(sideData_);
│ │ │ │ +
144
│ │ │ │ +
145 const unsigned n_parents = glue.merger_->template parents<side>(mergeindex);
│ │ │ │ +
146
│ │ │ │ +
147 // init containers
│ │ │ │ +
148 data.gridindices.resize(n_parents);
│ │ │ │ +
149 data.gridlocalgeom.resize(n_parents);
│ │ │ │ +
150
│ │ │ │ +
151 // default values
│ │ │ │ +
152 data.gridindices[0] = 0;
│ │ │ │ +
153
│ │ │ │ +
154 static constexpr int nSimplexCorners = mydim + 1;
│ │ │ │ +
155 using ctype = typename GridGlue::ctype;
│ │ │ │ +
156
│ │ │ │ +
157 // initialize the local and the global geometries of grid `side`
│ │ │ │ +
158
│ │ │ │ +
159 // compute the coordinates of the subface's corners in codim 0 entity local coordinates
│ │ │ │ +
160 static constexpr int elementdim = GridGlue::template GridView<side>::template Codim<0>::Geometry::mydimension;
│ │ │ │ +
161
│ │ │ │ +
162 // coordinates within the subentity that contains the remote intersection
│ │ │ │ +
163 std::array<Dune::FieldVector< ctype, dim<side>() >, nSimplexCorners> corners_subEntity_local;
│ │ │ │ +
164
│ │ │ │ +
165 for (unsigned int par = 0; par < n_parents; ++par) {
│ │ │ │ +
166 for (int i = 0; i < nSimplexCorners; ++i)
│ │ │ │ +
167 corners_subEntity_local[i] = glue.merger_->template parentLocal<side>(mergeindex, i, par);
│ │ │ │ +
168
│ │ │ │ +
169 // Coordinates of the remote intersection corners wrt the element coordinate system
│ │ │ │ +
170 std::array<Dune::FieldVector<ctype, elementdim>, nSimplexCorners> corners_element_local;
│ │ │ │ +
171
│ │ │ │ +
172 if (data.gridlocal) {
│ │ │ │ +
173 data.gridindices[par] = glue.merger_->template parent<side>(mergeindex,par);
│ │ │ │ +
174
│ │ │ │ +
175 typename GridGlue::template GridPatch<side>::LocalGeometry
│ │ │ │ +
176 gridLocalGeometry = glue.template patch<side>().geometryLocal(data.gridindices[par]);
│ │ │ │ +
177 for (std::size_t i=0; i<corners_subEntity_local.size(); i++) {
│ │ │ │ +
178 corners_element_local[i] = gridLocalGeometry.global(corners_subEntity_local[i]);
│ │ │ │ +
179 }
│ │ │ │ +
180
│ │ │ │ +
181 // set the corners of the local geometry
│ │ │ │ +
182#ifdef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ +
183# if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ +
184 const Dune::GeometryType type = Dune::GeometryTypes::simplex(mydim);
│ │ │ │ +
185# else
│ │ │ │ +
186 const Dune::GeometryType type(Dune::GeometryType::simplex, mydim);
│ │ │ │ +
187# endif
│ │ │ │ +
188#else
│ │ │ │ +
189#error Not Implemented
│ │ │ │ +
190#endif
│ │ │ │ +
191 data.gridlocalgeom[par].emplace(type, corners_element_local);
│ │ │ │ +
192
│ │ │ │ +
193 // Add world geometry only for 0th parent
│ │ │ │ +
194 if (par == 0) {
│ │ │ │ +
195 typename GridGlue::template GridPatch<side>::Geometry
│ │ │ │ +
196 gridWorldGeometry = glue.template patch<side>().geometry(data.gridindices[par]);
│ │ │ │ +
197
│ │ │ │ +
198 // world coordinates of the remote intersection corners
│ │ │ │ +
199 std::array<Dune::FieldVector<ctype, GridGlue::template GridView<side>::dimensionworld>, nSimplexCorners> corners_global;
│ │ │ │ +
200
│ │ │ │ +
201 for (std::size_t i=0; i<corners_subEntity_local.size(); i++) {
│ │ │ │ +
202 corners_global[i] = gridWorldGeometry.global(corners_subEntity_local[i]);
│ │ │ │ +
203 }
│ │ │ │ +
204
│ │ │ │ +
205 data.gridgeom.emplace(type, corners_global);
│ │ │ │ +
206 }
│ │ │ │ +
207 }
│ │ │ │ +
208 }
│ │ │ │ +
209 }
│ │ │ │ +
210
│ │ │ │ +
212 template<typename P0, typename P1>
│ │ │ │ +
│ │ │ │ +
213 IntersectionData<P0, P1>::IntersectionData(const GridGlue& glue, unsigned int mergeindex, unsigned int offset,
│ │ │ │ +
214 bool grid0local, bool grid1local)
│ │ │ │ +
215 : index_(mergeindex+offset)
│ │ │ │ +
216 {
│ │ │ │ +
217 // if an invalid index is given do not proceed!
│ │ │ │ +
218 // (happens when the parent GridGlue initializes the "end"-Intersection)
│ │ │ │ +
219 assert (0 <= mergeindex || mergeindex < glue.index__sz);
│ │ │ │ +
220
│ │ │ │ +
221 std::get<0>(sideData_).gridlocal = grid0local;
│ │ │ │ +
222 std::get<1>(sideData_).gridlocal = grid1local;
│ │ │ │ +
223
│ │ │ │ +
224 initializeGeometry<0>(glue, mergeindex);
│ │ │ │ +
225 initializeGeometry<1>(glue, mergeindex);
│ │ │ │ +
226 }
│ │ │ │ +
│ │ │ │ +
227
│ │ │ │ +
232 template<typename P0, typename P1, int inside, int outside>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
234 {
│ │ │ │ + │ │ │ │ + │ │ │ │ +
237
│ │ │ │ +
238 using InsideGridView = typename GridGlue::template GridView<inside>;
│ │ │ │ +
239 using OutsideGridView = typename GridGlue::template GridView<outside>;
│ │ │ │ +
240
│ │ │ │ +
241 using InsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<inside>;
│ │ │ │ +
242 using OutsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<outside>;
│ │ │ │ +
243
│ │ │ │ +
244 using Geometry = typename IntersectionData::template GridGeometry<inside>;
│ │ │ │ +
245 using OutsideGeometry = typename IntersectionData::template GridGeometry<outside>;
│ │ │ │ +
246
│ │ │ │ +
247 static constexpr auto coorddim = IntersectionData::coorddim;
│ │ │ │ +
248 static constexpr auto mydim = IntersectionData::mydim;
│ │ │ │ +
249 static constexpr int insidePatch = inside;
│ │ │ │ +
250 static constexpr int outsidePatch = outside;
│ │ │ │ +
251
│ │ │ │ +
252 using ctype = typename GridGlue::ctype;
│ │ │ │ +
253 using LocalCoordinate = Dune::FieldVector<ctype, mydim>;
│ │ │ │ +
254 using GlobalCoordinate = Dune::FieldVector<ctype, coorddim>;
│ │ │ │ +
255 };
│ │ │ │ +
│ │ │ │ +
256
│ │ │ │ +
259 template<typename P0, typename P1, int I, int O>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
261 {
│ │ │ │ +
262
│ │ │ │ +
263 public:
│ │ │ │ +
264
│ │ │ │ + │ │ │ │ +
266
│ │ │ │ +
267 typedef typename Traits::GridGlue GridGlue;
│ │ │ │ + │ │ │ │ +
269
│ │ │ │ +
270
│ │ │ │ + │ │ │ │ + │ │ │ │ +
273
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
277
│ │ │ │ +
278 typedef typename Traits::Geometry Geometry;
│ │ │ │ +
279 typedef typename Traits::ctype ctype;
│ │ │ │ +
280
│ │ │ │ +
281 typedef typename InsideGridView::Traits::template Codim<0>::Entity InsideEntity;
│ │ │ │ +
282 typedef typename OutsideGridView::Traits::template Codim<0>::Entity OutsideEntity;
│ │ │ │ +
283
│ │ │ │ + │ │ │ │ + │ │ │ │ +
286
│ │ │ │ +
288 static constexpr auto coorddim = Traits::coorddim;
│ │ │ │ +
289
│ │ │ │ +
291 static constexpr auto mydim = Traits::mydim;
│ │ │ │ +
292
│ │ │ │ +
294 static constexpr int insidePatch = Traits::insidePatch;
│ │ │ │ +
295
│ │ │ │ +
297 static constexpr int outsidePatch = Traits::outsidePatch;
│ │ │ │ +
298
│ │ │ │ +
299 // typedef unsigned int IndexType;
│ │ │ │ +
300
│ │ │ │ +
301 private:
│ │ │ │ +
305 static constexpr int codimensionWorld = coorddim - mydim;
│ │ │ │ +
306
│ │ │ │ +
307 public:
│ │ │ │ +
308 /* C O N S T R U C T O R S */
│ │ │ │ +
309
│ │ │ │ +
│ │ │ │ +
311 Intersection(const GridGlue* glue, const IntersectionData* i) :
│ │ │ │ +
312 glue_(glue), i_(i) {}
│ │ │ │ +
│ │ │ │ +
313
│ │ │ │ +
314 /* F U N C T I O N A L I T Y */
│ │ │ │ +
315
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
319 inside(unsigned int parentId = 0) const
│ │ │ │ +
320 {
│ │ │ │ +
321 assert(self());
│ │ │ │ +
322 return glue_->template patch<I>().element(i_->template index<I>(parentId));
│ │ │ │ +
323 }
│ │ │ │ +
│ │ │ │ +
324
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
328 outside(unsigned int parentId = 0) const
│ │ │ │ +
329 {
│ │ │ │ +
330 assert(neighbor());
│ │ │ │ +
331 return glue_->template patch<O>().element(i_->template index<O>(parentId));
│ │ │ │ +
332 }
│ │ │ │ +
│ │ │ │ +
333
│ │ │ │ +
│ │ │ │ +
335 bool conforming() const
│ │ │ │ +
336 {
│ │ │ │ +
337 throw Dune::NotImplemented();
│ │ │ │ +
338 }
│ │ │ │ +
│ │ │ │ +
339
│ │ │ │ +
│ │ │ │ +
342 const InsideLocalGeometry& geometryInInside(unsigned int parentId = 0) const
│ │ │ │ +
343 {
│ │ │ │ +
344 return i_->template localGeometry<I>(parentId);
│ │ │ │ +
345 }
│ │ │ │ +
│ │ │ │ +
346
│ │ │ │ +
│ │ │ │ +
349 const OutsideLocalGeometry& geometryInOutside(unsigned int parentId = 0) const
│ │ │ │ +
350 {
│ │ │ │ +
351 return i_->template localGeometry<O>(parentId);
│ │ │ │ +
352 }
│ │ │ │ +
│ │ │ │ +
353
│ │ │ │ +
│ │ │ │ +
360 const Geometry& geometry() const
│ │ │ │ +
361 {
│ │ │ │ +
362 return i_->template geometry<I>();
│ │ │ │ +
363 }
│ │ │ │ +
│ │ │ │ +
364
│ │ │ │ +
│ │ │ │ +
371 const OutsideGeometry& geometryOutside() const // DUNE_DEPRECATED
│ │ │ │ +
372 {
│ │ │ │ +
373 return i_->template geometry<O>();
│ │ │ │ +
374 }
│ │ │ │ +
│ │ │ │ +
375
│ │ │ │ +
│ │ │ │ +
377 Dune::GeometryType type() const
│ │ │ │ +
378 {
│ │ │ │ +
379 #ifdef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ +
380 # if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ +
381 return Dune::GeometryTypes::simplex(mydim);
│ │ │ │ +
382 # else
│ │ │ │ +
383 static const Dune::GeometryType type(Dune::GeometryType::simplex, mydim);
│ │ │ │ +
384 return type;
│ │ │ │ +
385 # endif
│ │ │ │ +
386 #else
│ │ │ │ +
387 #error Not Implemented
│ │ │ │ +
388 #endif
│ │ │ │ +
389 }
│ │ │ │ +
│ │ │ │ +
390
│ │ │ │ +
391
│ │ │ │ +
│ │ │ │ +
393 bool self() const
│ │ │ │ +
394 {
│ │ │ │ +
395 return i_->template local<I>();
│ │ │ │ +
396 }
│ │ │ │ +
│ │ │ │ +
397
│ │ │ │ +
│ │ │ │ +
399 size_t neighbor(unsigned int g = 0) const
│ │ │ │ +
400 {
│ │ │ │ +
401 if (g == 0 && i_->template local<O>()) {
│ │ │ │ +
402 return i_->template parents<O>();
│ │ │ │ +
403 } else if (g == 1 && i_->template local<I>()) {
│ │ │ │ +
404 return i_->template parents<I>();
│ │ │ │ +
405 }
│ │ │ │ +
406 return 0;
│ │ │ │ +
407 }
│ │ │ │ +
│ │ │ │ +
408
│ │ │ │ +
│ │ │ │ +
410 int indexInInside(unsigned int parentId = 0) const
│ │ │ │ +
411 {
│ │ │ │ +
412 assert(self());
│ │ │ │ +
413 return glue_->template patch<I>().indexInInside(i_->template index<I>(parentId));
│ │ │ │ +
414 }
│ │ │ │ +
│ │ │ │ +
415
│ │ │ │ +
│ │ │ │ +
417 int indexInOutside(unsigned int parentId = 0) const
│ │ │ │ +
418 {
│ │ │ │ +
419 assert(neighbor());
│ │ │ │ +
420 return glue_->template patch<O>().indexInInside(i_->template index<O>(parentId));
│ │ │ │ +
421 }
│ │ │ │ +
│ │ │ │ +
422
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
428 {
│ │ │ │ +
429 GlobalCoordinate normal;
│ │ │ │ +
430
│ │ │ │ +
431 if (codimensionWorld == 0)
│ │ │ │ +
432 DUNE_THROW(Dune::Exception, "There is no normal vector to a full-dimensional intersection");
│ │ │ │ +
433 else if (codimensionWorld == 1) {
│ │ │ │ +
434 /* TODO: Implement the general n-ary cross product here */
│ │ │ │ +
435 const auto jacobianTransposed = geometry().jacobianTransposed(local);
│ │ │ │ +
436 if (mydim==1) {
│ │ │ │ +
437 normal[0] = - jacobianTransposed[0][1];
│ │ │ │ +
438 normal[1] = jacobianTransposed[0][0];
│ │ │ │ +
439 } else if (mydim==2) {
│ │ │ │ +
440 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][1]);
│ │ │ │ +
441 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][0]);
│ │ │ │ +
442 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - jacobianTransposed[0][1] * jacobianTransposed[1][0]);
│ │ │ │ +
443 } else
│ │ │ │ +
444 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for " << mydim << "-dimensional intersections yet");
│ │ │ │ +
445 } else
│ │ │ │ +
446 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for intersections with codim >= 2 yet");
│ │ │ │ +
447
│ │ │ │ +
448 return normal;
│ │ │ │ +
449 }
│ │ │ │ +
│ │ │ │ +
450
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
456 {
│ │ │ │ +
457 GlobalCoordinate normal = outerNormal(local);
│ │ │ │ +
458 normal /= normal.two_norm();
│ │ │ │ +
459 return normal;
│ │ │ │ +
460 }
│ │ │ │ +
│ │ │ │ +
461
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
467 {
│ │ │ │ +
468 return (unitOuterNormal(local) *= geometry().integrationElement(local));
│ │ │ │ +
469 }
│ │ │ │ +
│ │ │ │ +
470
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
476 {
│ │ │ │ +
477 return unitOuterNormal(ReferenceElements<ctype,mydim>::general(type()).position(0,0));
│ │ │ │ +
478 }
│ │ │ │ +
│ │ │ │ +
479
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
484 {
│ │ │ │ +
485 return Intersection<P0,P1,O,I>(glue_,i_);
│ │ │ │ +
486 }
│ │ │ │ +
│ │ │ │ +
487
│ │ │ │ +
488#ifdef QUICKHACK_INDEX
│ │ │ │ +
489 typedef typename GridGlue::IndexType IndexType;
│ │ │ │ +
490
│ │ │ │ +
491 IndexType index() const
│ │ │ │ +
492 {
│ │ │ │ +
493 return i_->index_;
│ │ │ │ +
494 }
│ │ │ │ +
495
│ │ │ │ +
496#endif
│ │ │ │ +
497
│ │ │ │ +
498 private:
│ │ │ │ +
499
│ │ │ │ +
500 friend class IntersectionIndexSet<P0,P1>;
│ │ │ │ +
501
│ │ │ │ +
502 /* M E M B E R V A R I A B L E S */
│ │ │ │ +
503
│ │ │ │ +
505 const GridGlue* glue_;
│ │ │ │ +
506
│ │ │ │ +
508 const IntersectionData* i_;
│ │ │ │ +
509 };
│ │ │ │ +
│ │ │ │ +
510
│ │ │ │ +
511
│ │ │ │ +
512 } // end namespace GridGlue
│ │ │ │ +
513} // end namespace Dune
│ │ │ │ +
514
│ │ │ │ +
515#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH
│ │ │ │
Central component of the module implementing the coupling of two grids.
│ │ │ │ -
Model of the Intersection concept provided by GridGlue.
│ │ │ │
Definition gridglue.hh:37
│ │ │ │
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │
unsigned int IndexType
Definition gridglue.hh:147
│ │ │ │ -
size_t size() const
Definition gridglue.hh:393
│ │ │ │ +
PromotionTraits< typenameGridView< 0 >::ctype, typenameGridView< 1 >::ctype >::PromotedType ctype
The type used for coordinates.
Definition gridglue.hh:171
│ │ │ │ +
static constexpr int dimworld
export the world dimension This is the maximum of the extractors' world dimensions.
Definition gridglue.hh:166
│ │ │ │ +
storage class for Dune::GridGlue::Intersection related data
Definition intersection.hh:38
│ │ │ │ +
GridGlue::IndexType IndexType
Definition intersection.hh:42
│ │ │ │ +
AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, GridGlue::template GridView< side >::dimensionworld > GridGeometry
Definition intersection.hh:65
│ │ │ │ +
const GridLocalGeometry< side > & localGeometry(unsigned int parentId=0) const
Definition intersection.hh:85
│ │ │ │ +
static constexpr int coorddim
Dimension of the world space of the intersection.
Definition intersection.hh:45
│ │ │ │ +
GridGeometry< 0 > Grid0Geometry
Definition intersection.hh:67
│ │ │ │ +
typename GridGlue::template GridView< side >::IndexSet::IndexType GridIndexType
Definition intersection.hh:71
│ │ │ │ +
IndexType index(unsigned int parentId=0) const
Definition intersection.hh:97
│ │ │ │ +
IndexType parents() const
Definition intersection.hh:101
│ │ │ │ +
GridLocalGeometry< 1 > Grid1LocalGeometry
Definition intersection.hh:61
│ │ │ │ +
const GridGeometry< side > & geometry() const
Definition intersection.hh:89
│ │ │ │ +
bool local() const
Definition intersection.hh:93
│ │ │ │ +
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition intersection.hh:40
│ │ │ │ +
static constexpr int mydim
Dimension of the intersection.
Definition intersection.hh:54
│ │ │ │ +
AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, GridGlue::template GridView< side >::dimension > GridLocalGeometry
Definition intersection.hh:58
│ │ │ │ +
GridLocalGeometry< 0 > Grid0LocalGeometry
Definition intersection.hh:60
│ │ │ │
IndexType index_
index of this intersection after GridGlue interface
Definition intersection.hh:112
│ │ │ │ +
GridIndexType< 1 > Grid1IndexType
Definition intersection.hh:74
│ │ │ │ +
GridGeometry< 1 > Grid1Geometry
Definition intersection.hh:68
│ │ │ │ +
GridIndexType< 0 > Grid0IndexType
Definition intersection.hh:73
│ │ │ │ +
IntersectionData()=default
Default Constructor.
│ │ │ │
The intersection of two entities of the two patches of a GridGlue.
Definition intersection.hh:261
│ │ │ │ -
Definition intersectionindexset.hh:20
│ │ │ │ -
SizeType size() const
Return total number of intersections.
Definition intersectionindexset.hh:41
│ │ │ │ -
GridGlue::IndexType IndexType
The type used for the indices.
Definition intersectionindexset.hh:27
│ │ │ │ -
IndexType index(const Intersection< P0, P1, I, O > &i) const
Map Dune::GridGlue::Intersection to index.
Definition intersectionindexset.hh:34
│ │ │ │ -
size_t SizeType
The type used for the size.
Definition intersectionindexset.hh:29
│ │ │ │ +
Traits::OutsideLocalGeometry OutsideLocalGeometry
Definition intersection.hh:275
│ │ │ │ +
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition intersection.hh:483
│ │ │ │ +
bool conforming() const
Return true if intersection is conforming.
Definition intersection.hh:335
│ │ │ │ +
InsideGridView::Traits::template Codim< 0 >::Entity InsideEntity
Definition intersection.hh:281
│ │ │ │ +
Traits::GridGlue GridGlue
Definition intersection.hh:267
│ │ │ │ +
int indexInOutside(unsigned int parentId=0) const
Local number of codim 1 entity in outside() Entity where intersection is contained in.
Definition intersection.hh:417
│ │ │ │ +
int indexInInside(unsigned int parentId=0) const
Local number of codim 1 entity in the inside() Entity where intersection is contained in.
Definition intersection.hh:410
│ │ │ │ +
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition intersection.hh:393
│ │ │ │ +
static constexpr auto mydim
dimension of the intersection
Definition intersection.hh:291
│ │ │ │ +
static constexpr int outsidePatch
outside patch
Definition intersection.hh:297
│ │ │ │ +
Dune::GeometryType type() const
Type of reference element for this intersection.
Definition intersection.hh:377
│ │ │ │ +
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition intersection.hh:319
│ │ │ │ +
Traits::LocalCoordinate LocalCoordinate
Definition intersection.hh:284
│ │ │ │ +
const OutsideLocalGeometry & geometryInOutside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the outside() element.
Definition intersection.hh:349
│ │ │ │ +
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return a unit outer normal.
Definition intersection.hh:455
│ │ │ │ +
Traits::ctype ctype
Definition intersection.hh:279
│ │ │ │ +
IntersectionTraits< P0, P1, I, O > Traits
Definition intersection.hh:265
│ │ │ │ +
Traits::IntersectionData IntersectionData
Definition intersection.hh:268
│ │ │ │ +
Traits::GlobalCoordinate GlobalCoordinate
Definition intersection.hh:285
│ │ │ │ +
Traits::OutsideGeometry OutsideGeometry
Definition intersection.hh:276
│ │ │ │ +
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition intersection.hh:399
│ │ │ │ +
Intersection(const GridGlue *glue, const IntersectionData *i)
Constructor for a given Dataset.
Definition intersection.hh:311
│ │ │ │ +
static constexpr int insidePatch
inside patch
Definition intersection.hh:294
│ │ │ │ +
Traits::Geometry Geometry
Definition intersection.hh:278
│ │ │ │ +
OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity
Definition intersection.hh:282
│ │ │ │ +
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition intersection.hh:328
│ │ │ │ +
const Geometry & geometry() const
Geometric information about this intersection as part of the inside grid.
Definition intersection.hh:360
│ │ │ │ +
Traits::InsideLocalGeometry InsideLocalGeometry
Definition intersection.hh:272
│ │ │ │ +
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition intersection.hh:427
│ │ │ │ +
const OutsideGeometry & geometryOutside() const
Geometric information about this intersection as part of the outside grid.
Definition intersection.hh:371
│ │ │ │ +
Traits::OutsideGridView OutsideGridView
Definition intersection.hh:274
│ │ │ │ +
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
Return an outer normal with the length of the integration element.
Definition intersection.hh:466
│ │ │ │ +
Traits::InsideGridView InsideGridView
Definition intersection.hh:271
│ │ │ │ +
const InsideLocalGeometry & geometryInInside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the inside() element.
Definition intersection.hh:342
│ │ │ │ +
GlobalCoordinate centerUnitOuterNormal() const
Unit outer normal at the center of the intersection.
Definition intersection.hh:475
│ │ │ │ +
static constexpr auto coorddim
dimension of the world space of the intersection
Definition intersection.hh:288
│ │ │ │ +
Definition intersection.hh:234
│ │ │ │ +
static constexpr int insidePatch
Definition intersection.hh:249
│ │ │ │ +
Dune::FieldVector< ctype, mydim > LocalCoordinate
Definition intersection.hh:253
│ │ │ │ +
static constexpr auto coorddim
Definition intersection.hh:247
│ │ │ │ +
typename IntersectionData::template GridGeometry< outside > OutsideGeometry
Definition intersection.hh:245
│ │ │ │ +
typename GridGlue::ctype ctype
Definition intersection.hh:252
│ │ │ │ +
typename GridGlue::template GridView< outside > OutsideGridView
Definition intersection.hh:239
│ │ │ │ +
Dune::FieldVector< ctype, coorddim > GlobalCoordinate
Definition intersection.hh:254
│ │ │ │ +
typename IntersectionData::template GridLocalGeometry< outside > OutsideLocalGeometry
Definition intersection.hh:242
│ │ │ │ +
typename GridGlue::template GridView< inside > InsideGridView
Definition intersection.hh:238
│ │ │ │ +
typename IntersectionData::template GridGeometry< inside > Geometry
Definition intersection.hh:244
│ │ │ │ +
typename IntersectionData::template GridLocalGeometry< inside > InsideLocalGeometry
Definition intersection.hh:241
│ │ │ │ +
static constexpr int outsidePatch
Definition intersection.hh:250
│ │ │ │ +
static constexpr auto mydim
Definition intersection.hh:248
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,105 +1,752 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -intersectionindexset.hh │ │ │ │ │ +intersection.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -_1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ +4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -3#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ │ -5 │ │ │ │ │ -6#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ -7#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ -8 │ │ │ │ │ -9#ifndef ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ -10// we currently support only one intersection type. If we want to support │ │ │ │ │ -more, │ │ │ │ │ -11// we have to think about the semantics of our IndexSet │ │ │ │ │ -12#error Not Implemented │ │ │ │ │ -13#endif │ │ │ │ │ -14 │ │ │ │ │ -15namespace _D_u_n_e { │ │ │ │ │ -16 namespace _G_r_i_d_G_l_u_e { │ │ │ │ │ +11#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH │ │ │ │ │ +12#define DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH │ │ │ │ │ +13 │ │ │ │ │ +14#include │ │ │ │ │ +15#include │ │ │ │ │ +16#include │ │ │ │ │ 17 │ │ │ │ │ -18 template │ │ │ │ │ -_1_9 class _I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t │ │ │ │ │ -20 { │ │ │ │ │ -21 friend class ::Dune::GridGlue::GridGlue; │ │ │ │ │ -22 typedef ::Dune::GridGlue::GridGlue _G_r_i_d_G_l_u_e; │ │ │ │ │ +18#include │ │ │ │ │ +19#include │ │ │ │ │ +20#include │ │ │ │ │ +21#include │ │ │ │ │ +22#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ 23 │ │ │ │ │ -24 public: │ │ │ │ │ +_2_4#define ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ 25 │ │ │ │ │ -_2_7 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e _I_n_d_e_x_T_y_p_e; │ │ │ │ │ -_2_9 typedef size_t _S_i_z_e_T_y_p_e; │ │ │ │ │ -30 │ │ │ │ │ -33 template │ │ │ │ │ -_3_4 _I_n_d_e_x_T_y_p_e _i_n_d_e_x (const _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_I_,_O_> & i) const │ │ │ │ │ -35 { │ │ │ │ │ -36 return i.i_->_i_n_d_e_x__; │ │ │ │ │ -37 } │ │ │ │ │ -38 │ │ │ │ │ -_4_1 _S_i_z_e_T_y_p_e _s_i_z_e () const │ │ │ │ │ -42 { │ │ │ │ │ -43 return glue_->_s_i_z_e(); │ │ │ │ │ -44 } │ │ │ │ │ -45 │ │ │ │ │ -46 private: │ │ │ │ │ -47 │ │ │ │ │ -49 _I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t(const _G_r_i_d_G_l_u_e * g) : │ │ │ │ │ -50 glue_(g) {} │ │ │ │ │ +26namespace _D_u_n_e { │ │ │ │ │ +27 namespace GridGlue { │ │ │ │ │ +28 │ │ │ │ │ +29 // forward declaration │ │ │ │ │ +30 template │ │ │ │ │ +31 class IntersectionIndexSet; │ │ │ │ │ +32 │ │ │ │ │ +36 template │ │ │ │ │ +_3_7 class _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ +38 { │ │ │ │ │ +39 public: │ │ │ │ │ +_4_0 typedef ::Dune::GridGlue::GridGlue _G_r_i_d_G_l_u_e; │ │ │ │ │ +41 │ │ │ │ │ +_4_2 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e _I_n_d_e_x_T_y_p_e; │ │ │ │ │ +43 │ │ │ │ │ +_4_5 static constexpr int _c_o_o_r_d_d_i_m = _G_r_i_d_G_l_u_e_:_:_d_i_m_w_o_r_l_d; │ │ │ │ │ +46 │ │ │ │ │ +47 private: │ │ │ │ │ +48 // intermediate quantities │ │ │ │ │ +49 template │ │ │ │ │ +50 static constexpr int dim() { return GridGlue::template GridView:: │ │ │ │ │ +Grid::dimension - GridGlue::template GridPatch::codim; } │ │ │ │ │ 51 │ │ │ │ │ -52 const GridGlue * glue_; │ │ │ │ │ -53 }; │ │ │ │ │ -54 │ │ │ │ │ -55 } // end namespace GridGlue │ │ │ │ │ -56} // end namespace Dune │ │ │ │ │ -57 │ │ │ │ │ -58#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ │ +52 public: │ │ │ │ │ +_5_4 static constexpr int _m_y_d_i_m = dim<0>() < dim<1>() ? dim<0>() : dim<1>(); │ │ │ │ │ +55 │ │ │ │ │ +56 template │ │ │ │ │ +_5_7 using _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y = AffineGeometry< │ │ │ │ │ +58 typename GridGlue::template GridView::ctype, _m_y_d_i_m, GridGlue::template │ │ │ │ │ +GridView::dimension>; │ │ │ │ │ +59 │ │ │ │ │ +_6_0 using _G_r_i_d_0_L_o_c_a_l_G_e_o_m_e_t_r_y [[deprecated("please use GridLocalGeometry<0> │ │ │ │ │ +instead")]] = _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_0_>; │ │ │ │ │ +_6_1 using _G_r_i_d_1_L_o_c_a_l_G_e_o_m_e_t_r_y [[deprecated("please use GridLocalGeometry<1> │ │ │ │ │ +instead")]] = _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_1_>; │ │ │ │ │ +62 │ │ │ │ │ +63 template │ │ │ │ │ +_6_4 using _G_r_i_d_G_e_o_m_e_t_r_y = AffineGeometry< │ │ │ │ │ +65 typename GridGlue::template GridView::ctype, _m_y_d_i_m, GridGlue::template │ │ │ │ │ +GridView::dimensionworld>; │ │ │ │ │ +66 │ │ │ │ │ +_6_7 using _G_r_i_d_0_G_e_o_m_e_t_r_y [[deprecated("please use GridGeometry<0> instead")]] = │ │ │ │ │ +_G_r_i_d_G_e_o_m_e_t_r_y_<_0_>; │ │ │ │ │ +_6_8 using _G_r_i_d_1_G_e_o_m_e_t_r_y [[deprecated("please use GridGeometry<1> instead")]] = │ │ │ │ │ +_G_r_i_d_G_e_o_m_e_t_r_y_<_1_>; │ │ │ │ │ +69 │ │ │ │ │ +70 template │ │ │ │ │ +_7_1 using _G_r_i_d_I_n_d_e_x_T_y_p_e = typename GridGlue::template GridView::IndexSet:: │ │ │ │ │ +IndexType; │ │ │ │ │ +72 │ │ │ │ │ +_7_3 using _G_r_i_d_0_I_n_d_e_x_T_y_p_e [[deprecated("please use GridIndexType<0> instead")]] = │ │ │ │ │ +_G_r_i_d_I_n_d_e_x_T_y_p_e_<_0_>; │ │ │ │ │ +_7_4 using _G_r_i_d_1_I_n_d_e_x_T_y_p_e [[deprecated("please use GridIndexType<1> instead")]] = │ │ │ │ │ +_G_r_i_d_I_n_d_e_x_T_y_p_e_<_1_>; │ │ │ │ │ +75 │ │ │ │ │ +77 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a(const _G_r_i_d_G_l_u_e& glue, unsigned int mergeindex, unsigned int │ │ │ │ │ +offset, bool grid0local, bool grid1local); │ │ │ │ │ +78 │ │ │ │ │ +_8_0 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a() = default; │ │ │ │ │ +81 │ │ │ │ │ +82 /* Accessor Functions */ │ │ │ │ │ +83 │ │ │ │ │ +84 template │ │ │ │ │ +_8_5 const _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_s_i_d_e_>& _l_o_c_a_l_G_e_o_m_e_t_r_y(unsigned int parentId = 0) │ │ │ │ │ +const │ │ │ │ │ +86 { return *std::get(sideData_).gridlocalgeom[parentId]; } │ │ │ │ │ +87 │ │ │ │ │ +88 template │ │ │ │ │ +_8_9 const _G_r_i_d_G_e_o_m_e_t_r_y_<_s_i_d_e_>& _g_e_o_m_e_t_r_y() const │ │ │ │ │ +90 { return *std::get(sideData_).gridgeom; } │ │ │ │ │ +91 │ │ │ │ │ +92 template │ │ │ │ │ +_9_3 bool _l_o_c_a_l() const │ │ │ │ │ +94 { return std::get(sideData_).gridlocal; } │ │ │ │ │ +95 │ │ │ │ │ +96 template │ │ │ │ │ +_9_7 _I_n_d_e_x_T_y_p_e _i_n_d_e_x(unsigned int parentId = 0) const │ │ │ │ │ +98 { return std::get(sideData_).gridindices[parentId]; } │ │ │ │ │ +99 │ │ │ │ │ +100 template │ │ │ │ │ +_1_0_1 _I_n_d_e_x_T_y_p_e _p_a_r_e_n_t_s() const │ │ │ │ │ +102 { return std::get(sideData_).gridindices.size(); } │ │ │ │ │ +103 │ │ │ │ │ +104 private: │ │ │ │ │ +105 template │ │ │ │ │ +106 void initializeGeometry(const _G_r_i_d_G_l_u_e& glue, unsigned mergeindex); │ │ │ │ │ +107 │ │ │ │ │ +108 /* M E M B E R V A R I A B L E S */ │ │ │ │ │ +109 │ │ │ │ │ +110 public: │ │ │ │ │ +_1_1_2 _I_n_d_e_x_T_y_p_e _i_n_d_e_x__; │ │ │ │ │ +113 │ │ │ │ │ +114 private: │ │ │ │ │ +115 template │ │ │ │ │ +116 struct SideData { │ │ │ │ │ +118 bool gridlocal = false; │ │ │ │ │ +119 │ │ │ │ │ +121 std::vector< GridIndexType > gridindices; │ │ │ │ │ +122 │ │ │ │ │ +124 std::vector< std::optional< GridLocalGeometry > > gridlocalgeom; │ │ │ │ │ +125 │ │ │ │ │ +133 std::optional< GridGeometry > gridgeom; │ │ │ │ │ +134 }; │ │ │ │ │ +135 │ │ │ │ │ +136 std::tuple< SideData<0>, SideData<1> > sideData_; │ │ │ │ │ +137 }; │ │ │ │ │ +138 │ │ │ │ │ +139 template │ │ │ │ │ +140 template │ │ │ │ │ +141 void IntersectionData::initializeGeometry(const GridGlue& glue, │ │ │ │ │ +unsigned mergeindex) │ │ │ │ │ +142 { │ │ │ │ │ +143 auto& data = std::get(sideData_); │ │ │ │ │ +144 │ │ │ │ │ +145 const unsigned n_parents = glue.merger_->template parents │ │ │ │ │ +(mergeindex); │ │ │ │ │ +146 │ │ │ │ │ +147 // init containers │ │ │ │ │ +148 data.gridindices.resize(n_parents); │ │ │ │ │ +149 data.gridlocalgeom.resize(n_parents); │ │ │ │ │ +150 │ │ │ │ │ +151 // default values │ │ │ │ │ +152 data.gridindices[0] = 0; │ │ │ │ │ +153 │ │ │ │ │ +154 static constexpr int nSimplexCorners = mydim + 1; │ │ │ │ │ +155 using ctype = typename _G_r_i_d_G_l_u_e_:_:_c_t_y_p_e; │ │ │ │ │ +156 │ │ │ │ │ +157 // initialize the local and the global geometries of grid `side` │ │ │ │ │ +158 │ │ │ │ │ +159 // compute the coordinates of the subface's corners in codim 0 entity local │ │ │ │ │ +coordinates │ │ │ │ │ +160 static constexpr int elementdim = GridGlue::template GridView:: │ │ │ │ │ +template Codim<0>::Geometry::mydimension; │ │ │ │ │ +161 │ │ │ │ │ +162 // coordinates within the subentity that contains the remote intersection │ │ │ │ │ +163 std::array() >, nSimplexCorners> │ │ │ │ │ +corners_subEntity_local; │ │ │ │ │ +164 │ │ │ │ │ +165 for (unsigned int par = 0; par < n_parents; ++par) { │ │ │ │ │ +166 for (int i = 0; i < nSimplexCorners; ++i) │ │ │ │ │ +167 corners_subEntity_local[i] = glue.merger_->template parentLocal │ │ │ │ │ +(mergeindex, i, par); │ │ │ │ │ +168 │ │ │ │ │ +169 // Coordinates of the remote intersection corners wrt the element │ │ │ │ │ +coordinate system │ │ │ │ │ +170 std::array, nSimplexCorners> │ │ │ │ │ +corners_element_local; │ │ │ │ │ +171 │ │ │ │ │ +172 if (data.gridlocal) { │ │ │ │ │ +173 data.gridindices[par] = glue.merger_->template parent │ │ │ │ │ +(mergeindex,par); │ │ │ │ │ +174 │ │ │ │ │ +175 typename GridGlue::template GridPatch::LocalGeometry │ │ │ │ │ +176 gridLocalGeometry = glue.template patch().geometryLocal │ │ │ │ │ +(data.gridindices[par]); │ │ │ │ │ +177 for (std::size_t i=0; i::Geometry │ │ │ │ │ +196 gridWorldGeometry = glue.template patch().geometry(data.gridindices │ │ │ │ │ +[par]); │ │ │ │ │ +197 │ │ │ │ │ +198 // world coordinates of the remote intersection corners │ │ │ │ │ +199 std::array:: │ │ │ │ │ +dimensionworld>, nSimplexCorners> corners_global; │ │ │ │ │ +200 │ │ │ │ │ +201 for (std::size_t i=0; i │ │ │ │ │ +_2_1_3 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_<_P_0_,_ _P_1_>_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a(const _G_r_i_d_G_l_u_e& glue, unsigned │ │ │ │ │ +int mergeindex, unsigned int offset, │ │ │ │ │ +214 bool grid0local, bool grid1local) │ │ │ │ │ +215 : index_(mergeindex+offset) │ │ │ │ │ +216 { │ │ │ │ │ +217 // if an invalid index is given do not proceed! │ │ │ │ │ +218 // (happens when the parent GridGlue initializes the "end"-Intersection) │ │ │ │ │ +219 assert (0 <= mergeindex || mergeindex < glue.index__sz); │ │ │ │ │ +220 │ │ │ │ │ +221 std::get<0>(sideData_).gridlocal = grid0local; │ │ │ │ │ +222 std::get<1>(sideData_).gridlocal = grid1local; │ │ │ │ │ +223 │ │ │ │ │ +224 initializeGeometry<0>(glue, mergeindex); │ │ │ │ │ +225 initializeGeometry<1>(glue, mergeindex); │ │ │ │ │ +226 } │ │ │ │ │ +227 │ │ │ │ │ +232 template │ │ │ │ │ +_2_3_3 struct _I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ │ +234 { │ │ │ │ │ +_2_3_5 using _G_r_i_d_G_l_u_e = _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>; │ │ │ │ │ +_2_3_6 using _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a = _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_<_P_0_,_ _P_1_>; │ │ │ │ │ +237 │ │ │ │ │ +_2_3_8 using _I_n_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ │ +_2_3_9 using _O_u_t_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ │ +240 │ │ │ │ │ +_2_4_1 using _I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ │ +GridLocalGeometry; │ │ │ │ │ +_2_4_2 using _O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ │ +GridLocalGeometry; │ │ │ │ │ +243 │ │ │ │ │ +_2_4_4 using _G_e_o_m_e_t_r_y = typename IntersectionData::template GridGeometry; │ │ │ │ │ +_2_4_5 using _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ │ +GridGeometry; │ │ │ │ │ +246 │ │ │ │ │ +_2_4_7 static constexpr auto _c_o_o_r_d_d_i_m = _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_c_o_o_r_d_d_i_m; │ │ │ │ │ +_2_4_8 static constexpr auto _m_y_d_i_m = _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_m_y_d_i_m; │ │ │ │ │ +_2_4_9 static constexpr int _i_n_s_i_d_e_P_a_t_c_h = inside; │ │ │ │ │ +_2_5_0 static constexpr int _o_u_t_s_i_d_e_P_a_t_c_h = outside; │ │ │ │ │ +251 │ │ │ │ │ +_2_5_2 using _c_t_y_p_e = typename _G_r_i_d_G_l_u_e_:_:_c_t_y_p_e; │ │ │ │ │ +_2_5_3 using _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e = Dune::FieldVector; │ │ │ │ │ +_2_5_4 using _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e = Dune::FieldVector; │ │ │ │ │ +255 }; │ │ │ │ │ +256 │ │ │ │ │ +259 template │ │ │ │ │ +_2_6_0 class _I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +261 { │ │ │ │ │ +262 │ │ │ │ │ +263 public: │ │ │ │ │ +264 │ │ │ │ │ +_2_6_5 typedef _I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_<_P_0_,_P_1_,_I_,_O_> _T_r_a_i_t_s; │ │ │ │ │ +266 │ │ │ │ │ +_2_6_7 typedef typename _T_r_a_i_t_s_:_:_G_r_i_d_G_l_u_e _G_r_i_d_G_l_u_e; │ │ │ │ │ +_2_6_8 typedef typename _T_r_a_i_t_s_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a; │ │ │ │ │ +269 │ │ │ │ │ +270 │ │ │ │ │ +_2_7_1 typedef typename _T_r_a_i_t_s_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w _I_n_s_i_d_e_G_r_i_d_V_i_e_w; │ │ │ │ │ +_2_7_2 typedef typename _T_r_a_i_t_s_:_:_I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y _I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y; │ │ │ │ │ +273 │ │ │ │ │ +_2_7_4 typedef typename _T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_r_i_d_V_i_e_w _O_u_t_s_i_d_e_G_r_i_d_V_i_e_w; │ │ │ │ │ +_2_7_5 typedef typename _T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y _O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y; │ │ │ │ │ +_2_7_6 typedef typename _T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y; │ │ │ │ │ +277 │ │ │ │ │ +_2_7_8 typedef typename _T_r_a_i_t_s_:_:_G_e_o_m_e_t_r_y _G_e_o_m_e_t_r_y; │ │ │ │ │ +_2_7_9 typedef typename _T_r_a_i_t_s_:_:_c_t_y_p_e _c_t_y_p_e; │ │ │ │ │ +280 │ │ │ │ │ +_2_8_1 typedef typename InsideGridView::Traits::template Codim<0>::Entity │ │ │ │ │ +_I_n_s_i_d_e_E_n_t_i_t_y; │ │ │ │ │ +_2_8_2 typedef typename OutsideGridView::Traits::template Codim<0>::Entity │ │ │ │ │ +_O_u_t_s_i_d_e_E_n_t_i_t_y; │ │ │ │ │ +283 │ │ │ │ │ +_2_8_4 typedef typename _T_r_a_i_t_s_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e; │ │ │ │ │ +_2_8_5 typedef typename _T_r_a_i_t_s_:_:_G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e; │ │ │ │ │ +286 │ │ │ │ │ +_2_8_8 static constexpr auto _c_o_o_r_d_d_i_m = _T_r_a_i_t_s_:_:_c_o_o_r_d_d_i_m; │ │ │ │ │ +289 │ │ │ │ │ +_2_9_1 static constexpr auto _m_y_d_i_m = _T_r_a_i_t_s_:_:_m_y_d_i_m; │ │ │ │ │ +292 │ │ │ │ │ +_2_9_4 static constexpr int _i_n_s_i_d_e_P_a_t_c_h = _T_r_a_i_t_s_:_:_i_n_s_i_d_e_P_a_t_c_h; │ │ │ │ │ +295 │ │ │ │ │ +_2_9_7 static constexpr int _o_u_t_s_i_d_e_P_a_t_c_h = _T_r_a_i_t_s_:_:_o_u_t_s_i_d_e_P_a_t_c_h; │ │ │ │ │ +298 │ │ │ │ │ +299 // typedef unsigned int IndexType; │ │ │ │ │ +300 │ │ │ │ │ +301 private: │ │ │ │ │ +305 static constexpr int codimensionWorld = _c_o_o_r_d_d_i_m - _m_y_d_i_m; │ │ │ │ │ +306 │ │ │ │ │ +307 public: │ │ │ │ │ +308 /* C O N S T R U C T O R S */ │ │ │ │ │ +309 │ │ │ │ │ +_3_1_1 _I_n_t_e_r_s_e_c_t_i_o_n(const _G_r_i_d_G_l_u_e* glue, const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a* i) : │ │ │ │ │ +312 glue_(glue), i_(i) {} │ │ │ │ │ +313 │ │ │ │ │ +314 /* F U N C T I O N A L I T Y */ │ │ │ │ │ +315 │ │ │ │ │ +318 _I_n_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ +_3_1_9 _i_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ +320 { │ │ │ │ │ +321 assert(_s_e_l_f()); │ │ │ │ │ +322 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ │ +323 } │ │ │ │ │ +324 │ │ │ │ │ +327 _O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ +_3_2_8 _o_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ +329 { │ │ │ │ │ +330 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ │ +331 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ │ +332 } │ │ │ │ │ +333 │ │ │ │ │ +_3_3_5 bool _c_o_n_f_o_r_m_i_n_g() const │ │ │ │ │ +336 { │ │ │ │ │ +337 throw Dune::NotImplemented(); │ │ │ │ │ +338 } │ │ │ │ │ +339 │ │ │ │ │ +_3_4_2 const _I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y_I_n_I_n_s_i_d_e(unsigned int parentId = 0) │ │ │ │ │ +const │ │ │ │ │ +343 { │ │ │ │ │ +344 return i_->template localGeometry(parentId); │ │ │ │ │ +345 } │ │ │ │ │ +346 │ │ │ │ │ +_3_4_9 const _O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y_I_n_O_u_t_s_i_d_e(unsigned int parentId = 0) │ │ │ │ │ +const │ │ │ │ │ +350 { │ │ │ │ │ +351 return i_->template localGeometry(parentId); │ │ │ │ │ +352 } │ │ │ │ │ +353 │ │ │ │ │ +_3_6_0 const _G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y() const │ │ │ │ │ +361 { │ │ │ │ │ +362 return i_->template geometry(); │ │ │ │ │ +363 } │ │ │ │ │ +364 │ │ │ │ │ +_3_7_1 const _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y_O_u_t_s_i_d_e() const // DUNE_DEPRECATED │ │ │ │ │ +372 { │ │ │ │ │ +373 return i_->template geometry(); │ │ │ │ │ +374 } │ │ │ │ │ +375 │ │ │ │ │ +_3_7_7 Dune::GeometryType _t_y_p_e() const │ │ │ │ │ +378 { │ │ │ │ │ +379 #ifdef ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ +380 # if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6) │ │ │ │ │ +381 return Dune::GeometryTypes::simplex(_m_y_d_i_m); │ │ │ │ │ +382 # else │ │ │ │ │ +383 static const Dune::GeometryType _t_y_p_e(Dune::GeometryType::simplex, _m_y_d_i_m); │ │ │ │ │ +384 return _t_y_p_e; │ │ │ │ │ +385 # endif │ │ │ │ │ +386 #else │ │ │ │ │ +387 #error Not Implemented │ │ │ │ │ +388 #endif │ │ │ │ │ +389 } │ │ │ │ │ +390 │ │ │ │ │ +391 │ │ │ │ │ +_3_9_3 bool _s_e_l_f() const │ │ │ │ │ +394 { │ │ │ │ │ +395 return i_->template local(); │ │ │ │ │ +396 } │ │ │ │ │ +397 │ │ │ │ │ +_3_9_9 size_t _n_e_i_g_h_b_o_r(unsigned int g = 0) const │ │ │ │ │ +400 { │ │ │ │ │ +401 if (g == 0 && i_->template local()) { │ │ │ │ │ +402 return i_->template parents(); │ │ │ │ │ +403 } else if (g == 1 && i_->template local()) { │ │ │ │ │ +404 return i_->template parents(); │ │ │ │ │ +405 } │ │ │ │ │ +406 return 0; │ │ │ │ │ +407 } │ │ │ │ │ +408 │ │ │ │ │ +_4_1_0 int _i_n_d_e_x_I_n_I_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ +411 { │ │ │ │ │ +412 assert(_s_e_l_f()); │ │ │ │ │ +413 return glue_->template patch().indexInInside(i_->template index │ │ │ │ │ +(parentId)); │ │ │ │ │ +414 } │ │ │ │ │ +415 │ │ │ │ │ +_4_1_7 int _i_n_d_e_x_I_n_O_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ │ +418 { │ │ │ │ │ +419 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ │ +420 return glue_->template patch().indexInInside(i_->template index │ │ │ │ │ +(parentId)); │ │ │ │ │ +421 } │ │ │ │ │ +422 │ │ │ │ │ +_4_2_7 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _o_u_t_e_r_N_o_r_m_a_l(const _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e &local) const │ │ │ │ │ +428 { │ │ │ │ │ +429 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e normal; │ │ │ │ │ +430 │ │ │ │ │ +431 if (codimensionWorld == 0) │ │ │ │ │ +432 DUNE_THROW(Dune::Exception, "There is no normal vector to a full- │ │ │ │ │ +dimensional intersection"); │ │ │ │ │ +433 else if (codimensionWorld == 1) { │ │ │ │ │ +434 /* TODO: Implement the general n-ary cross product here */ │ │ │ │ │ +435 const auto jacobianTransposed = _g_e_o_m_e_t_r_y().jacobianTransposed(local); │ │ │ │ │ +436 if (_m_y_d_i_m==1) { │ │ │ │ │ +437 normal[0] = - jacobianTransposed[0][1]; │ │ │ │ │ +438 normal[1] = jacobianTransposed[0][0]; │ │ │ │ │ +439 } else if (_m_y_d_i_m==2) { │ │ │ │ │ +440 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - │ │ │ │ │ +jacobianTransposed[0][2] * jacobianTransposed[1][1]); │ │ │ │ │ +441 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - │ │ │ │ │ +jacobianTransposed[0][2] * jacobianTransposed[1][0]); │ │ │ │ │ +442 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - │ │ │ │ │ +jacobianTransposed[0][1] * jacobianTransposed[1][0]); │ │ │ │ │ +443 } else │ │ │ │ │ +444 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ │ +'outerNormal' method for " << _m_y_d_i_m << "-dimensional intersections yet"); │ │ │ │ │ +445 } else │ │ │ │ │ +446 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ │ +'outerNormal' method for intersections with codim >= 2 yet"); │ │ │ │ │ +447 │ │ │ │ │ +448 return normal; │ │ │ │ │ +449 } │ │ │ │ │ +450 │ │ │ │ │ +_4_5_5 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _u_n_i_t_O_u_t_e_r_N_o_r_m_a_l(const _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e &local) const │ │ │ │ │ +456 { │ │ │ │ │ +457 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e normal = _o_u_t_e_r_N_o_r_m_a_l(local); │ │ │ │ │ +458 normal /= normal.two_norm(); │ │ │ │ │ +459 return normal; │ │ │ │ │ +460 } │ │ │ │ │ +461 │ │ │ │ │ +_4_6_6 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _i_n_t_e_g_r_a_t_i_o_n_O_u_t_e_r_N_o_r_m_a_l(const _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e &local) const │ │ │ │ │ +467 { │ │ │ │ │ +468 return (_u_n_i_t_O_u_t_e_r_N_o_r_m_a_l(local) *= _g_e_o_m_e_t_r_y().integrationElement(local)); │ │ │ │ │ +469 } │ │ │ │ │ +470 │ │ │ │ │ +_4_7_5 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e _c_e_n_t_e_r_U_n_i_t_O_u_t_e_r_N_o_r_m_a_l () const │ │ │ │ │ +476 { │ │ │ │ │ +477 return _u_n_i_t_O_u_t_e_r_N_o_r_m_a_l(ReferenceElements::general(_t_y_p_e │ │ │ │ │ +()).position(0,0)); │ │ │ │ │ +478 } │ │ │ │ │ +479 │ │ │ │ │ +_4_8_3 _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_> _f_l_i_p() const │ │ │ │ │ +484 { │ │ │ │ │ +485 return _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_>(glue_,i_); │ │ │ │ │ +486 } │ │ │ │ │ +487 │ │ │ │ │ +488#ifdef QUICKHACK_INDEX │ │ │ │ │ +489 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e IndexType; │ │ │ │ │ +490 │ │ │ │ │ +491 IndexType index() const │ │ │ │ │ +492 { │ │ │ │ │ +493 return i_->_i_n_d_e_x__; │ │ │ │ │ +494 } │ │ │ │ │ +495 │ │ │ │ │ +496#endif │ │ │ │ │ +497 │ │ │ │ │ +498 private: │ │ │ │ │ +499 │ │ │ │ │ +500 friend class IntersectionIndexSet; │ │ │ │ │ +501 │ │ │ │ │ +502 /* M E M B E R V A R I A B L E S */ │ │ │ │ │ +503 │ │ │ │ │ +505 const _G_r_i_d_G_l_u_e* glue_; │ │ │ │ │ +506 │ │ │ │ │ +508 const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a* i_; │ │ │ │ │ +509 }; │ │ │ │ │ +510 │ │ │ │ │ +511 │ │ │ │ │ +512 } // end namespace GridGlue │ │ │ │ │ +513} // end namespace Dune │ │ │ │ │ +514 │ │ │ │ │ +515#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH │ │ │ │ │ _g_r_i_d_g_l_u_e_._h_h │ │ │ │ │ Central component of the module implementing the coupling of two grids. │ │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ -Model of the Intersection concept provided by GridGlue. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ unsigned int IndexType │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:147 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_s_i_z_e │ │ │ │ │ -size_t size() const │ │ │ │ │ -DDeeffiinniittiioonn gridglue.hh:393 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_c_t_y_p_e │ │ │ │ │ +PromotionTraits< typenameGridView< 0 >::ctype, typenameGridView< 1 >::ctype >:: │ │ │ │ │ +PromotedType ctype │ │ │ │ │ +The type used for coordinates. │ │ │ │ │ +DDeeffiinniittiioonn gridglue.hh:171 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ +static constexpr int dimworld │ │ │ │ │ +export the world dimension This is the maximum of the extractors' world │ │ │ │ │ +dimensions. │ │ │ │ │ +DDeeffiinniittiioonn gridglue.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ +storage class for Dune::GridGlue::Intersection related data │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ +GridGlue::IndexType IndexType │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:42 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_G_e_o_m_e_t_r_y │ │ │ │ │ +AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, │ │ │ │ │ +GridGlue::template GridView< side >::dimensionworld > GridGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:65 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_l_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +const GridLocalGeometry< side > & localGeometry(unsigned int parentId=0) const │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:85 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_c_o_o_r_d_d_i_m │ │ │ │ │ +static constexpr int coorddim │ │ │ │ │ +Dimension of the world space of the intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_0_G_e_o_m_e_t_r_y │ │ │ │ │ +GridGeometry< 0 > Grid0Geometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_I_n_d_e_x_T_y_p_e │ │ │ │ │ +typename GridGlue::template GridView< side >::IndexSet::IndexType GridIndexType │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:71 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_i_n_d_e_x │ │ │ │ │ +IndexType index(unsigned int parentId=0) const │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:97 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_p_a_r_e_n_t_s │ │ │ │ │ +IndexType parents() const │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:101 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_1_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +GridLocalGeometry< 1 > Grid1LocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_g_e_o_m_e_t_r_y │ │ │ │ │ +const GridGeometry< side > & geometry() const │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:89 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_l_o_c_a_l │ │ │ │ │ +bool local() const │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ +::Dune::GridGlue::GridGlue< P0, P1 > GridGlue │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_m_y_d_i_m │ │ │ │ │ +static constexpr int mydim │ │ │ │ │ +Dimension of the intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +AffineGeometry< typename GridGlue::template GridView< side >::ctype, mydim, │ │ │ │ │ +GridGlue::template GridView< side >::dimension > GridLocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_0_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +GridLocalGeometry< 0 > Grid0LocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:60 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_i_n_d_e_x__ │ │ │ │ │ IndexType index_ │ │ │ │ │ index of this intersection after GridGlue interface │ │ │ │ │ DDeeffiinniittiioonn intersection.hh:112 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_1_I_n_d_e_x_T_y_p_e │ │ │ │ │ +GridIndexType< 1 > Grid1IndexType │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_1_G_e_o_m_e_t_r_y │ │ │ │ │ +GridGeometry< 1 > Grid1Geometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:68 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_G_r_i_d_0_I_n_d_e_x_T_y_p_e │ │ │ │ │ +GridIndexType< 0 > Grid0IndexType │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ +IntersectionData()=default │ │ │ │ │ +Default Constructor. │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ The intersection of two entities of the two patches of a GridGlue. │ │ │ │ │ DDeeffiinniittiioonn intersection.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t │ │ │ │ │ -DDeeffiinniittiioonn intersectionindexset.hh:20 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_s_i_z_e │ │ │ │ │ -SizeType size() const │ │ │ │ │ -Return total number of intersections. │ │ │ │ │ -DDeeffiinniittiioonn intersectionindexset.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ -GridGlue::IndexType IndexType │ │ │ │ │ -The type used for the indices. │ │ │ │ │ -DDeeffiinniittiioonn intersectionindexset.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_i_n_d_e_x │ │ │ │ │ -IndexType index(const Intersection< P0, P1, I, O > &i) const │ │ │ │ │ -Map Dune::GridGlue::Intersection to index. │ │ │ │ │ -DDeeffiinniittiioonn intersectionindexset.hh:34 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_S_i_z_e_T_y_p_e │ │ │ │ │ -size_t SizeType │ │ │ │ │ -The type used for the size. │ │ │ │ │ -DDeeffiinniittiioonn intersectionindexset.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +Traits::OutsideLocalGeometry OutsideLocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_f_l_i_p │ │ │ │ │ +Intersection< P0, P1, O, I > flip() const │ │ │ │ │ +Return a copy of the intersection with inside and outside switched. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:483 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_o_n_f_o_r_m_i_n_g │ │ │ │ │ +bool conforming() const │ │ │ │ │ +Return true if intersection is conforming. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:335 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ +InsideGridView::Traits::template Codim< 0 >::Entity InsideEntity │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ +Traits::GridGlue GridGlue │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:267 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_d_e_x_I_n_O_u_t_s_i_d_e │ │ │ │ │ +int indexInOutside(unsigned int parentId=0) const │ │ │ │ │ +Local number of codim 1 entity in outside() Entity where intersection is │ │ │ │ │ +contained in. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:417 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_d_e_x_I_n_I_n_s_i_d_e │ │ │ │ │ +int indexInInside(unsigned int parentId=0) const │ │ │ │ │ +Local number of codim 1 entity in the inside() Entity where intersection is │ │ │ │ │ +contained in. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:410 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_s_e_l_f │ │ │ │ │ +bool self() const │ │ │ │ │ +For parallel computations: Return true if inside() entity exists locally. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:393 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_m_y_d_i_m │ │ │ │ │ +static constexpr auto mydim │ │ │ │ │ +dimension of the intersection │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:291 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_s_i_d_e_P_a_t_c_h │ │ │ │ │ +static constexpr int outsidePatch │ │ │ │ │ +outside patch │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:297 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_t_y_p_e │ │ │ │ │ +Dune::GeometryType type() const │ │ │ │ │ +Type of reference element for this intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:377 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_s_i_d_e │ │ │ │ │ +InsideEntity inside(unsigned int parentId=0) const │ │ │ │ │ +Return element on the inside of this intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:319 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ +Traits::LocalCoordinate LocalCoordinate │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:284 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y_I_n_O_u_t_s_i_d_e │ │ │ │ │ +const OutsideLocalGeometry & geometryInOutside(unsigned int parentId=0) const │ │ │ │ │ +Geometric information about this intersection in local coordinates of the │ │ │ │ │ +outside() element. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:349 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_u_n_i_t_O_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ +GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const │ │ │ │ │ +Return a unit outer normal. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:455 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_t_y_p_e │ │ │ │ │ +Traits::ctype ctype │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:279 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_T_r_a_i_t_s │ │ │ │ │ +IntersectionTraits< P0, P1, I, O > Traits │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:265 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ +Traits::IntersectionData IntersectionData │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:268 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ +Traits::GlobalCoordinate GlobalCoordinate │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:285 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y │ │ │ │ │ +Traits::OutsideGeometry OutsideGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_n_e_i_g_h_b_o_r │ │ │ │ │ +size_t neighbor(unsigned int g=0) const │ │ │ │ │ +Return number of embeddings into local grid0 (grid1) entities. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:399 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +Intersection(const GridGlue *glue, const IntersectionData *i) │ │ │ │ │ +Constructor for a given Dataset. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:311 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_s_i_d_e_P_a_t_c_h │ │ │ │ │ +static constexpr int insidePatch │ │ │ │ │ +inside patch │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:294 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_G_e_o_m_e_t_r_y │ │ │ │ │ +Traits::Geometry Geometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:278 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ │ +OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_s_i_d_e │ │ │ │ │ +OutsideEntity outside(unsigned int parentId=0) const │ │ │ │ │ +Return element on the outside of this intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:328 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y │ │ │ │ │ +const Geometry & geometry() const │ │ │ │ │ +Geometric information about this intersection as part of the inside grid. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:360 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +Traits::InsideLocalGeometry InsideLocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:272 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ +GlobalCoordinate outerNormal(const LocalCoordinate &local) const │ │ │ │ │ +Return an outer normal (length not necessarily 1) │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:427 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y_O_u_t_s_i_d_e │ │ │ │ │ +const OutsideGeometry & geometryOutside() const │ │ │ │ │ +Geometric information about this intersection as part of the outside grid. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:371 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_O_u_t_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ +Traits::OutsideGridView OutsideGridView │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:274 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_t_e_g_r_a_t_i_o_n_O_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ +GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const │ │ │ │ │ +Return an outer normal with the length of the integration element. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:466 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ +Traits::InsideGridView InsideGridView │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:271 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_g_e_o_m_e_t_r_y_I_n_I_n_s_i_d_e │ │ │ │ │ +const InsideLocalGeometry & geometryInInside(unsigned int parentId=0) const │ │ │ │ │ +Geometric information about this intersection in local coordinates of the │ │ │ │ │ +inside() element. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:342 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_e_n_t_e_r_U_n_i_t_O_u_t_e_r_N_o_r_m_a_l │ │ │ │ │ +GlobalCoordinate centerUnitOuterNormal() const │ │ │ │ │ +Unit outer normal at the center of the intersection. │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:475 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_c_o_o_r_d_d_i_m │ │ │ │ │ +static constexpr auto coorddim │ │ │ │ │ +dimension of the world space of the intersection │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:288 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:234 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_i_n_s_i_d_e_P_a_t_c_h │ │ │ │ │ +static constexpr int insidePatch │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:249 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ +Dune::FieldVector< ctype, mydim > LocalCoordinate │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:253 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_o_r_d_d_i_m │ │ │ │ │ +static constexpr auto coorddim │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:247 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y │ │ │ │ │ +typename IntersectionData::template GridGeometry< outside > OutsideGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:245 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_c_t_y_p_e │ │ │ │ │ +typename GridGlue::ctype ctype │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:252 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ +typename GridGlue::template GridView< outside > OutsideGridView │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:239 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ │ +Dune::FieldVector< ctype, coorddim > GlobalCoordinate │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:254 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_O_u_t_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +typename IntersectionData::template GridLocalGeometry< outside > │ │ │ │ │ +OutsideLocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:242 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ │ +typename GridGlue::template GridView< inside > InsideGridView │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:238 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_G_e_o_m_e_t_r_y │ │ │ │ │ +typename IntersectionData::template GridGeometry< inside > Geometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:244 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_I_n_s_i_d_e_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +typename IntersectionData::template GridLocalGeometry< inside > │ │ │ │ │ +InsideLocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:241 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_o_u_t_s_i_d_e_P_a_t_c_h │ │ │ │ │ +static constexpr int outsidePatch │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:250 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_:_:_m_y_d_i_m │ │ │ │ │ +static constexpr auto mydim │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:248 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridglueamirawriter.hh File Reference │ │ │ │ +dune-grid-glue: gridgluevtkwriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,41 +72,46 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
gridglueamirawriter.hh File Reference
│ │ │ │ +
gridgluevtkwriter.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Write all remote intersections to a AmiraMesh file. │ │ │ │ +

Write all remote intersections to a vtk file for debugging. │ │ │ │ More...

│ │ │ │
#include <fstream>
│ │ │ │ -#include <sstream>
│ │ │ │ +#include <iomanip>
│ │ │ │ #include <type_traits>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <dune/common/classname.hh>
│ │ │ │ +#include <dune/geometry/type.hh>
│ │ │ │ +#include <dune/geometry/referenceelements.hh>
│ │ │ │ +#include <dune/grid-glue/gridglue.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GridGlue::GridGlueAmiraWriter
 Write remote intersections to a AmiraMesh file for debugging purposes. More...
class  Dune::GridGlue::GridGlueVtkWriter
 Write remote intersections to a vtk file for debugging purposes. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

Write all remote intersections to a AmiraMesh file.

│ │ │ │ +

Write all remote intersections to a vtk file for debugging.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,27 +2,32 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -gridglueamirawriter.hh File Reference │ │ │ │ │ -Write all remote intersections to a AmiraMesh file. _M_o_r_e_._._. │ │ │ │ │ +gridgluevtkwriter.hh File Reference │ │ │ │ │ +Write all remote intersections to a vtk file for debugging. _M_o_r_e_._._. │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r │ │ │ │ │ -  Write remote intersections to a AmiraMesh file for debugging purposes. │ │ │ │ │ +class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r │ │ │ │ │ +  Write remote intersections to a vtk file for debugging purposes. │ │ │ │ │ _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Write all remote intersections to a AmiraMesh file. │ │ │ │ │ +Write all remote intersections to a vtk file for debugging. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridglueamirawriter.hh Source File │ │ │ │ +dune-grid-glue: gridgluevtkwriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,166 +74,318 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
gridglueamirawriter.hh
│ │ │ │ +
gridgluevtkwriter.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
│ │ │ │ -
9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
│ │ │ │ -
10
│ │ │ │ -
11#include <fstream>
│ │ │ │ -
12#include <sstream>
│ │ │ │ -
13#include <type_traits>
│ │ │ │ -
14
│ │ │ │ -
15namespace Dune {
│ │ │ │ -
16namespace GridGlue {
│ │ │ │ -
17
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
21{
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ +
5/*
│ │ │ │ +
6 * Filename: GridGlueVtkWriter.hh
│ │ │ │ +
7 * Version: 1.0
│ │ │ │ +
8 * Created on: Mar 5, 2009
│ │ │ │ +
9 * Author: Gerrit Buse
│ │ │ │ +
10 * ---------------------------------
│ │ │ │ +
11 * Project: dune-grid-glue
│ │ │ │ +
12 * Description: Class thought to make graphical debugging of couplings easier.
│ │ │ │ +
13 *
│ │ │ │ +
14 */
│ │ │ │ +
20#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH
│ │ │ │ +
21#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH
│ │ │ │
22
│ │ │ │ -
26 template <class Glue, int side>
│ │ │ │ -
27 static void writeIntersections(const Glue& glue, const std::string& filename)
│ │ │ │ -
28 {
│ │ │ │ -
29 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
│ │ │ │ -
30
│ │ │ │ -
31 std::ofstream fgrid;
│ │ │ │ +
23
│ │ │ │ +
24#include <fstream>
│ │ │ │ +
25#include <iomanip>
│ │ │ │ +
26#include <type_traits>
│ │ │ │ +
27#include <vector>
│ │ │ │ +
28
│ │ │ │ +
29#include <dune/common/classname.hh>
│ │ │ │ +
30#include <dune/geometry/type.hh>
│ │ │ │ +
31#include <dune/geometry/referenceelements.hh>
│ │ │ │
32
│ │ │ │ -
33 fgrid.open(filename.c_str());
│ │ │ │ + │ │ │ │
34
│ │ │ │ -
35 using GridView = typename Glue::template GridView<side>;
│ │ │ │ -
36 const int dim = GridView::dimension;
│ │ │ │ -
37 const int domdimw = GridView::dimensionworld;
│ │ │ │ -
38
│ │ │ │ -
39 // coordinates have to be in R^3 in the VTK format
│ │ │ │ -
40 std::string coordinatePadding;
│ │ │ │ -
41 for (int i=domdimw; i<3; i++)
│ │ │ │ -
42 coordinatePadding += " 0";
│ │ │ │ -
43
│ │ │ │ -
44 int overlaps = glue.size();
│ │ │ │ -
45
│ │ │ │ -
46 if (dim==3) {
│ │ │ │ -
47
│ │ │ │ -
48 fgrid << "# HyperSurface 0.1 ASCII \n" << std::endl;
│ │ │ │ -
49 fgrid<<"\n";
│ │ │ │ -
50 fgrid<<"Parameters {\n";
│ │ │ │ -
51 fgrid<<" Materials {\n";
│ │ │ │ -
52 fgrid<<" outside {\n";
│ │ │ │ -
53 fgrid<<" Id 0\n";
│ │ │ │ -
54 fgrid<<" }\n";
│ │ │ │ -
55 fgrid<<" inside {\n";
│ │ │ │ -
56 fgrid<<" Id 1\n";
│ │ │ │ -
57 fgrid<<" }\n";
│ │ │ │ -
58 fgrid<<" }\n";
│ │ │ │ -
59 fgrid<<"\n";
│ │ │ │ -
60 fgrid<<"}\n";
│ │ │ │ -
61
│ │ │ │ -
62 // ////////////////////////////////////////////
│ │ │ │ -
63 // Write vertices
│ │ │ │ -
64 // ////////////////////////////////////////////
│ │ │ │ -
65
│ │ │ │ -
66 //use dim and not dim+1
│ │ │ │ -
67 fgrid<<"\nVertices "<< overlaps*(dim)<<"\n";
│ │ │ │ -
68 auto isEnd = glue.template iend<side>();
│ │ │ │ -
69 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt)
│ │ │ │ -
70 {
│ │ │ │ -
71 const auto& geometry = isIt->geometry();
│ │ │ │ -
72 for (int i = 0; i < geometry.corners(); ++i)
│ │ │ │ -
73 fgrid << geometry.corner(i) << coordinatePadding << std::endl;
│ │ │ │ -
74 }
│ │ │ │ -
75
│ │ │ │ -
76 // ////////////////////////////////////////////
│ │ │ │ -
77 // Write triangles
│ │ │ │ -
78 // ////////////////////////////////////////////
│ │ │ │ -
79
│ │ │ │ -
80 fgrid<<"NBranchingPoints 0\n";
│ │ │ │ -
81 fgrid<<"NVerticesOnCurves 0\n";
│ │ │ │ -
82 fgrid<<"BoundaryCurves 0\n";
│ │ │ │ -
83 fgrid<<"Patches 1\n";
│ │ │ │ -
84 fgrid<<"{\n";
│ │ │ │ -
85 fgrid<<"InnerRegion inside\n";
│ │ │ │ -
86 fgrid<<"OuterRegion outside\n";
│ │ │ │ -
87 fgrid<<"BoundaryID 0\n";
│ │ │ │ -
88 fgrid<<"BranchingPoints 0";
│ │ │ │ -
89 fgrid<<"\n";
│ │ │ │ +
35namespace Dune {
│ │ │ │ +
36namespace GridGlue {
│ │ │ │ +
37
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
41{
│ │ │ │ +
42
│ │ │ │ +
46 template <class Glue, int side>
│ │ │ │ +
47 static void writeExtractedPart(const Glue& glue, const std::string& filename)
│ │ │ │ +
48 {
│ │ │ │ +
49 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
│ │ │ │ +
50
│ │ │ │ +
51 std::ofstream fgrid;
│ │ │ │ +
52
│ │ │ │ +
53 fgrid.open(filename.c_str());
│ │ │ │ +
54
│ │ │ │ +
55 using GridView = typename Glue::template GridView<side>;
│ │ │ │ +
56 using Extractor = typename Glue::template GridPatch<side>;
│ │ │ │ +
57
│ │ │ │ +
58 typedef typename GridView::ctype ctype;
│ │ │ │ +
59
│ │ │ │ +
60 const int domdimw = GridView::dimensionworld;
│ │ │ │ +
61 const int patchDim = Extractor::dim - Extractor::codim;
│ │ │ │ +
62
│ │ │ │ +
63 // coordinates have to be in R^3 in the VTK format
│ │ │ │ +
64 std::string coordinatePadding;
│ │ │ │ +
65 for (int i=domdimw; i<3; i++)
│ │ │ │ +
66 coordinatePadding += " 0";
│ │ │ │ +
67
│ │ │ │ +
68 fgrid << "# vtk DataFile Version 2.0\nFilename: " << filename << "\nASCII" << std::endl;
│ │ │ │ +
69
│ │ │ │ +
70 // WRITE POINTS
│ │ │ │ +
71 // ----------------
│ │ │ │ +
72 std::vector<typename Extractor::Coords> coords;
│ │ │ │ +
73 glue.template patch<side>().getCoords(coords);
│ │ │ │ +
74
│ │ │ │ +
75 fgrid << ((patchDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET POLYDATA") << std::endl;
│ │ │ │ +
76 fgrid << "POINTS " << coords.size() << " " << Dune::className<ctype>() << std::endl;
│ │ │ │ +
77
│ │ │ │ +
78 for (size_t i=0; i<coords.size(); i++)
│ │ │ │ +
79 fgrid << coords[i] << coordinatePadding << std::endl;
│ │ │ │ +
80
│ │ │ │ +
81 fgrid << std::endl;
│ │ │ │ +
82
│ │ │ │ +
83 // WRITE POLYGONS
│ │ │ │ +
84 // ----------------
│ │ │ │ +
85
│ │ │ │ +
86 std::vector<typename Extractor::VertexVector> faces;
│ │ │ │ +
87 std::vector<Dune::GeometryType> geometryTypes;
│ │ │ │ +
88 glue.template patch<side>().getFaces(faces);
│ │ │ │ +
89 glue.template patch<side>().getGeometryTypes(geometryTypes);
│ │ │ │
90
│ │ │ │ -
91 fgrid<<"Triangles "<<overlaps<<std::endl;
│ │ │ │ -
92
│ │ │ │ -
93 for (int i=0;i<overlaps; i++)
│ │ │ │ -
94 fgrid<<i*dim+1<<" "<<i*dim+2<<" "<<i*dim+3<<std::endl;
│ │ │ │ -
95 fgrid<<"}\n";
│ │ │ │ -
96
│ │ │ │ -
97 } else if (dim==2) {
│ │ │ │ -
98
│ │ │ │ -
99 fgrid << "# AmiraMesh 3D ASCII 2.0 \n";
│ │ │ │ -
100 fgrid<<"\n";
│ │ │ │ -
101 fgrid<<"define Lines "<<3*overlaps<<"\n";
│ │ │ │ -
102 fgrid<<"nVertices "<<2*overlaps<<"\n";
│ │ │ │ -
103 fgrid<<"\n";
│ │ │ │ -
104 fgrid<<"Parameters {\n";
│ │ │ │ -
105 fgrid<<" ContentType \"HxLineSet\" \n";
│ │ │ │ -
106 fgrid<<"}\n";
│ │ │ │ -
107 fgrid<<"\n";
│ │ │ │ -
108 fgrid<<"Lines { int LineIdx } @1\n";
│ │ │ │ -
109 fgrid<<"Vertices { float[3] Coordinates } @2\n";
│ │ │ │ -
110 fgrid<<"\n";
│ │ │ │ -
111 fgrid<<"# Data section follows\n";
│ │ │ │ -
112 fgrid<<"@1 \n";
│ │ │ │ -
113 for (int i=0; i<overlaps;i++)
│ │ │ │ -
114 fgrid<<2*i<<"\n"<<2*i+1<<"\n"<<-1<<"\n";
│ │ │ │ -
115 fgrid<<"\n";
│ │ │ │ -
116 fgrid<<"@2 \n";
│ │ │ │ -
117
│ │ │ │ -
118 auto isEnd = glue.template iend<side>();
│ │ │ │ -
119 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt) {
│ │ │ │ -
120 const auto& geometry = isIt->geometry();
│ │ │ │ -
121 for (int i = 0; i <2; ++i)
│ │ │ │ -
122 fgrid << geometry.corner(i) <<" "<<0<<"\n";
│ │ │ │ -
123 }
│ │ │ │ -
124 }
│ │ │ │ +
91 unsigned int faceCornerCount = 0;
│ │ │ │ +
92 for (size_t i=0; i<faces.size(); i++)
│ │ │ │ +
93 faceCornerCount += faces[i].size();
│ │ │ │ +
94
│ │ │ │ +
95 fgrid << ((patchDim==3) ? "CELLS " : "POLYGONS ")
│ │ │ │ +
96 << geometryTypes.size() << " " << geometryTypes.size() + faceCornerCount << std::endl;
│ │ │ │ +
97
│ │ │ │ +
98 for (size_t i=0; i<faces.size(); i++) {
│ │ │ │ +
99
│ │ │ │ +
100 fgrid << faces[i].size();
│ │ │ │ +
101
│ │ │ │ +
102 // vtk expects the vertices to by cyclically ordered
│ │ │ │ +
103 // therefore unfortunately we have to deal with several element types on a case-by-case basis
│ │ │ │ +
104 if (geometryTypes[i].isSimplex()) {
│ │ │ │ +
105 for (int j=0; j<patchDim+1; j++)
│ │ │ │ +
106 fgrid << " " << faces[i][j];
│ │ │ │ +
107
│ │ │ │ +
108 } else if (geometryTypes[i].isQuadrilateral()) {
│ │ │ │ +
109 fgrid << " " << faces[i][0] << " " << faces[i][1]
│ │ │ │ +
110 << " " << faces[i][3] << " " << faces[i][2];
│ │ │ │ +
111
│ │ │ │ +
112 } else if (geometryTypes[i].isPyramid()) {
│ │ │ │ +
113 fgrid << " " << faces[i][0] << " " << faces[i][1]
│ │ │ │ +
114 << " " << faces[i][3] << " " << faces[i][2] << " " << faces[i][4];
│ │ │ │ +
115
│ │ │ │ +
116 } else if (geometryTypes[i].isPrism()) {
│ │ │ │ +
117 fgrid << " " << faces[i][0] << " " << faces[i][2] << " " << faces[i][1]
│ │ │ │ +
118 << " " << faces[i][3] << " " << faces[i][5] << " " << faces[i][4];
│ │ │ │ +
119
│ │ │ │ +
120 } else if (geometryTypes[i].isHexahedron()) {
│ │ │ │ +
121 fgrid << " " << faces[i][0] << " " << faces[i][1]
│ │ │ │ +
122 << " " << faces[i][3] << " " << faces[i][2]
│ │ │ │ +
123 << " " << faces[i][4] << " " << faces[i][5]
│ │ │ │ +
124 << " " << faces[i][7] << " " << faces[i][6];
│ │ │ │
125
│ │ │ │ -
126 fgrid.close();
│ │ │ │ -
127 }
│ │ │ │ -
128
│ │ │ │ -
129public:
│ │ │ │ -
130 template<typename Glue>
│ │ │ │ -
│ │ │ │ -
131 static void write(const Glue& glue, const std::string& path, int appendix=1)
│ │ │ │ -
132 {
│ │ │ │ -
133 std::ostringstream name0;
│ │ │ │ -
134 name0 << path;
│ │ │ │ -
135 name0 << "/domain.surf" << std::setw(3) << std::setfill('0') << appendix;
│ │ │ │ -
136
│ │ │ │ -
137 // Write extracted grid and remote intersection on the grid1-side
│ │ │ │ -
138 writeIntersections<Glue,0>(glue,name0.str());
│ │ │ │ +
126 } else {
│ │ │ │ +
127 DUNE_THROW(Dune::NotImplemented, "Geometry type " << geometryTypes[i] << " not supported yet");
│ │ │ │ +
128 }
│ │ │ │ +
129
│ │ │ │ +
130 fgrid << std::endl;
│ │ │ │ +
131 }
│ │ │ │ +
132
│ │ │ │ +
133 fgrid << std::endl;
│ │ │ │ +
134
│ │ │ │ +
135 // 3d VTK files need an extra section specifying the CELL_TYPES aka GeometryTypes
│ │ │ │ +
136 if (patchDim==3) {
│ │ │ │ +
137
│ │ │ │ +
138 fgrid << "CELL_TYPES " << geometryTypes.size() << std::endl;
│ │ │ │
139
│ │ │ │ -
140 std::ostringstream name1;
│ │ │ │ -
141 name1 << path;
│ │ │ │ -
142 name1 << "/target.surf" << std::setw(3) << std::setfill('0') << appendix;
│ │ │ │ -
143
│ │ │ │ -
144 writeIntersections<Glue,1>(glue, name1.str());
│ │ │ │ -
145 }
│ │ │ │ -
│ │ │ │ -
146
│ │ │ │ -
147};
│ │ │ │ -
│ │ │ │ -
148
│ │ │ │ -
149} // namespace GridGlue
│ │ │ │ -
150} // namespace Dune
│ │ │ │ +
140 for (size_t i=0; i<geometryTypes.size(); i++) {
│ │ │ │ +
141 if (geometryTypes[i].isSimplex())
│ │ │ │ +
142 fgrid << "10" << std::endl;
│ │ │ │ +
143 else if (geometryTypes[i].isHexahedron())
│ │ │ │ +
144 fgrid << "12" << std::endl;
│ │ │ │ +
145 else if (geometryTypes[i].isPrism())
│ │ │ │ +
146 fgrid << "13" << std::endl;
│ │ │ │ +
147 else if (geometryTypes[i].isPyramid())
│ │ │ │ +
148 fgrid << "14" << std::endl;
│ │ │ │ +
149 else
│ │ │ │ +
150 DUNE_THROW(Dune::NotImplemented, "Geometry type " << geometryTypes[i] << " not supported yet");
│ │ │ │
151
│ │ │ │ -
152#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH
│ │ │ │ +
152 }
│ │ │ │ +
153
│ │ │ │ +
154 }
│ │ │ │ +
155
│ │ │ │ +
156#if 0
│ │ │ │ +
157 // WRITE CELL DATA
│ │ │ │ +
158 // ---------------
│ │ │ │ +
159 ctype accum = 0.0, delta = 1.0 / (ctype) (gridSubEntityData.size()-1);
│ │ │ │ +
160
│ │ │ │ +
161 fgrid << "CELL_DATA " << gridSubEntityData.size() << std::endl;
│ │ │ │ +
162 fgrid << "SCALARS property_coding " << Dune::className<ctype>() << " 1" << std::endl;
│ │ │ │ +
163 fgrid << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ +
164
│ │ │ │ +
165 for (typename GridSubEntityData::const_iterator sEIt = gridSubEntityData.begin();
│ │ │ │ +
166 sEIt != gridSubEntityData.end();
│ │ │ │ +
167 ++sEIt, accum += delta)
│ │ │ │ +
168 {
│ │ │ │ +
169 // "encode" the parent with one color...
│ │ │ │ +
170 fgrid << accum << std::endl;
│ │ │ │ +
171 }
│ │ │ │ +
172#endif
│ │ │ │ +
173 fgrid.close();
│ │ │ │ +
174 }
│ │ │ │ +
175
│ │ │ │ +
176
│ │ │ │ +
180 template <class Glue, int side>
│ │ │ │ +
181 static void writeIntersections(const Glue& glue, const std::string& filename)
│ │ │ │ +
182 {
│ │ │ │ +
183 static_assert((side==0 || side==1), "'side' can only be 0 or 1");
│ │ │ │ +
184
│ │ │ │ +
185 std::ofstream fmerged;
│ │ │ │ +
186
│ │ │ │ +
187 fmerged.open(filename.c_str());
│ │ │ │ +
188
│ │ │ │ +
189 using GridView = typename Glue::template GridView<side>;
│ │ │ │ +
190 typedef typename GridView::ctype ctype;
│ │ │ │ +
191
│ │ │ │ +
192 const int domdimw = GridView::dimensionworld;
│ │ │ │ +
193 const int intersectionDim = Glue::Intersection::mydim;
│ │ │ │ +
194
│ │ │ │ +
195 // coordinates have to be in R^3 in the VTK format
│ │ │ │ +
196 std::string coordinatePadding;
│ │ │ │ +
197 for (int i=domdimw; i<3; i++)
│ │ │ │ +
198 coordinatePadding += " 0";
│ │ │ │ +
199
│ │ │ │ +
200 int overlaps = glue.size();
│ │ │ │ +
201
│ │ │ │ +
202 // WRITE POINTS
│ │ │ │ +
203 // ----------------
│ │ │ │ +
204 using Extractor = typename Glue::template GridPatch<0>;
│ │ │ │ +
205 std::vector<typename Extractor::Coords> coords;
│ │ │ │ +
206 glue.template patch<side>().getCoords(coords);
│ │ │ │ +
207
│ │ │ │ +
208 // the merged grid (i.e. the set of remote intersections
│ │ │ │ +
209 fmerged << "# vtk DataFile Version 2.0\nFilename: " << filename << "\nASCII" << std::endl;
│ │ │ │ +
210 fmerged << ((intersectionDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET POLYDATA") << std::endl;
│ │ │ │ +
211 fmerged << "POINTS " << overlaps*(intersectionDim+1) << " " << Dune::className<ctype>() << std::endl;
│ │ │ │ +
212
│ │ │ │ +
213 for (const auto& intersection : intersections(glue, Reverse<side == 1>{}))
│ │ │ │ +
214 {
│ │ │ │ +
215 const auto& geometry = intersection.geometry();
│ │ │ │ +
216 for (int i = 0; i < geometry.corners(); ++i)
│ │ │ │ +
217 fmerged << geometry.corner(i) << coordinatePadding << std::endl;
│ │ │ │ +
218 }
│ │ │ │ +
219
│ │ │ │ +
220 // WRITE POLYGONS
│ │ │ │ +
221 // ----------------
│ │ │ │ +
222
│ │ │ │ +
223 std::vector<typename Extractor::VertexVector> faces;
│ │ │ │ +
224 std::vector<Dune::GeometryType> geometryTypes;
│ │ │ │ +
225 glue.template patch<side>().getFaces(faces);
│ │ │ │ +
226 glue.template patch<side>().getGeometryTypes(geometryTypes);
│ │ │ │ +
227
│ │ │ │ +
228 unsigned int faceCornerCount = 0;
│ │ │ │ +
229 for (size_t i=0; i<faces.size(); i++)
│ │ │ │ +
230 faceCornerCount += faces[i].size();
│ │ │ │ +
231
│ │ │ │ +
232 int grid0SimplexCorners = intersectionDim+1;
│ │ │ │ +
233 fmerged << ((intersectionDim==3) ? "CELLS " : "POLYGONS ")
│ │ │ │ +
234 << overlaps << " " << (grid0SimplexCorners+1)*overlaps << std::endl;
│ │ │ │ +
235
│ │ │ │ +
236 for (int i = 0; i < overlaps; ++i) {
│ │ │ │ +
237 fmerged << grid0SimplexCorners;
│ │ │ │ +
238 for (int j=0; j<grid0SimplexCorners; j++)
│ │ │ │ +
239 fmerged << " " << grid0SimplexCorners*i+j;
│ │ │ │ +
240 fmerged << std::endl;
│ │ │ │ +
241 }
│ │ │ │ +
242
│ │ │ │ +
243 // 3d VTK files need an extra section specifying the CELL_TYPES aka GeometryTypes
│ │ │ │ +
244 if (intersectionDim==3) {
│ │ │ │ +
245
│ │ │ │ +
246 fmerged << "CELL_TYPES " << overlaps << std::endl;
│ │ │ │ +
247
│ │ │ │ +
248 for (int i = 0; i < overlaps; i++)
│ │ │ │ +
249 fmerged << "10" << std::endl;
│ │ │ │ +
250
│ │ │ │ +
251 }
│ │ │ │ +
252
│ │ │ │ +
253#if 0
│ │ │ │ +
254 // WRITE CELL DATA
│ │ │ │ +
255 // ---------------
│ │ │ │ +
256 ctype accum = 0.0, delta = 1.0 / (ctype) (gridSubEntityData.size()-1);
│ │ │ │ +
257
│ │ │ │ +
258 fmerged << "CELL_DATA " << overlaps << std::endl;
│ │ │ │ +
259 fmerged << "SCALARS property_coding " << Dune::className<ctype>() << " 1" << std::endl;
│ │ │ │ +
260 fmerged << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ +
261
│ │ │ │ +
262 for (typename GridSubEntityData::const_iterator sEIt = gridSubEntityData.begin();
│ │ │ │ +
263 sEIt != gridSubEntityData.end();
│ │ │ │ +
264 ++sEIt, accum += delta)
│ │ │ │ +
265 {
│ │ │ │ +
266 // ...and mark all of its merged grid parts with the same color
│ │ │ │ +
267 for (int j = 0; j < sEIt->first.second; ++j)
│ │ │ │ +
268 fmerged << accum << std::endl;
│ │ │ │ +
269 }
│ │ │ │ +
270#endif
│ │ │ │ +
271 fmerged.close();
│ │ │ │ +
272 }
│ │ │ │ +
273
│ │ │ │ +
274public:
│ │ │ │ +
275 template<typename Glue>
│ │ │ │ +
│ │ │ │ +
276 static void write(const Glue& glue, const std::string& filenameTrunk)
│ │ │ │ +
277 {
│ │ │ │ +
278
│ │ │ │ +
279 // Write extracted grid and remote intersection on the grid0-side
│ │ │ │ +
280 writeExtractedPart<Glue,0>(glue,
│ │ │ │ +
281 filenameTrunk + "-grid0.vtk");
│ │ │ │ +
282
│ │ │ │ +
283 writeIntersections<Glue,0>(glue,
│ │ │ │ +
284 filenameTrunk + "-intersections-grid0.vtk");
│ │ │ │ +
285
│ │ │ │ +
286 // Write extracted grid and remote intersection on the grid1-side
│ │ │ │ +
287 writeExtractedPart<Glue,1>(glue,
│ │ │ │ +
288 filenameTrunk + "-grid1.vtk");
│ │ │ │ +
289
│ │ │ │ +
290 writeIntersections<Glue,1>(glue,
│ │ │ │ +
291 filenameTrunk + "-intersections-grid1.vtk");
│ │ │ │ +
292
│ │ │ │ +
293 }
│ │ │ │ +
│ │ │ │ +
294
│ │ │ │ +
295};
│ │ │ │ +
│ │ │ │ +
296
│ │ │ │ +
297} /* namespace GridGlue */
│ │ │ │ +
298} /* namespace Dune */
│ │ │ │ +
299
│ │ │ │ +
300#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH
│ │ │ │ +
Central component of the module implementing the coupling of two grids.
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
Write remote intersections to a AmiraMesh file for debugging purposes.
Definition gridglueamirawriter.hh:21
│ │ │ │ -
static void write(const Glue &glue, const std::string &path, int appendix=1)
Definition gridglueamirawriter.hh:131
│ │ │ │ +
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ +
Write remote intersections to a vtk file for debugging purposes.
Definition gridgluevtkwriter.hh:41
│ │ │ │ +
static void write(const Glue &glue, const std::string &filenameTrunk)
Definition gridgluevtkwriter.hh:276
│ │ │ │ +
Definition rangegenerators.hh:17
│ │ │ │ +
Provides codimension-independent methods for grid extraction.
Definition extractor.hh:46
│ │ │ │ +
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │ +
void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) const
getter for the coordinates array
Definition extractor.hh:275
│ │ │ │ +
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,165 +1,349 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -gridglueamirawriter.hh │ │ │ │ │ +gridgluevtkwriter.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ +4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH │ │ │ │ │ -9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH │ │ │ │ │ -10 │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13#include │ │ │ │ │ -14 │ │ │ │ │ -15namespace _D_u_n_e { │ │ │ │ │ -16namespace GridGlue { │ │ │ │ │ -17 │ │ │ │ │ -_2_0class _G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r │ │ │ │ │ -21{ │ │ │ │ │ +5/* │ │ │ │ │ +6 * Filename: GridGlueVtkWriter.hh │ │ │ │ │ +7 * Version: 1.0 │ │ │ │ │ +8 * Created on: Mar 5, 2009 │ │ │ │ │ +9 * Author: Gerrit Buse │ │ │ │ │ +10 * --------------------------------- │ │ │ │ │ +11 * Project: dune-grid-glue │ │ │ │ │ +12 * Description: Class thought to make graphical debugging of couplings │ │ │ │ │ +easier. │ │ │ │ │ +13 * │ │ │ │ │ +14 */ │ │ │ │ │ +20#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH │ │ │ │ │ +21#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH │ │ │ │ │ 22 │ │ │ │ │ -26 template │ │ │ │ │ -27 static void writeIntersections(const Glue& glue, const std::string& │ │ │ │ │ -filename) │ │ │ │ │ -28 { │ │ │ │ │ -29 static_assert((side==0 || side==1), "'side' can only be 0 or 1"); │ │ │ │ │ -30 │ │ │ │ │ -31 std::ofstream fgrid; │ │ │ │ │ +23 │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26#include │ │ │ │ │ +27#include │ │ │ │ │ +28 │ │ │ │ │ +29#include │ │ │ │ │ +30#include │ │ │ │ │ +31#include │ │ │ │ │ 32 │ │ │ │ │ -33 fgrid.open(filename.c_str()); │ │ │ │ │ +33#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ 34 │ │ │ │ │ -35 using GridView = typename Glue::template GridView; │ │ │ │ │ -36 const int dim = GridView::dimension; │ │ │ │ │ -37 const int domdimw = GridView::dimensionworld; │ │ │ │ │ -38 │ │ │ │ │ -39 // coordinates have to be in R^3 in the VTK format │ │ │ │ │ -40 std::string coordinatePadding; │ │ │ │ │ -41 for (int i=domdimw; i<3; i++) │ │ │ │ │ -42 coordinatePadding += " 0"; │ │ │ │ │ -43 │ │ │ │ │ -44 int overlaps = glue.size(); │ │ │ │ │ -45 │ │ │ │ │ -46 if (dim==3) { │ │ │ │ │ -47 │ │ │ │ │ -48 fgrid << "# HyperSurface 0.1 ASCII \n" << std::endl; │ │ │ │ │ -49 fgrid<<"\n"; │ │ │ │ │ -50 fgrid<<"Parameters {\n"; │ │ │ │ │ -51 fgrid<<" Materials {\n"; │ │ │ │ │ -52 fgrid<<" outside {\n"; │ │ │ │ │ -53 fgrid<<" Id 0\n"; │ │ │ │ │ -54 fgrid<<" }\n"; │ │ │ │ │ -55 fgrid<<" inside {\n"; │ │ │ │ │ -56 fgrid<<" Id 1\n"; │ │ │ │ │ -57 fgrid<<" }\n"; │ │ │ │ │ -58 fgrid<<" }\n"; │ │ │ │ │ -59 fgrid<<"\n"; │ │ │ │ │ -60 fgrid<<"}\n"; │ │ │ │ │ -61 │ │ │ │ │ -62 // //////////////////////////////////////////// │ │ │ │ │ -63 // Write vertices │ │ │ │ │ -64 // //////////////////////////////////////////// │ │ │ │ │ -65 │ │ │ │ │ -66 //use dim and not dim+1 │ │ │ │ │ -67 fgrid<<"\nVertices "<< overlaps*(dim)<<"\n"; │ │ │ │ │ -68 auto isEnd = glue.template iend(); │ │ │ │ │ -69 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt) │ │ │ │ │ -70 { │ │ │ │ │ -71 const auto& geometry = isIt->geometry(); │ │ │ │ │ -72 for (int i = 0; i < geometry.corners(); ++i) │ │ │ │ │ -73 fgrid << geometry.corner(i) << coordinatePadding << std::endl; │ │ │ │ │ -74 } │ │ │ │ │ -75 │ │ │ │ │ -76 // //////////////////////////////////////////// │ │ │ │ │ -77 // Write triangles │ │ │ │ │ -78 // //////////////////////////////////////////// │ │ │ │ │ -79 │ │ │ │ │ -80 fgrid<<"NBranchingPoints 0\n"; │ │ │ │ │ -81 fgrid<<"NVerticesOnCurves 0\n"; │ │ │ │ │ -82 fgrid<<"BoundaryCurves 0\n"; │ │ │ │ │ -83 fgrid<<"Patches 1\n"; │ │ │ │ │ -84 fgrid<<"{\n"; │ │ │ │ │ -85 fgrid<<"InnerRegion inside\n"; │ │ │ │ │ -86 fgrid<<"OuterRegion outside\n"; │ │ │ │ │ -87 fgrid<<"BoundaryID 0\n"; │ │ │ │ │ -88 fgrid<<"BranchingPoints 0"; │ │ │ │ │ -89 fgrid<<"\n"; │ │ │ │ │ +35namespace _D_u_n_e { │ │ │ │ │ +36namespace GridGlue { │ │ │ │ │ +37 │ │ │ │ │ +_4_0class _G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r │ │ │ │ │ +41{ │ │ │ │ │ +42 │ │ │ │ │ +46 template │ │ │ │ │ +47 static void writeExtractedPart(const Glue& glue, const std::string& │ │ │ │ │ +filename) │ │ │ │ │ +48 { │ │ │ │ │ +49 static_assert((side==0 || side==1), "'side' can only be 0 or 1"); │ │ │ │ │ +50 │ │ │ │ │ +51 std::ofstream fgrid; │ │ │ │ │ +52 │ │ │ │ │ +53 fgrid.open(filename.c_str()); │ │ │ │ │ +54 │ │ │ │ │ +55 using GridView = typename Glue::template GridView; │ │ │ │ │ +56 using _E_x_t_r_a_c_t_o_r = typename Glue::template GridPatch; │ │ │ │ │ +57 │ │ │ │ │ +58 typedef typename GridView::ctype ctype; │ │ │ │ │ +59 │ │ │ │ │ +60 const int domdimw = GridView::dimensionworld; │ │ │ │ │ +61 const int patchDim = _E_x_t_r_a_c_t_o_r_:_:_d_i_m - _E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m; │ │ │ │ │ +62 │ │ │ │ │ +63 // coordinates have to be in R^3 in the VTK format │ │ │ │ │ +64 std::string coordinatePadding; │ │ │ │ │ +65 for (int i=domdimw; i<3; i++) │ │ │ │ │ +66 coordinatePadding += " 0"; │ │ │ │ │ +67 │ │ │ │ │ +68 fgrid << "# vtk DataFile Version 2.0\nFilename: " << filename << "\nASCII" │ │ │ │ │ +<< std::endl; │ │ │ │ │ +69 │ │ │ │ │ +70 // WRITE POINTS │ │ │ │ │ +71 // ---------------- │ │ │ │ │ +72 std::vector coords; │ │ │ │ │ +73 glue.template patch()._g_e_t_C_o_o_r_d_s(coords); │ │ │ │ │ +74 │ │ │ │ │ +75 fgrid << ((patchDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET POLYDATA") │ │ │ │ │ +<< std::endl; │ │ │ │ │ +76 fgrid << "POINTS " << coords.size() << " " << Dune::className() << │ │ │ │ │ +std::endl; │ │ │ │ │ +77 │ │ │ │ │ +78 for (size_t i=0; i faces; │ │ │ │ │ +87 std::vector geometryTypes; │ │ │ │ │ +88 glue.template patch().getFaces(faces); │ │ │ │ │ +89 glue.template patch().getGeometryTypes(geometryTypes); │ │ │ │ │ 90 │ │ │ │ │ -91 fgrid<<"Triangles "<(); │ │ │ │ │ -119 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt) { │ │ │ │ │ -120 const auto& geometry = isIt->geometry(); │ │ │ │ │ -121 for (int i = 0; i <2; ++i) │ │ │ │ │ -122 fgrid << geometry.corner(i) <<" "<<0<<"\n"; │ │ │ │ │ -123 } │ │ │ │ │ -124 } │ │ │ │ │ +91 unsigned int faceCornerCount = 0; │ │ │ │ │ +92 for (size_t i=0; i │ │ │ │ │ -_1_3_1 static void _w_r_i_t_e(const Glue& glue, const std::string& path, int │ │ │ │ │ -appendix=1) │ │ │ │ │ -132 { │ │ │ │ │ -133 std::ostringstream name0; │ │ │ │ │ -134 name0 << path; │ │ │ │ │ -135 name0 << "/domain.surf" << std::setw(3) << std::setfill('0') << appendix; │ │ │ │ │ -136 │ │ │ │ │ -137 // Write extracted grid and remote intersection on the grid1-side │ │ │ │ │ -138 writeIntersections(glue,name0.str()); │ │ │ │ │ +126 } else { │ │ │ │ │ +127 DUNE_THROW(Dune::NotImplemented, "Geometry type " << geometryTypes[i] << " │ │ │ │ │ +not supported yet"); │ │ │ │ │ +128 } │ │ │ │ │ +129 │ │ │ │ │ +130 fgrid << std::endl; │ │ │ │ │ +131 } │ │ │ │ │ +132 │ │ │ │ │ +133 fgrid << std::endl; │ │ │ │ │ +134 │ │ │ │ │ +135 // 3d VTK files need an extra section specifying the CELL_TYPES aka │ │ │ │ │ +GeometryTypes │ │ │ │ │ +136 if (patchDim==3) { │ │ │ │ │ +137 │ │ │ │ │ +138 fgrid << "CELL_TYPES " << geometryTypes.size() << std::endl; │ │ │ │ │ 139 │ │ │ │ │ -140 std::ostringstream name1; │ │ │ │ │ -141 name1 << path; │ │ │ │ │ -142 name1 << "/target.surf" << std::setw(3) << std::setfill('0') << appendix; │ │ │ │ │ -143 │ │ │ │ │ -144 writeIntersections(glue, name1.str()); │ │ │ │ │ -145 } │ │ │ │ │ -146 │ │ │ │ │ -147}; │ │ │ │ │ -148 │ │ │ │ │ -149} // namespace GridGlue │ │ │ │ │ -150} // namespace Dune │ │ │ │ │ +140 for (size_t i=0; i() << " 1" << │ │ │ │ │ +std::endl; │ │ │ │ │ +163 fgrid << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ +164 │ │ │ │ │ +165 for (typename GridSubEntityData::const_iterator sEIt = │ │ │ │ │ +gridSubEntityData.begin(); │ │ │ │ │ +166 sEIt != gridSubEntityData.end(); │ │ │ │ │ +167 ++sEIt, accum += delta) │ │ │ │ │ +168 { │ │ │ │ │ +169 // "encode" the parent with one color... │ │ │ │ │ +170 fgrid << accum << std::endl; │ │ │ │ │ +171 } │ │ │ │ │ +172#endif │ │ │ │ │ +173 fgrid.close(); │ │ │ │ │ +174 } │ │ │ │ │ +175 │ │ │ │ │ +176 │ │ │ │ │ +180 template │ │ │ │ │ +181 static void writeIntersections(const Glue& glue, const std::string& │ │ │ │ │ +filename) │ │ │ │ │ +182 { │ │ │ │ │ +183 static_assert((side==0 || side==1), "'side' can only be 0 or 1"); │ │ │ │ │ +184 │ │ │ │ │ +185 std::ofstream fmerged; │ │ │ │ │ +186 │ │ │ │ │ +187 fmerged.open(filename.c_str()); │ │ │ │ │ +188 │ │ │ │ │ +189 using GridView = typename Glue::template GridView; │ │ │ │ │ +190 typedef typename GridView::ctype ctype; │ │ │ │ │ +191 │ │ │ │ │ +192 const int domdimw = GridView::dimensionworld; │ │ │ │ │ +193 const int intersectionDim = Glue::Intersection::mydim; │ │ │ │ │ +194 │ │ │ │ │ +195 // coordinates have to be in R^3 in the VTK format │ │ │ │ │ +196 std::string coordinatePadding; │ │ │ │ │ +197 for (int i=domdimw; i<3; i++) │ │ │ │ │ +198 coordinatePadding += " 0"; │ │ │ │ │ +199 │ │ │ │ │ +200 int overlaps = glue.size(); │ │ │ │ │ +201 │ │ │ │ │ +202 // WRITE POINTS │ │ │ │ │ +203 // ---------------- │ │ │ │ │ +204 using _E_x_t_r_a_c_t_o_r = typename Glue::template GridPatch<0>; │ │ │ │ │ +205 std::vector coords; │ │ │ │ │ +206 glue.template patch()._g_e_t_C_o_o_r_d_s(coords); │ │ │ │ │ +207 │ │ │ │ │ +208 // the merged grid (i.e. the set of remote intersections │ │ │ │ │ +209 fmerged << "# vtk DataFile Version 2.0\nFilename: " << filename << │ │ │ │ │ +"\nASCII" << std::endl; │ │ │ │ │ +210 fmerged << ((intersectionDim==3) ? "DATASET UNSTRUCTURED_GRID" : "DATASET │ │ │ │ │ +POLYDATA") << std::endl; │ │ │ │ │ +211 fmerged << "POINTS " << overlaps*(intersectionDim+1) << " " << Dune:: │ │ │ │ │ +className() << std::endl; │ │ │ │ │ +212 │ │ │ │ │ +213 for (const auto& intersection : _i_n_t_e_r_s_e_c_t_i_o_n_s(glue, _R_e_v_e_r_s_e_<_s_i_d_e_ _=_=_ _1_>{})) │ │ │ │ │ +214 { │ │ │ │ │ +215 const auto& geometry = intersection.geometry(); │ │ │ │ │ +216 for (int i = 0; i < geometry.corners(); ++i) │ │ │ │ │ +217 fmerged << geometry.corner(i) << coordinatePadding << std::endl; │ │ │ │ │ +218 } │ │ │ │ │ +219 │ │ │ │ │ +220 // WRITE POLYGONS │ │ │ │ │ +221 // ---------------- │ │ │ │ │ +222 │ │ │ │ │ +223 std::vector faces; │ │ │ │ │ +224 std::vector geometryTypes; │ │ │ │ │ +225 glue.template patch().getFaces(faces); │ │ │ │ │ +226 glue.template patch().getGeometryTypes(geometryTypes); │ │ │ │ │ +227 │ │ │ │ │ +228 unsigned int faceCornerCount = 0; │ │ │ │ │ +229 for (size_t i=0; i() << " 1" │ │ │ │ │ +<< std::endl; │ │ │ │ │ +260 fmerged << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ +261 │ │ │ │ │ +262 for (typename GridSubEntityData::const_iterator sEIt = │ │ │ │ │ +gridSubEntityData.begin(); │ │ │ │ │ +263 sEIt != gridSubEntityData.end(); │ │ │ │ │ +264 ++sEIt, accum += delta) │ │ │ │ │ +265 { │ │ │ │ │ +266 // ...and mark all of its merged grid parts with the same color │ │ │ │ │ +267 for (int j = 0; j < sEIt->first.second; ++j) │ │ │ │ │ +268 fmerged << accum << std::endl; │ │ │ │ │ +269 } │ │ │ │ │ +270#endif │ │ │ │ │ +271 fmerged.close(); │ │ │ │ │ +272 } │ │ │ │ │ +273 │ │ │ │ │ +274public: │ │ │ │ │ +275 template │ │ │ │ │ +_2_7_6 static void _w_r_i_t_e(const Glue& glue, const std::string& filenameTrunk) │ │ │ │ │ +277 { │ │ │ │ │ +278 │ │ │ │ │ +279 // Write extracted grid and remote intersection on the grid0-side │ │ │ │ │ +280 writeExtractedPart(glue, │ │ │ │ │ +281 filenameTrunk + "-grid0.vtk"); │ │ │ │ │ +282 │ │ │ │ │ +283 writeIntersections(glue, │ │ │ │ │ +284 filenameTrunk + "-intersections-grid0.vtk"); │ │ │ │ │ +285 │ │ │ │ │ +286 // Write extracted grid and remote intersection on the grid1-side │ │ │ │ │ +287 writeExtractedPart(glue, │ │ │ │ │ +288 filenameTrunk + "-grid1.vtk"); │ │ │ │ │ +289 │ │ │ │ │ +290 writeIntersections(glue, │ │ │ │ │ +291 filenameTrunk + "-intersections-grid1.vtk"); │ │ │ │ │ +292 │ │ │ │ │ +293 } │ │ │ │ │ +294 │ │ │ │ │ +295}; │ │ │ │ │ +296 │ │ │ │ │ +297} /* namespace GridGlue */ │ │ │ │ │ +298} /* namespace Dune */ │ │ │ │ │ +299 │ │ │ │ │ +300#endif // DUNE_GRIDGLUE_ADAPTER_GRIDGLUEVTKWRITER_HH │ │ │ │ │ +_g_r_i_d_g_l_u_e_._h_h │ │ │ │ │ +Central component of the module implementing the coupling of two grids. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r │ │ │ │ │ -Write remote intersections to a AmiraMesh file for debugging purposes. │ │ │ │ │ -DDeeffiinniittiioonn gridglueamirawriter.hh:21 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_A_m_i_r_a_W_r_i_t_e_r_:_:_w_r_i_t_e │ │ │ │ │ -static void write(const Glue &glue, const std::string &path, int appendix=1) │ │ │ │ │ -DDeeffiinniittiioonn gridglueamirawriter.hh:131 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ +> &reverse=!reversed) │ │ │ │ │ +Iterate over all intersections of a GridGlue. │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r │ │ │ │ │ +Write remote intersections to a vtk file for debugging purposes. │ │ │ │ │ +DDeeffiinniittiioonn gridgluevtkwriter.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_V_t_k_W_r_i_t_e_r_:_:_w_r_i_t_e │ │ │ │ │ +static void write(const Glue &glue, const std::string &filenameTrunk) │ │ │ │ │ +DDeeffiinniittiioonn gridgluevtkwriter.hh:276 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e │ │ │ │ │ +DDeeffiinniittiioonn rangegenerators.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ +Provides codimension-independent methods for grid extraction. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m │ │ │ │ │ +static constexpr auto codim │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_C_o_o_r_d_s │ │ │ │ │ +void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) │ │ │ │ │ +const │ │ │ │ │ +getter for the coordinates array │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m │ │ │ │ │ +static constexpr auto dim │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:51 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridgluecommunicate.hh File Reference │ │ │ │ +dune-grid-glue: intersectionindexset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,74 +71,35 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Typedefs | │ │ │ │ -Functions
│ │ │ │ -
gridgluecommunicate.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
intersectionindexset.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

Describes the parallel communication interface class for Dune::GridGlue. │ │ │ │ -More...

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

Go to the source code of this file.

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

│ │ │ │ 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::IntersectionIndexSet< P0, P1 >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ -Typedefs

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

│ │ │ │ -Functions

std::ostream & Dune::GridGlue::operator<< (std::ostream &os, const GlobalId &id)
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

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

│ │ │ │ -
Author
Christian Engwer
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,61 +1,22 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -gridgluecommunicate.hh File Reference │ │ │ │ │ -Describes the parallel communication interface class for _D_u_n_e_:_:_G_r_i_d_G_l_u_e. │ │ │ │ │ -_M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +intersectionindexset.hh File Reference │ │ │ │ │ +#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ -  describes the features of a data handle for communication in parallel │ │ │ │ │ - runs using the _G_r_i_d_G_l_u_e_:_:_c_o_m_m_u_n_i_c_a_t_e methods. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_<_ _D_T_ _> │ │ │ │ │ -  │ │ │ │ │ - class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_<_ _d_i_r_ _> │ │ │ │ │ -  forward gather scatter to user defined _C_o_m_m_I_n_f_o class _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ -  collects all _G_r_i_d_G_l_u_e data requried for communication _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_, │ │ │ │ │ - _D_a_t_a_T_y_p_e_I_m_p_ _>_ _> │ │ │ │ │ -  specialization of the CommPolicy struct, required for the │ │ │ │ │ - ParallelIndexsets _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_<_ _P_0_,_ _P_1_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ -TTyyppeeddeeffss │ │ │ │ │ - typedef std::pair< int, int >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_a_n_k_P_a_i_r │ │ │ │ │ -  │ │ │ │ │ -typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r< Dune:: │ │ │ │ │ - ForwardCommunication >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_F_o_r_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ -  │ │ │ │ │ -typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r< Dune:: │ │ │ │ │ - BackwardCommunication >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -std::ostream &  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const _G_l_o_b_a_l_I_d │ │ │ │ │ - &id) │ │ │ │ │ -  │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Describes the parallel communication interface class for _D_u_n_e_:_:_G_r_i_d_G_l_u_e. │ │ │ │ │ - Author │ │ │ │ │ - Christian Engwer │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridgluecommunicate.hh Source File │ │ │ │ +dune-grid-glue: intersectionindexset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,365 +74,87 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
gridgluecommunicate.hh
│ │ │ │ +
intersectionindexset.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ -
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
│ │ │ │ -
6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH
│ │ │ │ -
7
│ │ │ │ -
13#include <type_traits>
│ │ │ │ +Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ +
3#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH
│ │ │ │ +
4#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH
│ │ │ │ +
5
│ │ │ │ + │ │ │ │ + │ │ │ │ +
8
│ │ │ │ +
9#ifndef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ +
10// we currently support only one intersection type. If we want to support more,
│ │ │ │ +
11// we have to think about the semantics of our IndexSet
│ │ │ │ +
12#error Not Implemented
│ │ │ │ +
13#endif
│ │ │ │
14
│ │ │ │ -
15#include <dune/common/bartonnackmanifcheck.hh>
│ │ │ │ -
16#include <dune/common/parallel/communicator.hh>
│ │ │ │ -
17#include <dune/grid/common/datahandleif.hh>
│ │ │ │ -
18#include <dune/grid/common/gridenums.hh>
│ │ │ │ -
19
│ │ │ │ -
20
│ │ │ │ -
21namespace Dune {
│ │ │ │ -
22 namespace GridGlue {
│ │ │ │ +
15namespace Dune {
│ │ │ │ +
16 namespace GridGlue {
│ │ │ │ +
17
│ │ │ │ +
18 template<typename P0, typename P1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
20 {
│ │ │ │ +
21 friend class ::Dune::GridGlue::GridGlue<P0,P1>;
│ │ │ │ +
22 typedef ::Dune::GridGlue::GridGlue<P0,P1> GridGlue;
│ │ │ │
23
│ │ │ │ -
24 typedef std::pair<int, int> RankPair;
│ │ │ │ -
│ │ │ │ -
25 struct GlobalId : public std::pair<RankPair, unsigned int>
│ │ │ │ -
26 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
31 this->first.first = 0;
│ │ │ │ -
32 this->first.second = 0;
│ │ │ │ -
33 this->second = 0;
│ │ │ │ -
34 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
38 GlobalId(int i) {
│ │ │ │ -
39 this->first.first = i;
│ │ │ │ -
40 this->first.second = i;
│ │ │ │ -
41 this->second = 0;
│ │ │ │ -
42 }
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
48 GlobalId(int i, int j, unsigned int n) {
│ │ │ │ -
49 this->first.first = std::min(i,j);
│ │ │ │ -
50 this->first.second = std::max(i,j);
│ │ │ │ -
51 this->second = n;
│ │ │ │ -
52 }
│ │ │ │ -
│ │ │ │ -
53 };
│ │ │ │ +
24 public:
│ │ │ │ +
25
│ │ │ │ + │ │ │ │ +
29 typedef size_t SizeType;
│ │ │ │ +
30
│ │ │ │ +
33 template<int I, int O>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
35 {
│ │ │ │ +
36 return i.i_->index_;
│ │ │ │ +
37 }
│ │ │ │ +
│ │ │ │ +
38
│ │ │ │ +
│ │ │ │ +
41 SizeType size () const
│ │ │ │ +
42 {
│ │ │ │ +
43 return glue_->size();
│ │ │ │ +
44 }
│ │ │ │ +
│ │ │ │ +
45
│ │ │ │ +
46 private:
│ │ │ │ +
47
│ │ │ │ + │ │ │ │ +
50 glue_(g) {}
│ │ │ │ +
51
│ │ │ │ +
52 const GridGlue * glue_;
│ │ │ │ +
53 };
│ │ │ │
│ │ │ │
54
│ │ │ │ -
│ │ │ │ -
55 inline std::ostream& operator<<(std::ostream& os, const GlobalId & id)
│ │ │ │ -
56 {
│ │ │ │ -
57 os << "("
│ │ │ │ -
58 << id.first.first << "," << id.first.second << ","
│ │ │ │ -
59 << id.second << ")";
│ │ │ │ -
60 return os;
│ │ │ │ -
61 }
│ │ │ │ -
│ │ │ │ -
62
│ │ │ │ -
75 template <class DataHandleImp, class DataTypeImp>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
77 {
│ │ │ │ -
78 public:
│ │ │ │ -
80 typedef DataTypeImp DataType;
│ │ │ │ -
81
│ │ │ │ -
82 protected:
│ │ │ │ -
83 // one should not create an explicit instance of this inteface object
│ │ │ │ - │ │ │ │ -
85
│ │ │ │ -
86 public:
│ │ │ │ -
87
│ │ │ │ -
91 template<class RISType>
│ │ │ │ -
│ │ │ │ -
92 size_t size (RISType& i) const
│ │ │ │ -
93 {
│ │ │ │ -
94 CHECK_INTERFACE_IMPLEMENTATION((asImp().size(i)));
│ │ │ │ -
95 return asImp().size(i);
│ │ │ │ -
96 }
│ │ │ │ -
│ │ │ │ -
97
│ │ │ │ -
103 template<class MessageBufferImp, class EntityType, class RISType>
│ │ │ │ -
│ │ │ │ -
104 void gather (MessageBufferImp& buff, const EntityType& e, const RISType & i) const
│ │ │ │ -
105 {
│ │ │ │ -
106 MessageBufferIF<MessageBufferImp> buffIF(buff);
│ │ │ │ -
107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().gather(buffIF,e,i)));
│ │ │ │ -
108 }
│ │ │ │ -
│ │ │ │ -
109
│ │ │ │ -
117 template<class MessageBufferImp, class EntityType, class RISType>
│ │ │ │ -
│ │ │ │ -
118 void scatter (MessageBufferImp& buff, const EntityType& e, const RISType & i, size_t n)
│ │ │ │ -
119 {
│ │ │ │ -
120 MessageBufferIF<MessageBufferImp> buffIF(buff);
│ │ │ │ -
121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp().scatter(buffIF,e,i,n)));
│ │ │ │ -
122 }
│ │ │ │ -
│ │ │ │ -
123
│ │ │ │ -
124 private:
│ │ │ │ -
126 DataHandleImp& asImp () {
│ │ │ │ -
127 return static_cast<DataHandleImp &> (*this);
│ │ │ │ -
128 }
│ │ │ │ -
130 const DataHandleImp& asImp () const
│ │ │ │ -
131 {
│ │ │ │ -
132 return static_cast<const DataHandleImp &>(*this);
│ │ │ │ -
133 }
│ │ │ │ -
134 }; // end class CommDataHandleIF
│ │ │ │ -
│ │ │ │ -
135
│ │ │ │ -
140 template<typename DT>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
142 public:
│ │ │ │ -
143 typedef DT value_type;
│ │ │ │ -
144
│ │ │ │ -
145 // Constructor
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
147 {
│ │ │ │ -
148 a=p;
│ │ │ │ -
149 i=0;
│ │ │ │ -
150 j=0;
│ │ │ │ -
151 }
│ │ │ │ -
│ │ │ │ -
152
│ │ │ │ -
153 // write data to message buffer, acts like a stream !
│ │ │ │ -
154 template<class Y>
│ │ │ │ -
│ │ │ │ -
155 void write (const Y& data)
│ │ │ │ -
156 {
│ │ │ │ -
157 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
│ │ │ │ -
158 a[i++] = data;
│ │ │ │ -
159 }
│ │ │ │ -
│ │ │ │ -
160
│ │ │ │ -
161 // read data from message buffer, acts like a stream !
│ │ │ │ -
162 template<class Y>
│ │ │ │ -
│ │ │ │ -
163 void read (Y& data) const
│ │ │ │ -
164 {
│ │ │ │ -
165 static_assert(std::is_same<DT,Y>::value, "DataType mismatch");
│ │ │ │ -
166 data = a[j++];
│ │ │ │ -
167 }
│ │ │ │ -
│ │ │ │ -
168
│ │ │ │ -
169 size_t counter() const { return i; }
│ │ │ │ -
170
│ │ │ │ -
│ │ │ │ -
171 void clear()
│ │ │ │ -
172 {
│ │ │ │ -
173 i = 0;
│ │ │ │ -
174 j = 0;
│ │ │ │ -
175 }
│ │ │ │ -
│ │ │ │ -
176
│ │ │ │ -
177 // we need access to these variables in an assertion
│ │ │ │ -
178#ifdef NDEBUG
│ │ │ │ -
179 private:
│ │ │ │ -
180#endif
│ │ │ │ -
181 DT *a;
│ │ │ │ -
182 size_t i;
│ │ │ │ -
183 mutable size_t j;
│ │ │ │ -
184 };
│ │ │ │ -
│ │ │ │ -
185
│ │ │ │ -
192 template<int dir>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
194 {
│ │ │ │ -
195 public:
│ │ │ │ -
196 template<class CommInfo>
│ │ │ │ -
│ │ │ │ -
197 static const typename CommInfo::DataType& gather(const CommInfo& commInfo, size_t i, size_t j = 0)
│ │ │ │ -
198 {
│ │ │ │ -
199 // get Intersection
│ │ │ │ -
200 typedef typename CommInfo::GridGlue::Intersection Intersection;
│ │ │ │ -
201 Intersection ris(commInfo.gridglue->getIntersection(i));
│ │ │ │ -
202
│ │ │ │ -
203 // fill buffer if we have a new intersection
│ │ │ │ -
204 if (j == 0)
│ │ │ │ -
205 {
│ │ │ │ -
206 commInfo.mbuffer.clear();
│ │ │ │ -
207 if (dir == Dune::ForwardCommunication)
│ │ │ │ -
208 {
│ │ │ │ -
209 // read from grid0
│ │ │ │ -
210 if(ris.self())
│ │ │ │ -
211 commInfo.data->gather(commInfo.mbuffer, ris.inside(), ris);
│ │ │ │ -
212 }
│ │ │ │ -
213 else // (dir == Dune::BackwardCommunication)
│ │ │ │ -
214 {
│ │ │ │ -
215 // read from grid1
│ │ │ │ -
216 if(ris.neighbor())
│ │ │ │ -
217 commInfo.data->gather(commInfo.mbuffer, ris.outside(), ris.flip());
│ │ │ │ -
218 }
│ │ │ │ -
219 }
│ │ │ │ -
220
│ │ │ │ -
221 // return the j'th value in the buffer
│ │ │ │ -
222 assert(j < commInfo.mbuffer.i);
│ │ │ │ -
223 return commInfo.buffer[j];
│ │ │ │ -
224 }
│ │ │ │ -
│ │ │ │ -
225
│ │ │ │ -
226 template<class CommInfo>
│ │ │ │ -
│ │ │ │ -
227 static void scatter(CommInfo& commInfo, const typename CommInfo::DataType& v, std::size_t i, std::size_t j = 0)
│ │ │ │ -
228 {
│ │ │ │ -
229 // extract GridGlue objects...
│ │ │ │ -
230 typedef typename CommInfo::GridGlue::Intersection Intersection;
│ │ │ │ -
231 Intersection ris(commInfo.gridglue->getIntersection(i));
│ │ │ │ -
232
│ │ │ │ -
233 // get size if we have a new intersection
│ │ │ │ -
234 if (j == 0)
│ │ │ │ -
235 {
│ │ │ │ -
236 commInfo.mbuffer.clear();
│ │ │ │ -
237 commInfo.currentsize = commInfo.data->size(ris);
│ │ │ │ -
238 }
│ │ │ │ -
239
│ │ │ │ -
240 // write entry to buffer
│ │ │ │ -
241 commInfo.buffer[j] = v;
│ │ │ │ -
242
│ │ │ │ -
243 // write back the buffer if we are at the end of this intersection
│ │ │ │ -
244 if (j == commInfo.currentsize-1)
│ │ │ │ -
245 {
│ │ │ │ -
246 if (dir == Dune::ForwardCommunication)
│ │ │ │ -
247 {
│ │ │ │ -
248 // write to grid1
│ │ │ │ -
249 if(ris.neighbor())
│ │ │ │ -
250 commInfo.data->scatter(commInfo.mbuffer, ris.outside(), ris.flip(), commInfo.currentsize);
│ │ │ │ -
251 }
│ │ │ │ -
252 else // (dir == Dune::BackwardCommunication)
│ │ │ │ -
253 {
│ │ │ │ -
254 // write to grid0
│ │ │ │ -
255 if(ris.self())
│ │ │ │ -
256 commInfo.data->scatter(commInfo.mbuffer, ris.inside(), ris, commInfo.currentsize);
│ │ │ │ -
257 }
│ │ │ │ -
258 assert(commInfo.mbuffer.j <= commInfo.currentsize);
│ │ │ │ -
259 }
│ │ │ │ -
260 }
│ │ │ │ -
│ │ │ │ -
261 };
│ │ │ │ -
│ │ │ │ -
262
│ │ │ │ - │ │ │ │ - │ │ │ │ -
265
│ │ │ │ -
270 template <typename GG, class DataHandleImp, class DataTypeImp>
│ │ │ │ -
│ │ │ │ -
271 struct CommInfo
│ │ │ │ -
272 {
│ │ │ │ -
273 typedef DataTypeImp value_type;
│ │ │ │ -
274 typedef GG GridGlue;
│ │ │ │ -
275 typedef DataTypeImp DataType;
│ │ │ │ -
276
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
278 {}
│ │ │ │ -
│ │ │ │ -
279
│ │ │ │ -
280 // tunnel information to the policy and the operators
│ │ │ │ - │ │ │ │ - │ │ │ │ -
283
│ │ │ │ -
284 // state variables
│ │ │ │ -
285 std::vector<DataType> buffer;
│ │ │ │ -
286 mutable ::Dune::GridGlue::StreamingMessageBuffer<DataType> mbuffer;
│ │ │ │ - │ │ │ │ -
288 Dune::CommunicationDirection dir;
│ │ │ │ -
289 };
│ │ │ │ -
│ │ │ │ -
290
│ │ │ │ -
291 } // end namespace GridGlue
│ │ │ │ -
292
│ │ │ │ -
293#if HAVE_MPI
│ │ │ │ -
298 template<typename GG, class DataHandleImp, class DataTypeImp>
│ │ │ │ -
│ │ │ │ -
299 struct CommPolicy< ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> >
│ │ │ │ -
300 {
│ │ │ │ -
304 typedef ::Dune::GridGlue::CommInfo<GG, DataHandleImp, DataTypeImp> Type;
│ │ │ │ -
305
│ │ │ │ -
309 typedef DataTypeImp IndexedType;
│ │ │ │ -
310
│ │ │ │ -
314 // typedef SizeOne IndexedTypeFlag;
│ │ │ │ -
315 typedef VariableSize IndexedTypeFlag;
│ │ │ │ -
316
│ │ │ │ -
│ │ │ │ -
320 static size_t getSize(const Type& commInfo, size_t i)
│ │ │ │ -
321 {
│ │ │ │ -
322 // get Intersection
│ │ │ │ -
323 typedef typename Type::GridGlue::Intersection Intersection;
│ │ │ │ -
324 Intersection ris(commInfo.gridglue->getIntersection(i));
│ │ │ │ -
325
│ │ │ │ -
326 // ask data handle for size
│ │ │ │ -
327 return commInfo.data->size(ris);
│ │ │ │ -
328 }
│ │ │ │ -
│ │ │ │ -
329 };
│ │ │ │ -
│ │ │ │ -
330#endif
│ │ │ │ -
331
│ │ │ │ -
332} // end namespace Dune
│ │ │ │ -
333#endif
│ │ │ │ +
55 } // end namespace GridGlue
│ │ │ │ +
56} // end namespace Dune
│ │ │ │ +
57
│ │ │ │ +
58#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH
│ │ │ │ +
Central component of the module implementing the coupling of two grids.
│ │ │ │ +
Model of the Intersection concept provided by GridGlue.
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
CommunicationOperator< Dune::BackwardCommunication > BackwardOperator
Definition gridgluecommunicate.hh:264
│ │ │ │ -
CommunicationOperator< Dune::ForwardCommunication > ForwardOperator
Definition gridgluecommunicate.hh:263
│ │ │ │ -
std::pair< int, int > RankPair
Definition gridgluecommunicate.hh:24
│ │ │ │ -
std::ostream & operator<<(std::ostream &os, const GlobalId &id)
Definition gridgluecommunicate.hh:55
│ │ │ │ +
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │ +
unsigned int IndexType
Definition gridglue.hh:147
│ │ │ │ +
size_t size() const
Definition gridglue.hh:393
│ │ │ │ +
IndexType index_
index of this intersection after GridGlue interface
Definition intersection.hh:112
│ │ │ │
The intersection of two entities of the two patches of a GridGlue.
Definition intersection.hh:261
│ │ │ │ -
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition intersection.hh:483
│ │ │ │ -
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition intersection.hh:393
│ │ │ │ -
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition intersection.hh:319
│ │ │ │ -
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition intersection.hh:399
│ │ │ │ -
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition intersection.hh:328
│ │ │ │ -
Definition gridgluecommunicate.hh:26
│ │ │ │ -
GlobalId(int i)
Definition gridgluecommunicate.hh:38
│ │ │ │ -
GlobalId()
Definition gridgluecommunicate.hh:30
│ │ │ │ -
GlobalId(int i, int j, unsigned int n)
Definition gridgluecommunicate.hh:48
│ │ │ │ -
describes the features of a data handle for communication in parallel runs using the GridGlue::commun...
Definition gridgluecommunicate.hh:77
│ │ │ │ -
size_t size(RISType &i) const
Definition gridgluecommunicate.hh:92
│ │ │ │ -
void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, size_t n)
Definition gridgluecommunicate.hh:118
│ │ │ │ -
void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) const
pack data from user to message buffer
Definition gridgluecommunicate.hh:104
│ │ │ │ -
DataTypeImp DataType
data type of data to communicate
Definition gridgluecommunicate.hh:80
│ │ │ │ -
CommDataHandle()
Definition gridgluecommunicate.hh:84
│ │ │ │ -
Definition gridgluecommunicate.hh:141
│ │ │ │ -
size_t j
Definition gridgluecommunicate.hh:183
│ │ │ │ -
StreamingMessageBuffer(DT *p)
Definition gridgluecommunicate.hh:146
│ │ │ │ -
DT * a
Definition gridgluecommunicate.hh:181
│ │ │ │ -
size_t counter() const
Definition gridgluecommunicate.hh:169
│ │ │ │ -
void write(const Y &data)
Definition gridgluecommunicate.hh:155
│ │ │ │ -
void read(Y &data) const
Definition gridgluecommunicate.hh:163
│ │ │ │ -
DT value_type
Definition gridgluecommunicate.hh:143
│ │ │ │ -
size_t i
Definition gridgluecommunicate.hh:182
│ │ │ │ -
void clear()
Definition gridgluecommunicate.hh:171
│ │ │ │ -
forward gather scatter to user defined CommInfo class
Definition gridgluecommunicate.hh:194
│ │ │ │ -
static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v, std::size_t i, std::size_t j=0)
Definition gridgluecommunicate.hh:227
│ │ │ │ -
static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i, size_t j=0)
Definition gridgluecommunicate.hh:197
│ │ │ │ -
collects all GridGlue data requried for communication
Definition gridgluecommunicate.hh:272
│ │ │ │ -
Dune::CommunicationDirection dir
Definition gridgluecommunicate.hh:288
│ │ │ │ -
DataTypeImp value_type
Definition gridgluecommunicate.hh:273
│ │ │ │ -
DataTypeImp DataType
Definition gridgluecommunicate.hh:275
│ │ │ │ -
::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data
Definition gridgluecommunicate.hh:282
│ │ │ │ -
GG GridGlue
Definition gridgluecommunicate.hh:274
│ │ │ │ -
size_t currentsize
Definition gridgluecommunicate.hh:287
│ │ │ │ -
CommInfo()
Definition gridgluecommunicate.hh:277
│ │ │ │ -
mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer
Definition gridgluecommunicate.hh:286
│ │ │ │ -
const GridGlue * gridglue
Definition gridgluecommunicate.hh:281
│ │ │ │ -
std::vector< DataType > buffer
Definition gridgluecommunicate.hh:285
│ │ │ │ -
static size_t getSize(const Type &commInfo, size_t i)
Get the number of objects at an intersection.
Definition gridgluecommunicate.hh:320
│ │ │ │ -
DataTypeImp IndexedType
The datatype that should be communicated.
Definition gridgluecommunicate.hh:309
│ │ │ │ -
::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type
The type of the GridGlueCommInfo.
Definition gridgluecommunicate.hh:304
│ │ │ │ -
VariableSize IndexedTypeFlag
Each intersection can communicate a different number of objects.
Definition gridgluecommunicate.hh:315
│ │ │ │ +
Definition intersectionindexset.hh:20
│ │ │ │ +
SizeType size() const
Return total number of intersections.
Definition intersectionindexset.hh:41
│ │ │ │ +
GridGlue::IndexType IndexType
The type used for the indices.
Definition intersectionindexset.hh:27
│ │ │ │ +
IndexType index(const Intersection< P0, P1, I, O > &i) const
Map Dune::GridGlue::Intersection to index.
Definition intersectionindexset.hh:34
│ │ │ │ +
size_t SizeType
The type used for the size.
Definition intersectionindexset.hh:29
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,442 +1,105 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -gridgluecommunicate.hh │ │ │ │ │ +intersectionindexset.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ +_1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ +2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -5#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH │ │ │ │ │ -6#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUECOMMUNICATE_HH │ │ │ │ │ -7 │ │ │ │ │ -13#include │ │ │ │ │ +3#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ │ +4#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ +7#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ +8 │ │ │ │ │ +9#ifndef ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ +10// we currently support only one intersection type. If we want to support │ │ │ │ │ +more, │ │ │ │ │ +11// we have to think about the semantics of our IndexSet │ │ │ │ │ +12#error Not Implemented │ │ │ │ │ +13#endif │ │ │ │ │ 14 │ │ │ │ │ -15#include │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18#include │ │ │ │ │ -19 │ │ │ │ │ -20 │ │ │ │ │ -21namespace _D_u_n_e { │ │ │ │ │ -22 namespace GridGlue { │ │ │ │ │ +15namespace _D_u_n_e { │ │ │ │ │ +16 namespace _G_r_i_d_G_l_u_e { │ │ │ │ │ +17 │ │ │ │ │ +18 template │ │ │ │ │ +_1_9 class _I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t │ │ │ │ │ +20 { │ │ │ │ │ +21 friend class ::Dune::GridGlue::GridGlue; │ │ │ │ │ +22 typedef ::Dune::GridGlue::GridGlue _G_r_i_d_G_l_u_e; │ │ │ │ │ 23 │ │ │ │ │ -_2_4 typedef std::pair _R_a_n_k_P_a_i_r; │ │ │ │ │ -_2_5 struct _G_l_o_b_a_l_I_d : public std::pair │ │ │ │ │ -26 { │ │ │ │ │ -_3_0 _G_l_o_b_a_l_I_d() { │ │ │ │ │ -31 this->first.first = 0; │ │ │ │ │ -32 this->first.second = 0; │ │ │ │ │ -33 this->second = 0; │ │ │ │ │ -34 } │ │ │ │ │ -_3_8 _G_l_o_b_a_l_I_d(int i) { │ │ │ │ │ -39 this->first.first = i; │ │ │ │ │ -40 this->first.second = i; │ │ │ │ │ -41 this->second = 0; │ │ │ │ │ -42 } │ │ │ │ │ -_4_8 _G_l_o_b_a_l_I_d(int i, int j, unsigned int n) { │ │ │ │ │ -49 this->first.first = std::min(i,j); │ │ │ │ │ -50 this->first.second = std::max(i,j); │ │ │ │ │ -51 this->second = n; │ │ │ │ │ -52 } │ │ │ │ │ +24 public: │ │ │ │ │ +25 │ │ │ │ │ +_2_7 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e _I_n_d_e_x_T_y_p_e; │ │ │ │ │ +_2_9 typedef size_t _S_i_z_e_T_y_p_e; │ │ │ │ │ +30 │ │ │ │ │ +33 template │ │ │ │ │ +_3_4 _I_n_d_e_x_T_y_p_e _i_n_d_e_x (const _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_I_,_O_> & i) const │ │ │ │ │ +35 { │ │ │ │ │ +36 return i.i_->_i_n_d_e_x__; │ │ │ │ │ +37 } │ │ │ │ │ +38 │ │ │ │ │ +_4_1 _S_i_z_e_T_y_p_e _s_i_z_e () const │ │ │ │ │ +42 { │ │ │ │ │ +43 return glue_->_s_i_z_e(); │ │ │ │ │ +44 } │ │ │ │ │ +45 │ │ │ │ │ +46 private: │ │ │ │ │ +47 │ │ │ │ │ +49 _I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t(const _G_r_i_d_G_l_u_e * g) : │ │ │ │ │ +50 glue_(g) {} │ │ │ │ │ +51 │ │ │ │ │ +52 const GridGlue * glue_; │ │ │ │ │ 53 }; │ │ │ │ │ 54 │ │ │ │ │ -_5_5 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _G_l_o_b_a_l_I_d & id) │ │ │ │ │ -56 { │ │ │ │ │ -57 os << "(" │ │ │ │ │ -58 << id.first.first << "," << id.first.second << "," │ │ │ │ │ -59 << id.second << ")"; │ │ │ │ │ -60 return os; │ │ │ │ │ -61 } │ │ │ │ │ -62 │ │ │ │ │ -75 template │ │ │ │ │ -_7_6 class _C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ -77 { │ │ │ │ │ -78 public: │ │ │ │ │ -_8_0 typedef DataTypeImp _D_a_t_a_T_y_p_e; │ │ │ │ │ -81 │ │ │ │ │ -82 protected: │ │ │ │ │ -83 // one should not create an explicit instance of this inteface object │ │ │ │ │ -_8_4 _C_o_m_m_D_a_t_a_H_a_n_d_l_e() {} │ │ │ │ │ -85 │ │ │ │ │ -86 public: │ │ │ │ │ -87 │ │ │ │ │ -91 template │ │ │ │ │ -_9_2 size_t _s_i_z_e (RISType& i) const │ │ │ │ │ -93 { │ │ │ │ │ -94 CHECK_INTERFACE_IMPLEMENTATION((asImp()._s_i_z_e(i))); │ │ │ │ │ -95 return asImp().size(i); │ │ │ │ │ -96 } │ │ │ │ │ -97 │ │ │ │ │ -103 template │ │ │ │ │ -_1_0_4 void _g_a_t_h_e_r (MessageBufferImp& buff, const EntityType& e, const RISType & │ │ │ │ │ -i) const │ │ │ │ │ -105 { │ │ │ │ │ -106 MessageBufferIF buffIF(buff); │ │ │ │ │ -107 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp()._g_a_t_h_e_r(buffIF,e,i))); │ │ │ │ │ -108 } │ │ │ │ │ -109 │ │ │ │ │ -117 template │ │ │ │ │ -_1_1_8 void _s_c_a_t_t_e_r (MessageBufferImp& buff, const EntityType& e, const RISType & │ │ │ │ │ -i, size_t n) │ │ │ │ │ -119 { │ │ │ │ │ -120 MessageBufferIF buffIF(buff); │ │ │ │ │ -121 CHECK_AND_CALL_INTERFACE_IMPLEMENTATION((asImp()._s_c_a_t_t_e_r(buffIF,e,i,n))); │ │ │ │ │ -122 } │ │ │ │ │ -123 │ │ │ │ │ -124 private: │ │ │ │ │ -126 DataHandleImp& asImp () { │ │ │ │ │ -127 return static_cast (*this); │ │ │ │ │ -128 } │ │ │ │ │ -130 const DataHandleImp& asImp () const │ │ │ │ │ -131 { │ │ │ │ │ -132 return static_cast(*this); │ │ │ │ │ -133 } │ │ │ │ │ -134 }; // end class CommDataHandleIF │ │ │ │ │ -135 │ │ │ │ │ -140 template │ │ │ │ │ -_1_4_1 class _S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r { │ │ │ │ │ -142 public: │ │ │ │ │ -_1_4_3 typedef DT _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -144 │ │ │ │ │ -145 // Constructor │ │ │ │ │ -_1_4_6 _S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r (DT *p) │ │ │ │ │ -147 { │ │ │ │ │ -148 _a=p; │ │ │ │ │ -149 _i=0; │ │ │ │ │ -150 _j=0; │ │ │ │ │ -151 } │ │ │ │ │ -152 │ │ │ │ │ -153 // write data to message buffer, acts like a stream ! │ │ │ │ │ -154 template │ │ │ │ │ -_1_5_5 void _w_r_i_t_e (const Y& data) │ │ │ │ │ -156 { │ │ │ │ │ -157 static_assert(std::is_same::value, "DataType mismatch"); │ │ │ │ │ -158 _a[_i++] = data; │ │ │ │ │ -159 } │ │ │ │ │ -160 │ │ │ │ │ -161 // read data from message buffer, acts like a stream ! │ │ │ │ │ -162 template │ │ │ │ │ -_1_6_3 void _r_e_a_d (Y& data) const │ │ │ │ │ -164 { │ │ │ │ │ -165 static_assert(std::is_same::value, "DataType mismatch"); │ │ │ │ │ -166 data = _a[_j++]; │ │ │ │ │ -167 } │ │ │ │ │ -168 │ │ │ │ │ -_1_6_9 size_t _c_o_u_n_t_e_r() const { return _i; } │ │ │ │ │ -170 │ │ │ │ │ -_1_7_1 void _c_l_e_a_r() │ │ │ │ │ -172 { │ │ │ │ │ -173 _i = 0; │ │ │ │ │ -174 _j = 0; │ │ │ │ │ -175 } │ │ │ │ │ -176 │ │ │ │ │ -177 // we need access to these variables in an assertion │ │ │ │ │ -178#ifdef NDEBUG │ │ │ │ │ -179 private: │ │ │ │ │ -180#endif │ │ │ │ │ -_1_8_1 DT *_a; │ │ │ │ │ -_1_8_2 size_t _i; │ │ │ │ │ -_1_8_3 mutable size_t _j; │ │ │ │ │ -184 }; │ │ │ │ │ -185 │ │ │ │ │ -192 template │ │ │ │ │ -_1_9_3 class _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ -194 { │ │ │ │ │ -195 public: │ │ │ │ │ -196 template │ │ │ │ │ -_1_9_7 static const typename _C_o_m_m_I_n_f_o_:_:_D_a_t_a_T_y_p_e& _g_a_t_h_e_r(const _C_o_m_m_I_n_f_o& commInfo, │ │ │ │ │ -size_t i, size_t j = 0) │ │ │ │ │ -198 { │ │ │ │ │ -199 // get Intersection │ │ │ │ │ -200 typedef typename CommInfo::GridGlue::Intersection _I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ -201 _I_n_t_e_r_s_e_c_t_i_o_n ris(commInfo._g_r_i_d_g_l_u_e->getIntersection(i)); │ │ │ │ │ -202 │ │ │ │ │ -203 // fill buffer if we have a new intersection │ │ │ │ │ -204 if (j == 0) │ │ │ │ │ -205 { │ │ │ │ │ -206 commInfo._m_b_u_f_f_e_r._c_l_e_a_r(); │ │ │ │ │ -207 if (dir == Dune::ForwardCommunication) │ │ │ │ │ -208 { │ │ │ │ │ -209 // read from grid0 │ │ │ │ │ -210 if(ris._s_e_l_f()) │ │ │ │ │ -211 commInfo._d_a_t_a->gather(commInfo._m_b_u_f_f_e_r, ris._i_n_s_i_d_e(), ris); │ │ │ │ │ -212 } │ │ │ │ │ -213 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ -214 { │ │ │ │ │ -215 // read from grid1 │ │ │ │ │ -216 if(ris._n_e_i_g_h_b_o_r()) │ │ │ │ │ -217 commInfo._d_a_t_a->gather(commInfo._m_b_u_f_f_e_r, ris._o_u_t_s_i_d_e(), ris._f_l_i_p()); │ │ │ │ │ -218 } │ │ │ │ │ -219 } │ │ │ │ │ -220 │ │ │ │ │ -221 // return the j'th value in the buffer │ │ │ │ │ -222 assert(j < commInfo._m_b_u_f_f_e_r._i); │ │ │ │ │ -223 return commInfo._b_u_f_f_e_r[j]; │ │ │ │ │ -224 } │ │ │ │ │ -225 │ │ │ │ │ -226 template │ │ │ │ │ -_2_2_7 static void _s_c_a_t_t_e_r(_C_o_m_m_I_n_f_o& commInfo, const typename _C_o_m_m_I_n_f_o_:_:_D_a_t_a_T_y_p_e& │ │ │ │ │ -v, std::size_t i, std::size_t j = 0) │ │ │ │ │ -228 { │ │ │ │ │ -229 // extract GridGlue objects... │ │ │ │ │ -230 typedef typename CommInfo::GridGlue::Intersection _I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ -231 _I_n_t_e_r_s_e_c_t_i_o_n ris(commInfo._g_r_i_d_g_l_u_e->getIntersection(i)); │ │ │ │ │ -232 │ │ │ │ │ -233 // get size if we have a new intersection │ │ │ │ │ -234 if (j == 0) │ │ │ │ │ -235 { │ │ │ │ │ -236 commInfo._m_b_u_f_f_e_r._c_l_e_a_r(); │ │ │ │ │ -237 commInfo._c_u_r_r_e_n_t_s_i_z_e = commInfo._d_a_t_a->size(ris); │ │ │ │ │ -238 } │ │ │ │ │ -239 │ │ │ │ │ -240 // write entry to buffer │ │ │ │ │ -241 commInfo._b_u_f_f_e_r[j] = v; │ │ │ │ │ -242 │ │ │ │ │ -243 // write back the buffer if we are at the end of this intersection │ │ │ │ │ -244 if (j == commInfo._c_u_r_r_e_n_t_s_i_z_e-1) │ │ │ │ │ -245 { │ │ │ │ │ -246 if (dir == Dune::ForwardCommunication) │ │ │ │ │ -247 { │ │ │ │ │ -248 // write to grid1 │ │ │ │ │ -249 if(ris._n_e_i_g_h_b_o_r()) │ │ │ │ │ -250 commInfo._d_a_t_a->scatter(commInfo._m_b_u_f_f_e_r, ris._o_u_t_s_i_d_e(), ris._f_l_i_p(), │ │ │ │ │ -commInfo._c_u_r_r_e_n_t_s_i_z_e); │ │ │ │ │ -251 } │ │ │ │ │ -252 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ -253 { │ │ │ │ │ -254 // write to grid0 │ │ │ │ │ -255 if(ris._s_e_l_f()) │ │ │ │ │ -256 commInfo._d_a_t_a->scatter(commInfo._m_b_u_f_f_e_r, ris._i_n_s_i_d_e(), ris, │ │ │ │ │ -commInfo._c_u_r_r_e_n_t_s_i_z_e); │ │ │ │ │ -257 } │ │ │ │ │ -258 assert(commInfo._m_b_u_f_f_e_r._j <= commInfo._c_u_r_r_e_n_t_s_i_z_e); │ │ │ │ │ -259 } │ │ │ │ │ -260 } │ │ │ │ │ -261 }; │ │ │ │ │ -262 │ │ │ │ │ -_2_6_3 typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_<_D_u_n_e_:_:_F_o_r_w_a_r_d_C_o_m_m_u_n_i_c_a_t_i_o_n_> _F_o_r_w_a_r_d_O_p_e_r_a_t_o_r; │ │ │ │ │ -_2_6_4 typedef _C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_<_D_u_n_e_:_:_B_a_c_k_w_a_r_d_C_o_m_m_u_n_i_c_a_t_i_o_n_> │ │ │ │ │ -_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r; │ │ │ │ │ -265 │ │ │ │ │ -270 template │ │ │ │ │ -_2_7_1 struct _C_o_m_m_I_n_f_o │ │ │ │ │ -272 { │ │ │ │ │ -_2_7_3 typedef DataTypeImp _v_a_l_u_e___t_y_p_e; │ │ │ │ │ -_2_7_4 typedef GG _G_r_i_d_G_l_u_e; │ │ │ │ │ -_2_7_5 typedef DataTypeImp _D_a_t_a_T_y_p_e; │ │ │ │ │ -276 │ │ │ │ │ -_2_7_7 _C_o_m_m_I_n_f_o() : _b_u_f_f_e_r(100), _m_b_u_f_f_e_r(&_b_u_f_f_e_r[0]) │ │ │ │ │ -278 {} │ │ │ │ │ -279 │ │ │ │ │ -280 // tunnel information to the policy and the operators │ │ │ │ │ -_2_8_1 const _G_r_i_d_G_l_u_e * _g_r_i_d_g_l_u_e; │ │ │ │ │ -_2_8_2 _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_> * _d_a_t_a; │ │ │ │ │ -283 │ │ │ │ │ -284 // state variables │ │ │ │ │ -_2_8_5 std::vector _b_u_f_f_e_r; │ │ │ │ │ -_2_8_6 mutable ::Dune::GridGlue::StreamingMessageBuffer _m_b_u_f_f_e_r; │ │ │ │ │ -_2_8_7 size_t _c_u_r_r_e_n_t_s_i_z_e; │ │ │ │ │ -_2_8_8 Dune::CommunicationDirection _d_i_r; │ │ │ │ │ -289 }; │ │ │ │ │ -290 │ │ │ │ │ -291 } // end namespace GridGlue │ │ │ │ │ -292 │ │ │ │ │ -293#if HAVE_MPI │ │ │ │ │ -298 template │ │ │ │ │ -_2_9_9 struct CommPolicy< ::_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o > │ │ │ │ │ -300 { │ │ │ │ │ -_3_0_4 typedef ::Dune::GridGlue::CommInfo _T_y_p_e; │ │ │ │ │ -305 │ │ │ │ │ -_3_0_9 typedef DataTypeImp _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ │ -310 │ │ │ │ │ -314 // typedef SizeOne IndexedTypeFlag; │ │ │ │ │ -_3_1_5 typedef VariableSize _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ │ -316 │ │ │ │ │ -_3_2_0 static size_t _g_e_t_S_i_z_e(const _T_y_p_e& commInfo, size_t i) │ │ │ │ │ -321 { │ │ │ │ │ -322 // get Intersection │ │ │ │ │ -323 typedef typename Type::GridGlue::Intersection Intersection; │ │ │ │ │ -324 Intersection ris(commInfo._g_r_i_d_g_l_u_e->getIntersection(i)); │ │ │ │ │ -325 │ │ │ │ │ -326 // ask data handle for size │ │ │ │ │ -327 return commInfo._d_a_t_a->size(ris); │ │ │ │ │ -328 } │ │ │ │ │ -329 }; │ │ │ │ │ -330#endif │ │ │ │ │ -331 │ │ │ │ │ -332} // end namespace Dune │ │ │ │ │ -333#endif │ │ │ │ │ +55 } // end namespace GridGlue │ │ │ │ │ +56} // end namespace Dune │ │ │ │ │ +57 │ │ │ │ │ +58#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ │ +_g_r_i_d_g_l_u_e_._h_h │ │ │ │ │ +Central component of the module implementing the coupling of two grids. │ │ │ │ │ +_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ +Model of the Intersection concept provided by GridGlue. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ -CommunicationOperator< Dune::BackwardCommunication > BackwardOperator │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:264 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_F_o_r_w_a_r_d_O_p_e_r_a_t_o_r │ │ │ │ │ -CommunicationOperator< Dune::ForwardCommunication > ForwardOperator │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:263 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_a_n_k_P_a_i_r │ │ │ │ │ -std::pair< int, int > RankPair │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:24 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ │ -std::ostream & operator<<(std::ostream &os, const GlobalId &id) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:55 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ +sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ +DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ +unsigned int IndexType │ │ │ │ │ +DDeeffiinniittiioonn gridglue.hh:147 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_s_i_z_e │ │ │ │ │ +size_t size() const │ │ │ │ │ +DDeeffiinniittiioonn gridglue.hh:393 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_:_:_i_n_d_e_x__ │ │ │ │ │ +IndexType index_ │ │ │ │ │ +index of this intersection after GridGlue interface │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:112 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ The intersection of two entities of the two patches of a GridGlue. │ │ │ │ │ DDeeffiinniittiioonn intersection.hh:261 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_f_l_i_p │ │ │ │ │ -Intersection< P0, P1, O, I > flip() const │ │ │ │ │ -Return a copy of the intersection with inside and outside switched. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:483 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_s_e_l_f │ │ │ │ │ -bool self() const │ │ │ │ │ -For parallel computations: Return true if inside() entity exists locally. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:393 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_i_n_s_i_d_e │ │ │ │ │ -InsideEntity inside(unsigned int parentId=0) const │ │ │ │ │ -Return element on the inside of this intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:319 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_n_e_i_g_h_b_o_r │ │ │ │ │ -size_t neighbor(unsigned int g=0) const │ │ │ │ │ -Return number of embeddings into local grid0 (grid1) entities. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:399 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_o_u_t_s_i_d_e │ │ │ │ │ -OutsideEntity outside(unsigned int parentId=0) const │ │ │ │ │ -Return element on the outside of this intersection. │ │ │ │ │ -DDeeffiinniittiioonn intersection.hh:328 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:26 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ -GlobalId(int i) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:38 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ -GlobalId() │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:30 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ -GlobalId(int i, int j, unsigned int n) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:48 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ -describes the features of a data handle for communication in parallel runs │ │ │ │ │ -using the GridGlue::commun... │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_i_z_e │ │ │ │ │ -size_t size(RISType &i) const │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_c_a_t_t_e_r │ │ │ │ │ -void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, │ │ │ │ │ -size_t n) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:118 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_g_a_t_h_e_r │ │ │ │ │ -void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) │ │ │ │ │ -const │ │ │ │ │ -pack data from user to message buffer │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:104 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_D_a_t_a_T_y_p_e │ │ │ │ │ -DataTypeImp DataType │ │ │ │ │ -data type of data to communicate │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ -CommDataHandle() │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:141 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_j │ │ │ │ │ -size_t j │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:183 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r │ │ │ │ │ -StreamingMessageBuffer(DT *p) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:146 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_a │ │ │ │ │ -DT * a │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:181 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_c_o_u_n_t_e_r │ │ │ │ │ -size_t counter() const │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:169 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_w_r_i_t_e │ │ │ │ │ -void write(const Y &data) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:155 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_r_e_a_d │ │ │ │ │ -void read(Y &data) const │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:163 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -DT value_type │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:143 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_i │ │ │ │ │ -size_t i │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:182 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_:_:_c_l_e_a_r │ │ │ │ │ -void clear() │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ -forward gather scatter to user defined CommInfo class │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:194 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_:_:_s_c_a_t_t_e_r │ │ │ │ │ -static void scatter(CommInfo &commInfo, const typename CommInfo::DataType &v, │ │ │ │ │ -std::size_t i, std::size_t j=0) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:227 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r_:_:_g_a_t_h_e_r │ │ │ │ │ -static const CommInfo::DataType & gather(const CommInfo &commInfo, size_t i, │ │ │ │ │ -size_t j=0) │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:197 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o │ │ │ │ │ -collects all GridGlue data requried for communication │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:272 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_i_r │ │ │ │ │ -Dune::CommunicationDirection dir │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:288 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ │ -DataTypeImp value_type │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:273 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_D_a_t_a_T_y_p_e │ │ │ │ │ -DataTypeImp DataType │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_a_t_a │ │ │ │ │ -::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:282 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ -GG GridGlue │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:274 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_c_u_r_r_e_n_t_s_i_z_e │ │ │ │ │ -size_t currentsize │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:287 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_C_o_m_m_I_n_f_o │ │ │ │ │ -CommInfo() │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:277 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_m_b_u_f_f_e_r │ │ │ │ │ -mutable ::Dune::GridGlue::StreamingMessageBuffer< DataType > mbuffer │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:286 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_g_r_i_d_g_l_u_e │ │ │ │ │ -const GridGlue * gridglue │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:281 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_b_u_f_f_e_r │ │ │ │ │ -std::vector< DataType > buffer │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:285 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ -_>_:_:_g_e_t_S_i_z_e │ │ │ │ │ -static size_t getSize(const Type &commInfo, size_t i) │ │ │ │ │ -Get the number of objects at an intersection. │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:320 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ -_>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ │ -DataTypeImp IndexedType │ │ │ │ │ -The datatype that should be communicated. │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:309 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ -_>_:_:_T_y_p_e │ │ │ │ │ -::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > Type │ │ │ │ │ -The type of the GridGlueCommInfo. │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:304 │ │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _:_:_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_ _G_G_,_ _D_a_t_a_H_a_n_d_l_e_I_m_p_,_ _D_a_t_a_T_y_p_e_I_m_p_ _> │ │ │ │ │ -_>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ │ -VariableSize IndexedTypeFlag │ │ │ │ │ -Each intersection can communicate a different number of objects. │ │ │ │ │ -DDeeffiinniittiioonn gridgluecommunicate.hh:315 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t │ │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:20 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_s_i_z_e │ │ │ │ │ +SizeType size() const │ │ │ │ │ +Return total number of intersections. │ │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ +GridGlue::IndexType IndexType │ │ │ │ │ +The type used for the indices. │ │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_i_n_d_e_x │ │ │ │ │ +IndexType index(const Intersection< P0, P1, I, O > &i) const │ │ │ │ │ +Map Dune::GridGlue::Intersection to index. │ │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_S_i_z_e_T_y_p_e │ │ │ │ │ +size_t SizeType │ │ │ │ │ +The type used for the size. │ │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:29 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: rangegenerators.hh File Reference │ │ │ │ +dune-grid-glue: gridglue.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,42 +70,40 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
rangegenerators.hh File Reference
│ │ │ │ +
gridglue.cc File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/common/iteratorrange.hh>
│ │ │ │ +
#include "intersection.hh"
│ │ │ │ +#include <vector>
│ │ │ │ +#include <iterator>
│ │ │ │ +#include "../gridglue.hh"
│ │ │ │ +#include "../common/ringcomm.hh"
│ │ │ │ +#include <dune/common/unused.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

struct  Dune::GridGlue::Reverse< reverse >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

template<... >
IteratorRange<... > Dune::GridGlue::intersections (const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
 Iterate over all intersections of a GridGlue.
 
template<typename T >
void Dune::GridGlue::printVector (const std::vector< T > &v, std::string name, int rank)
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,27 +1,28 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -rangegenerators.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +gridglue.cc File Reference │ │ │ │ │ +#include "_i_n_t_e_r_s_e_c_t_i_o_n_._h_h" │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_._._/_g_r_i_d_g_l_u_e_._h_h" │ │ │ │ │ +#include "_._._/_c_o_m_m_o_n_/_r_i_n_g_c_o_m_m_._h_h" │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_<_ _r_e_v_e_r_s_e_ _> │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template<... > │ │ │ │ │ -IteratorRange<... >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s (const _G_r_i_d_G_l_u_e<... > &glue, │ │ │ │ │ - const _R_e_v_e_r_s_e<... > &reverse=!reversed) │ │ │ │ │ -  Iterate over all intersections of a _G_r_i_d_G_l_u_e. │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t_V_e_c_t_o_r (const std::vector< T > &v, std::string name, │ │ │ │ │ + int rank) │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: rangegenerators.hh Source File │ │ │ │ +dune-grid-glue: gridglue.cc Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,78 +74,502 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
rangegenerators.hh
│ │ │ │ +
gridglue.cc
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
3#ifndef DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH
│ │ │ │ -
5
│ │ │ │ -
6#include <dune/common/iteratorrange.hh>
│ │ │ │ -
7
│ │ │ │ -
8namespace Dune {
│ │ │ │ -
9namespace GridGlue {
│ │ │ │ -
10
│ │ │ │ -
14template<bool reverse>
│ │ │ │ -
│ │ │ │ -
15struct Reverse
│ │ │ │ -
16 : std::integral_constant<bool, reverse>
│ │ │ │ -
17{
│ │ │ │ -
18 typedef Reverse type;
│ │ │ │ +Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ +
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ +
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ +
5/* IMPLEMENTATION OF CLASS G R I D G L U E */
│ │ │ │ +
6
│ │ │ │ +
7#include "intersection.hh"
│ │ │ │ +
8#include <vector>
│ │ │ │ +
9#include <iterator>
│ │ │ │ +
10#include "../gridglue.hh"
│ │ │ │ +
11#if HAVE_MPI
│ │ │ │ +
12#include "../common/ringcomm.hh"
│ │ │ │ +
13#endif
│ │ │ │ +
14
│ │ │ │ +
15#include <dune/common/unused.hh>
│ │ │ │ +
16
│ │ │ │ +
17namespace Dune {
│ │ │ │ +
18namespace GridGlue {
│ │ │ │
19
│ │ │ │ -
20 constexpr
│ │ │ │ +
20template<typename P0, typename P1>
│ │ │ │
│ │ │ │ - │ │ │ │ -
22 { return {}; }
│ │ │ │ +
21GridGlue<P0, P1>::GridGlue(const std::shared_ptr< const GridPatch<0> >& gp0, const std::shared_ptr< const GridPatch<1> >& gp1, const std::shared_ptr<Merger>& merger)
│ │ │ │ +
22 : patches_{gp0, gp1}, merger_(merger)
│ │ │ │ +
23{
│ │ │ │ +
24#if HAVE_MPI
│ │ │ │ +
25 // if we have only seq. meshes don't use parallel glueing
│ │ │ │ +
26 if (gp0->gridView().comm().size() == 1
│ │ │ │ +
27 && gp1->gridView().comm().size() == 1)
│ │ │ │ +
28 mpicomm_ = MPI_COMM_SELF;
│ │ │ │ +
29 else
│ │ │ │ +
30 mpicomm_ = MPI_COMM_WORLD;
│ │ │ │ +
31#endif // HAVE_MPI
│ │ │ │ +
32 std::cout << "GridGlue: Constructor succeeded!" << std::endl;
│ │ │ │ +
33}
│ │ │ │
│ │ │ │ -
23};
│ │ │ │ -
│ │ │ │ -
24
│ │ │ │ -
25#ifdef DOXYGEN
│ │ │ │ -
26
│ │ │ │ - │ │ │ │ -
32
│ │ │ │ -
66template<...>
│ │ │ │ -
67IteratorRange<...>
│ │ │ │ -
68intersections(const GridGlue<...>& glue, const Reverse<...>& reverse = !reversed);
│ │ │ │ -
69
│ │ │ │ -
70#else
│ │ │ │ -
71
│ │ │ │ -
72namespace {
│ │ │ │ -
73const Reverse<true> reversed = {};
│ │ │ │ -
74} /* namespace */
│ │ │ │ -
75
│ │ │ │ -
76template<typename P0, typename P1, bool reverse = false>
│ │ │ │ -
77IteratorRange< typename GridGlue<P0, P1>::template IntersectionIterator<reverse ? 1 : 0> >
│ │ │ │ -
78intersections(const GridGlue<P0, P1>& glue, const Reverse<reverse>& = {})
│ │ │ │ -
79{
│ │ │ │ -
80 const static int side = reverse ? 1 : 0;
│ │ │ │ -
81 return {glue.template ibegin<side>(), glue.template iend<side>()};
│ │ │ │ -
82}
│ │ │ │ -
83
│ │ │ │ -
84#endif // DOXYGEN
│ │ │ │ +
34
│ │ │ │ +
35template<typename P0, typename P1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
37{
│ │ │ │ +
38 int myrank = 0;
│ │ │ │ +
39#if HAVE_MPI
│ │ │ │ +
40 int commsize = 1;
│ │ │ │ +
41 MPI_Comm_rank(mpicomm_, &myrank);
│ │ │ │ +
42 MPI_Comm_size(mpicomm_, &commsize);
│ │ │ │ +
43#endif // HAVE_MPI
│ │ │ │ +
44
│ │ │ │ +
45 // clear the contents from the current intersections array
│ │ │ │ +
46 {
│ │ │ │ +
47 std::vector<IntersectionData> dummy(1); // we need size 1, as we always store data for the end-intersection
│ │ │ │ +
48 intersections_.swap(dummy);
│ │ │ │ +
49 }
│ │ │ │ +
50
│ │ │ │ +
51 std::vector<Dune::FieldVector<ctype, dimworld> > patch0coords;
│ │ │ │ +
52 std::vector<unsigned int> patch0entities;
│ │ │ │ +
53 std::vector<Dune::GeometryType> patch0types;
│ │ │ │ +
54 std::vector<Dune::FieldVector<ctype,dimworld> > patch1coords;
│ │ │ │ +
55 std::vector<unsigned int> patch1entities;
│ │ │ │ +
56 std::vector<Dune::GeometryType> patch1types;
│ │ │ │ +
57
│ │ │ │ +
58 /*
│ │ │ │ +
59 * extract global surface patchs
│ │ │ │ +
60 */
│ │ │ │ +
61
│ │ │ │ +
62 // retrieve the coordinate and topology information from the extractors
│ │ │ │ +
63 // and apply transformations if necessary
│ │ │ │ +
64 extractGrid(patch<0>(), patch0coords, patch0entities, patch0types);
│ │ │ │ +
65 extractGrid(patch<1>(), patch1coords, patch1entities, patch1types);
│ │ │ │ +
66
│ │ │ │ +
67 std::cout << ">>>> rank " << myrank << " coords: "
│ │ │ │ +
68 << patch0coords.size() << " and " << patch1coords.size() << std::endl;
│ │ │ │ +
69 std::cout << ">>>> rank " << myrank << " entities: "
│ │ │ │ +
70 << patch0entities.size() << " and " << patch1entities.size() << std::endl;
│ │ │ │ +
71 std::cout << ">>>> rank " << myrank << " types: "
│ │ │ │ +
72 << patch0types.size() << " and " << patch1types.size() << std::endl;
│ │ │ │ +
73
│ │ │ │ +
74#ifdef WRITE_TO_VTK
│ │ │ │ +
75 const char prefix[] = "GridGlue::Builder::build() : ";
│ │ │ │ +
76 char patch0surf[256];
│ │ │ │ +
77 sprintf(patch0surf, "/tmp/vtk-patch0-test-%i", myrank);
│ │ │ │ +
78 char patch1surf[256];
│ │ │ │ +
79 sprintf(patch1surf, "/tmp/vtk-patch1-test-%i", myrank);
│ │ │ │ +
80
│ │ │ │ +
81 // std::cout << prefix << "Writing patch0 surface to '" << patch0surf << ".vtk'...\n";
│ │ │ │ +
82 // VtkSurfaceWriter vtksw(patch0surf);
│ │ │ │ +
83 // vtksw.writeSurface(patch0coords, patch0entities, grid0dim, dimworld);
│ │ │ │ +
84 // std::cout << prefix << "Done writing patch0 surface!\n";
│ │ │ │
85
│ │ │ │ -
86} /* namespace GridGlue */
│ │ │ │ -
87} /* namespace Dune */
│ │ │ │ -
88
│ │ │ │ -
89#endif
│ │ │ │ +
86 // std::cout << prefix << "Writing patch1 surface to '" << patch1surf << ".vtk'...\n";
│ │ │ │ +
87 // vtksw.setFilename(patch1surf);
│ │ │ │ +
88 // vtksw.writeSurface(patch1coords, patch1entities, grid1dim, dimworld);
│ │ │ │ +
89 // std::cout << prefix << "Done writing patch1 surface!\n";
│ │ │ │ +
90#endif // WRITE_TO_VTK
│ │ │ │ +
91
│ │ │ │ +
92 // we start with an empty set
│ │ │ │ +
93 index__sz = 0;
│ │ │ │ +
94
│ │ │ │ +
95#if HAVE_MPI
│ │ │ │ +
96 if (commsize > 1)
│ │ │ │ +
97 {
│ │ │ │ +
98 // setup parallel indexset
│ │ │ │ +
99 patch0_is_.beginResize();
│ │ │ │ +
100 patch1_is_.beginResize();
│ │ │ │ +
101 }
│ │ │ │ +
102
│ │ │ │ +
103 auto op =
│ │ │ │ +
104 [&](
│ │ │ │ +
105 const int mergingrank,
│ │ │ │ +
106 const std::vector<Dune::FieldVector<ctype,dimworld> >& remotePatch0coords,
│ │ │ │ +
107 const std::vector<unsigned int>& remotePatch0entities,
│ │ │ │ +
108 const std::vector<Dune::GeometryType>& remotePatch0types,
│ │ │ │ +
109 const std::vector<Dune::FieldVector<ctype,dimworld> >& remotePatch1coords,
│ │ │ │ +
110 const std::vector<unsigned int>& remotePatch1entities,
│ │ │ │ +
111 const std::vector<Dune::GeometryType>& remotePatch1types
│ │ │ │ +
112 )
│ │ │ │ +
113 {
│ │ │ │ +
114 if (remotePatch1entities.size() > 0 && patch0entities.size() > 0)
│ │ │ │ +
115 mergePatches(patch0coords, patch0entities, patch0types, myrank,
│ │ │ │ +
116 remotePatch1coords, remotePatch1entities, remotePatch1types, mergingrank);
│ │ │ │ +
117 if (mergingrank != myrank &&
│ │ │ │ +
118 remotePatch0entities.size() > 0 && patch1entities.size() > 0)
│ │ │ │ +
119 mergePatches(remotePatch0coords, remotePatch0entities, remotePatch0types, mergingrank,
│ │ │ │ +
120 patch1coords, patch1entities, patch1types, myrank);
│ │ │ │ +
121 };
│ │ │ │ +
122 Parallel::MPI_AllApply(mpicomm_, op,
│ │ │ │ +
123 patch0coords, patch0entities, patch0types,
│ │ │ │ +
124 patch1coords, patch1entities, patch1types
│ │ │ │ +
125 );
│ │ │ │ +
126
│ │ │ │ +
127 if (commsize > 1)
│ │ │ │ +
128 {
│ │ │ │ +
129 // finalize ParallelIndexSet & RemoteIndices
│ │ │ │ +
130 patch0_is_.endResize();
│ │ │ │ +
131 patch1_is_.endResize();
│ │ │ │ +
132
│ │ │ │ +
133 // setup remote index information
│ │ │ │ +
134 remoteIndices_.setIncludeSelf(true);
│ │ │ │ +
135 // #warning add list of neighbors ...
│ │ │ │ +
136 remoteIndices_.setIndexSets(patch0_is_, patch1_is_, mpicomm_) ;
│ │ │ │ +
137 remoteIndices_.rebuild<true/* all indices are public */>();
│ │ │ │ +
138
│ │ │ │ +
139 // DEBUG Print all remote indices
│ │ │ │ +
140#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
│ │ │ │ +
141 for (auto it = remoteIndices_.begin(); it != remoteIndices_.end(); it++)
│ │ │ │ +
142 {
│ │ │ │ +
143 std::cout << myrank << "\tri-list\t" << it->first << std::endl;
│ │ │ │ +
144 for (auto xit = it->second.first->begin(); xit != it->second.first->end(); ++xit)
│ │ │ │ +
145 std::cout << myrank << "\tri-list 1 \t" << it->first << "\t" << *xit << std::endl;
│ │ │ │ +
146 for (auto xit = it->second.second->begin(); xit != it->second.second->end(); ++xit)
│ │ │ │ +
147 std::cout << myrank << "\tri-list 2 \t" << it->first << "\t" << *xit << std::endl;
│ │ │ │ +
148 }
│ │ │ │ +
149#endif
│ │ │ │ +
150 }
│ │ │ │ +
151#else // HAVE_MPI
│ │ │ │ +
152
│ │ │ │ +
153 if (patch1entities.size() > 0 && patch0entities.size() > 0)
│ │ │ │ +
154 {
│ │ │ │ +
155 mergePatches(patch0coords, patch0entities, patch0types, myrank,
│ │ │ │ +
156 patch1coords, patch1entities, patch1types, myrank);
│ │ │ │ +
157#ifdef CALL_MERGER_TWICE
│ │ │ │ +
158 mergePatches(patch0coords, patch0entities, patch0types, myrank,
│ │ │ │ +
159 patch1coords, patch1entities, patch1types, myrank);
│ │ │ │ +
160#endif
│ │ │ │ +
161 }
│ │ │ │ +
162
│ │ │ │ +
163#endif // HAVE_MPI
│ │ │ │ +
164
│ │ │ │ +
165}
│ │ │ │ +
│ │ │ │ +
166
│ │ │ │ +
167template<typename T>
│ │ │ │ +
│ │ │ │ +
168void printVector(const std::vector<T> & v, std::string name, int rank)
│ │ │ │ +
169{
│ │ │ │ +
170 std::cout << rank << ": " << name << std::endl;
│ │ │ │ +
171 for (size_t i=0; i<v.size(); i++)
│ │ │ │ +
172 {
│ │ │ │ +
173 std::cout << v[i] << " ";
│ │ │ │ +
174 }
│ │ │ │ +
175 std::cout << std::endl;
│ │ │ │ +
176}
│ │ │ │ +
│ │ │ │ +
177
│ │ │ │ +
178template<typename P0, typename P1>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
180 const std::vector<Dune::FieldVector<ctype,dimworld> >& patch0coords,
│ │ │ │ +
181 const std::vector<unsigned int>& patch0entities,
│ │ │ │ +
182 const std::vector<Dune::GeometryType>& patch0types,
│ │ │ │ +
183 const int patch0rank,
│ │ │ │ +
184 const std::vector<Dune::FieldVector<ctype,dimworld> >& patch1coords,
│ │ │ │ +
185 const std::vector<unsigned int>& patch1entities,
│ │ │ │ +
186 const std::vector<Dune::GeometryType>& patch1types,
│ │ │ │ +
187 const int patch1rank)
│ │ │ │ +
188{
│ │ │ │ +
189
│ │ │ │ +
190 // howto handle overlap etc?
│ │ │ │ +
191
│ │ │ │ +
192 int myrank = 0;
│ │ │ │ +
193#if HAVE_MPI
│ │ │ │ +
194 int commsize = 1;
│ │ │ │ +
195 MPI_Comm_rank(mpicomm_, &myrank);
│ │ │ │ +
196 MPI_Comm_size(mpicomm_, &commsize);
│ │ │ │ +
197#endif // HAVE_MPI
│ │ │ │ +
198
│ │ │ │ +
199 // which patches are local?
│ │ │ │ +
200 const bool patch0local = (myrank == patch0rank);
│ │ │ │ +
201 const bool patch1local = (myrank == patch1rank);
│ │ │ │ +
202
│ │ │ │ +
203 // remember the number of previous remote intersections
│ │ │ │ +
204 const unsigned int offset = intersections_.size()-1;
│ │ │ │ +
205
│ │ │ │ +
206 std::cout << myrank
│ │ │ │ +
207 << " GridGlue::mergePatches : rank " << patch0rank << " / " << patch1rank << std::endl;
│ │ │ │ +
208
│ │ │ │ +
209 // start the actual build process
│ │ │ │ +
210 merger_->build(patch0coords, patch0entities, patch0types,
│ │ │ │ +
211 patch1coords, patch1entities, patch1types);
│ │ │ │ +
212
│ │ │ │ +
213 // append to intersections list
│ │ │ │ +
214 intersections_.resize(merger_->nSimplices() + offset + 1);
│ │ │ │ +
215 for (unsigned int i = 0; i < merger_->nSimplices(); ++i)
│ │ │ │ +
216 intersections_[offset + i] = IntersectionData(*this, i, offset, patch0local, patch1local);
│ │ │ │ +
217
│ │ │ │ +
218 index__sz = intersections_.size() - 1;
│ │ │ │ +
219
│ │ │ │ +
220 std::cout << myrank
│ │ │ │ +
221 << " GridGlue::mergePatches : "
│ │ │ │ +
222 << "The number of remote intersections is " << intersections_.size()-1 << std::endl;
│ │ │ │ +
223
│ │ │ │ +
224#if 0
│ │ │ │ +
225 printVector(patch0coords,"patch0coords",myrank);
│ │ │ │ +
226 printVector(patch0entities,"patch0entities",myrank);
│ │ │ │ +
227 printVector(patch0types,"patch0types",myrank);
│ │ │ │ +
228 printVector(patch1coords,"patch1coords",myrank);
│ │ │ │ +
229 printVector(patch1entities,"patch1entities",myrank);
│ │ │ │ +
230 printVector(patch1types,"patch1types",myrank);
│ │ │ │ +
231#endif
│ │ │ │ +
232
│ │ │ │ +
233#if HAVE_MPI
│ │ │ │ +
234 if (commsize > 1)
│ │ │ │ +
235 {
│ │ │ │ +
236 // update remote index sets
│ │ │ │ +
237 assert(Dune::RESIZE == patch0_is_.state());
│ │ │ │ +
238 assert(Dune::RESIZE == patch1_is_.state());
│ │ │ │ +
239
│ │ │ │ +
240 for (unsigned int i = 0; i < merger_->nSimplices(); i++)
│ │ │ │ +
241 {
│ │ │ │ +
242 // #warning only handle the newest intersections / merger info
│ │ │ │ +
243 const IntersectionData & it = intersections_[i];
│ │ │ │ +
244 GlobalId gid(patch0rank, patch1rank, i);
│ │ │ │ +
245 if (it.template local<0>())
│ │ │ │ +
246 {
│ │ │ │ +
247 Dune::PartitionType ptype = patch<0>().element(it.template index<0>()).partitionType();
│ │ │ │ +
248 patch0_is_.add (gid, LocalIndex(offset+i, ptype) );
│ │ │ │ +
249 }
│ │ │ │ +
250 if (it.template local<1>())
│ │ │ │ +
251 {
│ │ │ │ +
252 Dune::PartitionType ptype = patch<1>().element(it.template index<1>()).partitionType();
│ │ │ │ +
253 patch1_is_.add (gid, LocalIndex(offset+i, ptype) );
│ │ │ │ +
254 }
│ │ │ │ +
255 }
│ │ │ │ +
256 }
│ │ │ │ +
257#endif // HAVE_MPI
│ │ │ │ +
258
│ │ │ │ +
259 // cleanup the merger
│ │ │ │ +
260 merger_->clear();
│ │ │ │ +
261}
│ │ │ │ +
│ │ │ │ +
262
│ │ │ │ +
263template<typename P0, typename P1>
│ │ │ │ +
264template<typename Extractor>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
266 std::vector<Dune::FieldVector<ctype, dimworld> > & coords,
│ │ │ │ +
267 std::vector<unsigned int> & entities,
│ │ │ │ +
268 std::vector<Dune::GeometryType>& geometryTypes) const
│ │ │ │ +
269{
│ │ │ │ +
270 std::vector<typename Extractor::Coords> tempcoords;
│ │ │ │ +
271 std::vector<typename Extractor::VertexVector> tempentities;
│ │ │ │ +
272
│ │ │ │ +
273 extractor.getCoords(tempcoords);
│ │ │ │ +
274 coords.clear();
│ │ │ │ +
275 coords.reserve(tempcoords.size());
│ │ │ │ +
276
│ │ │ │ +
277 for (unsigned int i = 0; i < tempcoords.size(); ++i)
│ │ │ │ +
278 {
│ │ │ │ +
279 assert(int(dimworld) == int(Extractor::dimworld));
│ │ │ │ +
280 coords.push_back(Dune::FieldVector<ctype, dimworld>());
│ │ │ │ +
281 for (size_t j = 0; j <dimworld; ++j)
│ │ │ │ +
282 coords.back()[j] = tempcoords[i][j];
│ │ │ │ +
283 }
│ │ │ │ +
284
│ │ │ │ +
285 extractor.getFaces(tempentities);
│ │ │ │ +
286 entities.clear();
│ │ │ │ +
287
│ │ │ │ +
288 for (unsigned int i = 0; i < tempentities.size(); ++i) {
│ │ │ │ +
289 for (unsigned int j = 0; j < tempentities[i].size(); ++j)
│ │ │ │ +
290 entities.push_back(tempentities[i][j]);
│ │ │ │ +
291 }
│ │ │ │ +
292
│ │ │ │ +
293 // get the list of geometry types from the extractor
│ │ │ │ +
294 extractor.getGeometryTypes(geometryTypes);
│ │ │ │ +
295
│ │ │ │ +
296}
│ │ │ │ +
│ │ │ │ +
297
│ │ │ │ +
298template<typename P0, typename P1>
│ │ │ │ +
299template<class DataHandleImp, class DataTypeImp>
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ +
302 Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const
│ │ │ │ +
303{
│ │ │ │ + │ │ │ │ +
305 typedef typename DataHandle::DataType DataType;
│ │ │ │ +
306
│ │ │ │ +
307#if HAVE_MPI
│ │ │ │ +
308
│ │ │ │ +
309 if (mpicomm_ != MPI_COMM_SELF)
│ │ │ │ +
310 {
│ │ │ │ +
311 /*
│ │ │ │ +
312 * P A R A L L E L V E R S I O N
│ │ │ │ +
313 */
│ │ │ │ +
314 // setup communication interfaces
│ │ │ │ +
315 Dune::dinfo << "GridGlue: parallel communication" << std::endl;
│ │ │ │ +
316 typedef Dune::EnumItem <Dune::PartitionType, Dune::InteriorEntity> InteriorFlags;
│ │ │ │ +
317 typedef Dune::EnumItem <Dune::PartitionType, Dune::OverlapEntity> OverlapFlags;
│ │ │ │ +
318 typedef Dune::EnumRange <Dune::PartitionType, Dune::InteriorEntity, Dune::GhostEntity> AllFlags;
│ │ │ │ +
319 Dune::Interface interface;
│ │ │ │ +
320 assert(remoteIndices_.isSynced());
│ │ │ │ +
321 switch (iftype)
│ │ │ │ +
322 {
│ │ │ │ +
323 case Dune::InteriorBorder_InteriorBorder_Interface :
│ │ │ │ +
324 interface.build (remoteIndices_, InteriorFlags(), InteriorFlags() );
│ │ │ │ +
325 break;
│ │ │ │ +
326 case Dune::InteriorBorder_All_Interface :
│ │ │ │ +
327 if (dir == Dune::ForwardCommunication)
│ │ │ │ +
328 interface.build (remoteIndices_, InteriorFlags(), AllFlags() );
│ │ │ │ +
329 else
│ │ │ │ +
330 interface.build (remoteIndices_, AllFlags(), InteriorFlags() );
│ │ │ │ +
331 break;
│ │ │ │ +
332 case Dune::Overlap_OverlapFront_Interface :
│ │ │ │ +
333 interface.build (remoteIndices_, OverlapFlags(), OverlapFlags() );
│ │ │ │ +
334 break;
│ │ │ │ +
335 case Dune::Overlap_All_Interface :
│ │ │ │ +
336 if (dir == Dune::ForwardCommunication)
│ │ │ │ +
337 interface.build (remoteIndices_, OverlapFlags(), AllFlags() );
│ │ │ │ +
338 else
│ │ │ │ +
339 interface.build (remoteIndices_, AllFlags(), OverlapFlags() );
│ │ │ │ +
340 break;
│ │ │ │ +
341 case Dune::All_All_Interface :
│ │ │ │ +
342 interface.build (remoteIndices_, AllFlags(), AllFlags() );
│ │ │ │ +
343 break;
│ │ │ │ +
344 default :
│ │ │ │ +
345 DUNE_THROW(Dune::NotImplemented, "GridGlue::communicate for interface " << iftype << " not implemented");
│ │ │ │ +
346 }
│ │ │ │ +
347
│ │ │ │ +
348 // setup communication info (class needed to tunnel all info to the operator)
│ │ │ │ + │ │ │ │ +
350 CommInfo commInfo;
│ │ │ │ +
351 commInfo.dir = dir;
│ │ │ │ +
352 commInfo.gridglue = this;
│ │ │ │ +
353 commInfo.data = &data;
│ │ │ │ +
354
│ │ │ │ +
355 // create communicator
│ │ │ │ +
356 Dune::BufferedCommunicator bComm ;
│ │ │ │ +
357 bComm.template build< CommInfo >(commInfo, commInfo, interface);
│ │ │ │ +
358
│ │ │ │ +
359 // do communication
│ │ │ │ +
360 // choose communication direction.
│ │ │ │ +
361 if (dir == Dune::ForwardCommunication)
│ │ │ │ +
362 bComm.forward< Dune::GridGlue::ForwardOperator >(commInfo, commInfo);
│ │ │ │ +
363 else
│ │ │ │ +
364 bComm.backward< Dune::GridGlue::BackwardOperator >(commInfo, commInfo);
│ │ │ │ +
365 }
│ │ │ │ +
366 else
│ │ │ │ +
367#endif // HAVE_MPI
│ │ │ │ +
368 {
│ │ │ │ +
369 /*
│ │ │ │ +
370 * S E Q U E N T I A L V E R S I O N
│ │ │ │ +
371 */
│ │ │ │ +
372 Dune::dinfo << "GridGlue: sequential fallback communication" << std::endl;
│ │ │ │ +
373
│ │ │ │ +
374 // get comm buffer size
│ │ │ │ +
375 int ssz = size() * 10; // times data per intersection
│ │ │ │ +
376 int rsz = size() * 10;
│ │ │ │ +
377
│ │ │ │ +
378 // allocate send/receive buffer
│ │ │ │ +
379 auto sendbuffer = std::make_unique<DataType[]>(ssz);
│ │ │ │ +
380 auto receivebuffer = std::make_unique<DataType[]>(rsz);
│ │ │ │ +
381
│ │ │ │ +
382 // gather
│ │ │ │ +
383 Dune::GridGlue::StreamingMessageBuffer<DataType> gatherbuffer(sendbuffer.get());
│ │ │ │ +
384 for (const auto& in : intersections(*this))
│ │ │ │ +
385 {
│ │ │ │ +
386 /*
│ │ │ │ +
387 we need to have to variants depending on the communication direction.
│ │ │ │ +
388 */
│ │ │ │ +
389 if (dir == Dune::ForwardCommunication)
│ │ │ │ +
390 {
│ │ │ │ +
391 /*
│ │ │ │ +
392 dir : Forward (grid0 -> grid1)
│ │ │ │ +
393 */
│ │ │ │ +
394 if (in.self())
│ │ │ │ +
395 {
│ │ │ │ +
396 data.gather(gatherbuffer, in.inside(), in);
│ │ │ │ +
397 }
│ │ │ │ +
398 }
│ │ │ │ +
399 else // (dir == Dune::BackwardCommunication)
│ │ │ │ +
400 {
│ │ │ │ +
401 /*
│ │ │ │ +
402 dir : Backward (grid1 -> grid0)
│ │ │ │ +
403 */
│ │ │ │ +
404 if (in.neighbor())
│ │ │ │ +
405 {
│ │ │ │ +
406 data.gather(gatherbuffer, in.outside(), in.flip());
│ │ │ │ +
407 }
│ │ │ │ +
408 }
│ │ │ │ +
409 }
│ │ │ │ +
410
│ │ │ │ +
411 assert(ssz == rsz);
│ │ │ │ +
412 for (int i=0; i<ssz; i++)
│ │ │ │ +
413 receivebuffer[i] = sendbuffer[i];
│ │ │ │ +
414
│ │ │ │ +
415 // scatter
│ │ │ │ +
416 Dune::GridGlue::StreamingMessageBuffer<DataType> scatterbuffer(receivebuffer.get());
│ │ │ │ +
417 for (const auto& in : intersections(*this))
│ │ │ │ +
418 {
│ │ │ │ +
419 /*
│ │ │ │ +
420 we need to have to variants depending on the communication direction.
│ │ │ │ +
421 */
│ │ │ │ +
422 if (dir == Dune::ForwardCommunication)
│ │ │ │ +
423 {
│ │ │ │ +
424 /*
│ │ │ │ +
425 dir : Forward (grid0 -> grid1)
│ │ │ │ +
426 */
│ │ │ │ +
427 if (in.neighbor())
│ │ │ │ +
428 data.scatter(scatterbuffer, in.outside(), in.flip(),
│ │ │ │ +
429 data.size(in));
│ │ │ │ +
430 }
│ │ │ │ +
431 else // (dir == Dune::BackwardCommunication)
│ │ │ │ +
432 {
│ │ │ │ +
433 /*
│ │ │ │ +
434 dir : Backward (grid1 -> grid0)
│ │ │ │ +
435 */
│ │ │ │ +
436 if (in.self())
│ │ │ │ +
437 data.scatter(scatterbuffer, in.inside(), in,
│ │ │ │ +
438 data.size(in));
│ │ │ │ +
439 }
│ │ │ │ +
440 }
│ │ │ │ +
441 }
│ │ │ │ +
442}
│ │ │ │ +
│ │ │ │ +
443
│ │ │ │ +
444} // end namespace GridGlue
│ │ │ │ +
445} // end namespace Dune
│ │ │ │ +
Model of the Intersection concept provided by GridGlue.
│ │ │ │
Definition gridglue.hh:37
│ │ │ │
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ +
void printVector(const std::vector< T > &v, std::string name, int rank)
Definition gridglue.cc:168
│ │ │ │ +
void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data)
apply an operator locally to a difstributed data set
Definition ringcomm.hh:297
│ │ │ │
sequential adapter to couple two grids at specified close together boundaries
Definition gridglue.hh:67
│ │ │ │ -
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ -
Definition rangegenerators.hh:17
│ │ │ │ -
const Reverse< true > reversed
Definition rangegenerators.hh:31
│ │ │ │ -
Reverse type
Definition rangegenerators.hh:18
│ │ │ │ -
constexpr Reverse<!reverse > operator!() const
Definition rangegenerators.hh:21
│ │ │ │ +
void mergePatches(const std::vector< Dune::FieldVector< ctype, dimworld > > &patch0coords, const std::vector< unsigned int > &patch0entities, const std::vector< Dune::GeometryType > &patch0types, const int patch0rank, const std::vector< Dune::FieldVector< ctype, dimworld > > &patch1coords, const std::vector< unsigned int > &patch1entities, const std::vector< Dune::GeometryType > &patch1types, const int patch1rank)
after building the merged grid the intersection can be updated through this method (for internal use)
Definition gridglue.cc:179
│ │ │ │ +
void communicate(Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > &data, Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const
Communicate information on the MergedGrid of a GridGlue.
Definition gridglue.cc:300
│ │ │ │ +
void build()
Definition gridglue.cc:36
│ │ │ │ +
void extractGrid(const Extractor &extractor, std::vector< Dune::FieldVector< ctype, dimworld > > &coords, std::vector< unsigned int > &faces, std::vector< Dune::GeometryType > &geometryTypes) const
Definition gridglue.cc:265
│ │ │ │ +
std::conditional_t< side==0, P0, std::conditional_t< side==1, P1, void > > GridPatch
Definition gridglue.hh:96
│ │ │ │ +
storage class for Dune::GridGlue::Intersection related data
Definition intersection.hh:38
│ │ │ │ +
Definition gridgluecommunicate.hh:26
│ │ │ │ +
describes the features of a data handle for communication in parallel runs using the GridGlue::commun...
Definition gridgluecommunicate.hh:77
│ │ │ │ +
size_t size(RISType &i) const
Definition gridgluecommunicate.hh:92
│ │ │ │ +
void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, size_t n)
Definition gridgluecommunicate.hh:118
│ │ │ │ +
void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) const
pack data from user to message buffer
Definition gridgluecommunicate.hh:104
│ │ │ │ +
Definition gridgluecommunicate.hh:141
│ │ │ │ +
forward gather scatter to user defined CommInfo class
Definition gridgluecommunicate.hh:194
│ │ │ │ +
collects all GridGlue data requried for communication
Definition gridgluecommunicate.hh:272
│ │ │ │ +
Dune::CommunicationDirection dir
Definition gridgluecommunicate.hh:288
│ │ │ │ +
::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data
Definition gridgluecommunicate.hh:282
│ │ │ │ +
const GridGlue * gridglue
Definition gridgluecommunicate.hh:281
│ │ │ │ +
Provides codimension-independent methods for grid extraction.
Definition extractor.hh:46
│ │ │ │ +
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ +
void getFaces(std::vector< VertexVector > &faces) const
Get the corners of the extracted subentities.
Definition extractor.hh:304
│ │ │ │ +
void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const
Get the list of geometry types.
Definition extractor.hh:293
│ │ │ │ +
void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) const
getter for the coordinates array
Definition extractor.hh:275
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,88 +1,584 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _a_d_a_p_t_e_r │ │ │ │ │ -rangegenerators.hh │ │ │ │ │ +gridglue.cc │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ +3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ +4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -3#ifndef DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_ADAPTER_RANGEGENERATORS_HH │ │ │ │ │ -5 │ │ │ │ │ -6#include │ │ │ │ │ -7 │ │ │ │ │ -8namespace _D_u_n_e { │ │ │ │ │ -9namespace GridGlue { │ │ │ │ │ -10 │ │ │ │ │ -14template │ │ │ │ │ -_1_5struct _R_e_v_e_r_s_e │ │ │ │ │ -16 : std::integral_constant │ │ │ │ │ -17{ │ │ │ │ │ -_1_8 typedef _R_e_v_e_r_s_e _t_y_p_e; │ │ │ │ │ +5/* IMPLEMENTATION OF CLASS G R I D G L U E */ │ │ │ │ │ +6 │ │ │ │ │ +7#include "_i_n_t_e_r_s_e_c_t_i_o_n_._h_h" │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include "../gridglue.hh" │ │ │ │ │ +11#if HAVE_MPI │ │ │ │ │ +12#include "../common/ringcomm.hh" │ │ │ │ │ +13#endif │ │ │ │ │ +14 │ │ │ │ │ +15#include │ │ │ │ │ +16 │ │ │ │ │ +17namespace _D_u_n_e { │ │ │ │ │ +18namespace GridGlue { │ │ │ │ │ 19 │ │ │ │ │ -20 constexpr │ │ │ │ │ -_2_1 _R_e_v_e_r_s_e_<_!_r_e_v_e_r_s_e_> _o_p_e_r_a_t_o_r_!() const │ │ │ │ │ -22 { return {}; } │ │ │ │ │ -23}; │ │ │ │ │ -24 │ │ │ │ │ -25#ifdef DOXYGEN │ │ │ │ │ -26 │ │ │ │ │ -_3_1const _R_e_v_e_r_s_e_<_t_r_u_e_> _r_e_v_e_r_s_e_d; │ │ │ │ │ -32 │ │ │ │ │ -66template<...> │ │ │ │ │ -67IteratorRange<...> │ │ │ │ │ -_6_8_i_n_t_e_r_s_e_c_t_i_o_n_s(const _G_r_i_d_G_l_u_e_<_._._._>& glue, const _R_e_v_e_r_s_e_<_._._._>& reverse = │ │ │ │ │ -!reversed); │ │ │ │ │ -69 │ │ │ │ │ -70#else │ │ │ │ │ -71 │ │ │ │ │ -72namespace { │ │ │ │ │ -73const _R_e_v_e_r_s_e_<_t_r_u_e_> reversed = {}; │ │ │ │ │ -74} /* namespace */ │ │ │ │ │ -75 │ │ │ │ │ -76template │ │ │ │ │ -77IteratorRange< typename GridGlue::template │ │ │ │ │ -IntersectionIterator > │ │ │ │ │ -78_i_n_t_e_r_s_e_c_t_i_o_n_s(const GridGlue& glue, const Reverse& = {}) │ │ │ │ │ -79{ │ │ │ │ │ -80 const static int side = reverse ? 1 : 0; │ │ │ │ │ -81 return {glue.template ibegin(), glue.template iend()}; │ │ │ │ │ -82} │ │ │ │ │ -83 │ │ │ │ │ -84#endif // DOXYGEN │ │ │ │ │ +20template │ │ │ │ │ +_2_1_G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_G_r_i_d_G_l_u_e(const std::shared_ptr< const _G_r_i_d_P_a_t_c_h_<_0_> >& gp0, │ │ │ │ │ +const std::shared_ptr< const _G_r_i_d_P_a_t_c_h_<_1_> >& gp1, const std:: │ │ │ │ │ +shared_ptr& merger) │ │ │ │ │ +22 : patches_{gp0, gp1}, merger_(merger) │ │ │ │ │ +23{ │ │ │ │ │ +24#if HAVE_MPI │ │ │ │ │ +25 // if we have only seq. meshes don't use parallel glueing │ │ │ │ │ +26 if (gp0->gridView().comm().size() == 1 │ │ │ │ │ +27 && gp1->gridView().comm().size() == 1) │ │ │ │ │ +28 mpicomm_ = MPI_COMM_SELF; │ │ │ │ │ +29 else │ │ │ │ │ +30 mpicomm_ = MPI_COMM_WORLD; │ │ │ │ │ +31#endif // HAVE_MPI │ │ │ │ │ +32 std::cout << "GridGlue: Constructor succeeded!" << std::endl; │ │ │ │ │ +33} │ │ │ │ │ +34 │ │ │ │ │ +35template │ │ │ │ │ +_3_6void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_b_u_i_l_d() │ │ │ │ │ +37{ │ │ │ │ │ +38 int myrank = 0; │ │ │ │ │ +39#if HAVE_MPI │ │ │ │ │ +40 int commsize = 1; │ │ │ │ │ +41 MPI_Comm_rank(mpicomm_, &myrank); │ │ │ │ │ +42 MPI_Comm_size(mpicomm_, &commsize); │ │ │ │ │ +43#endif // HAVE_MPI │ │ │ │ │ +44 │ │ │ │ │ +45 // clear the contents from the current intersections array │ │ │ │ │ +46 { │ │ │ │ │ +47 std::vector dummy(1); // we need size 1, as we always │ │ │ │ │ +store data for the end-intersection │ │ │ │ │ +48 intersections_.swap(dummy); │ │ │ │ │ +49 } │ │ │ │ │ +50 │ │ │ │ │ +51 std::vector > patch0coords; │ │ │ │ │ +52 std::vector patch0entities; │ │ │ │ │ +53 std::vector patch0types; │ │ │ │ │ +54 std::vector > patch1coords; │ │ │ │ │ +55 std::vector patch1entities; │ │ │ │ │ +56 std::vector patch1types; │ │ │ │ │ +57 │ │ │ │ │ +58 /* │ │ │ │ │ +59 * extract global surface patchs │ │ │ │ │ +60 */ │ │ │ │ │ +61 │ │ │ │ │ +62 // retrieve the coordinate and topology information from the extractors │ │ │ │ │ +63 // and apply transformations if necessary │ │ │ │ │ +64 extractGrid(patch<0>(), patch0coords, patch0entities, patch0types); │ │ │ │ │ +65 extractGrid(patch<1>(), patch1coords, patch1entities, patch1types); │ │ │ │ │ +66 │ │ │ │ │ +67 std::cout << ">>>> rank " << myrank << " coords: " │ │ │ │ │ +68 << patch0coords.size() << " and " << patch1coords.size() << std::endl; │ │ │ │ │ +69 std::cout << ">>>> rank " << myrank << " entities: " │ │ │ │ │ +70 << patch0entities.size() << " and " << patch1entities.size() << std::endl; │ │ │ │ │ +71 std::cout << ">>>> rank " << myrank << " types: " │ │ │ │ │ +72 << patch0types.size() << " and " << patch1types.size() << std::endl; │ │ │ │ │ +73 │ │ │ │ │ +74#ifdef WRITE_TO_VTK │ │ │ │ │ +75 const char prefix[] = "GridGlue::Builder::build() : "; │ │ │ │ │ +76 char patch0surf[256]; │ │ │ │ │ +77 sprintf(patch0surf, "/tmp/vtk-patch0-test-%i", myrank); │ │ │ │ │ +78 char patch1surf[256]; │ │ │ │ │ +79 sprintf(patch1surf, "/tmp/vtk-patch1-test-%i", myrank); │ │ │ │ │ +80 │ │ │ │ │ +81 // std::cout << prefix << "Writing patch0 surface to '" << patch0surf << │ │ │ │ │ +".vtk'...\n"; │ │ │ │ │ +82 // VtkSurfaceWriter vtksw(patch0surf); │ │ │ │ │ +83 // vtksw.writeSurface(patch0coords, patch0entities, grid0dim, dimworld); │ │ │ │ │ +84 // std::cout << prefix << "Done writing patch0 surface!\n"; │ │ │ │ │ 85 │ │ │ │ │ -86} /* namespace GridGlue */ │ │ │ │ │ -87} /* namespace Dune */ │ │ │ │ │ -88 │ │ │ │ │ -89#endif │ │ │ │ │ +86 // std::cout << prefix << "Writing patch1 surface to '" << patch1surf << │ │ │ │ │ +".vtk'...\n"; │ │ │ │ │ +87 // vtksw.setFilename(patch1surf); │ │ │ │ │ +88 // vtksw.writeSurface(patch1coords, patch1entities, grid1dim, dimworld); │ │ │ │ │ +89 // std::cout << prefix << "Done writing patch1 surface!\n"; │ │ │ │ │ +90#endif // WRITE_TO_VTK │ │ │ │ │ +91 │ │ │ │ │ +92 // we start with an empty set │ │ │ │ │ +93 index__sz = 0; │ │ │ │ │ +94 │ │ │ │ │ +95#if HAVE_MPI │ │ │ │ │ +96 if (commsize > 1) │ │ │ │ │ +97 { │ │ │ │ │ +98 // setup parallel indexset │ │ │ │ │ +99 patch0_is_.beginResize(); │ │ │ │ │ +100 patch1_is_.beginResize(); │ │ │ │ │ +101 } │ │ │ │ │ +102 │ │ │ │ │ +103 auto op = │ │ │ │ │ +104 [&]( │ │ │ │ │ +105 const int mergingrank, │ │ │ │ │ +106 const std::vector >& remotePatch0coords, │ │ │ │ │ +107 const std::vector& remotePatch0entities, │ │ │ │ │ +108 const std::vector& remotePatch0types, │ │ │ │ │ +109 const std::vector >& remotePatch1coords, │ │ │ │ │ +110 const std::vector& remotePatch1entities, │ │ │ │ │ +111 const std::vector& remotePatch1types │ │ │ │ │ +112 ) │ │ │ │ │ +113 { │ │ │ │ │ +114 if (remotePatch1entities.size() > 0 && patch0entities.size() > 0) │ │ │ │ │ +115 mergePatches(patch0coords, patch0entities, patch0types, myrank, │ │ │ │ │ +116 remotePatch1coords, remotePatch1entities, remotePatch1types, mergingrank); │ │ │ │ │ +117 if (mergingrank != myrank && │ │ │ │ │ +118 remotePatch0entities.size() > 0 && patch1entities.size() > 0) │ │ │ │ │ +119 mergePatches(remotePatch0coords, remotePatch0entities, remotePatch0types, │ │ │ │ │ +mergingrank, │ │ │ │ │ +120 patch1coords, patch1entities, patch1types, myrank); │ │ │ │ │ +121 }; │ │ │ │ │ +122 _P_a_r_a_l_l_e_l_:_:_M_P_I___A_l_l_A_p_p_l_y(mpicomm_, op, │ │ │ │ │ +123 patch0coords, patch0entities, patch0types, │ │ │ │ │ +124 patch1coords, patch1entities, patch1types │ │ │ │ │ +125 ); │ │ │ │ │ +126 │ │ │ │ │ +127 if (commsize > 1) │ │ │ │ │ +128 { │ │ │ │ │ +129 // finalize ParallelIndexSet & RemoteIndices │ │ │ │ │ +130 patch0_is_.endResize(); │ │ │ │ │ +131 patch1_is_.endResize(); │ │ │ │ │ +132 │ │ │ │ │ +133 // setup remote index information │ │ │ │ │ +134 remoteIndices_.setIncludeSelf(true); │ │ │ │ │ +135 // #warning add list of neighbors ... │ │ │ │ │ +136 remoteIndices_.setIndexSets(patch0_is_, patch1_is_, mpicomm_) ; │ │ │ │ │ +137 remoteIndices_.rebuild(); │ │ │ │ │ +138 │ │ │ │ │ +139 // DEBUG Print all remote indices │ │ │ │ │ +140#ifdef DEBUG_GRIDGLUE_PARALLELMERGE │ │ │ │ │ +141 for (auto it = remoteIndices_.begin(); it != remoteIndices_.end(); it++) │ │ │ │ │ +142 { │ │ │ │ │ +143 std::cout << myrank << "\tri-list\t" << it->first << std::endl; │ │ │ │ │ +144 for (auto xit = it->second.first->begin(); xit != it->second.first->end(); │ │ │ │ │ +++xit) │ │ │ │ │ +145 std::cout << myrank << "\tri-list 1 \t" << it->first << "\t" << *xit << │ │ │ │ │ +std::endl; │ │ │ │ │ +146 for (auto xit = it->second.second->begin(); xit != it->second.second->end │ │ │ │ │ +(); ++xit) │ │ │ │ │ +147 std::cout << myrank << "\tri-list 2 \t" << it->first << "\t" << *xit << │ │ │ │ │ +std::endl; │ │ │ │ │ +148 } │ │ │ │ │ +149#endif │ │ │ │ │ +150 } │ │ │ │ │ +151#else // HAVE_MPI │ │ │ │ │ +152 │ │ │ │ │ +153 if (patch1entities.size() > 0 && patch0entities.size() > 0) │ │ │ │ │ +154 { │ │ │ │ │ +155 mergePatches(patch0coords, patch0entities, patch0types, myrank, │ │ │ │ │ +156 patch1coords, patch1entities, patch1types, myrank); │ │ │ │ │ +157#ifdef CALL_MERGER_TWICE │ │ │ │ │ +158 mergePatches(patch0coords, patch0entities, patch0types, myrank, │ │ │ │ │ +159 patch1coords, patch1entities, patch1types, myrank); │ │ │ │ │ +160#endif │ │ │ │ │ +161 } │ │ │ │ │ +162 │ │ │ │ │ +163#endif // HAVE_MPI │ │ │ │ │ +164 │ │ │ │ │ +165} │ │ │ │ │ +166 │ │ │ │ │ +167template │ │ │ │ │ +_1_6_8void _p_r_i_n_t_V_e_c_t_o_r(const std::vector & v, std::string name, int rank) │ │ │ │ │ +169{ │ │ │ │ │ +170 std::cout << rank << ": " << name << std::endl; │ │ │ │ │ +171 for (size_t i=0; i │ │ │ │ │ +_1_7_9void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_m_e_r_g_e_P_a_t_c_h_e_s( │ │ │ │ │ +180 const std::vector >& patch0coords, │ │ │ │ │ +181 const std::vector& patch0entities, │ │ │ │ │ +182 const std::vector& patch0types, │ │ │ │ │ +183 const int patch0rank, │ │ │ │ │ +184 const std::vector >& patch1coords, │ │ │ │ │ +185 const std::vector& patch1entities, │ │ │ │ │ +186 const std::vector& patch1types, │ │ │ │ │ +187 const int patch1rank) │ │ │ │ │ +188{ │ │ │ │ │ +189 │ │ │ │ │ +190 // howto handle overlap etc? │ │ │ │ │ +191 │ │ │ │ │ +192 int myrank = 0; │ │ │ │ │ +193#if HAVE_MPI │ │ │ │ │ +194 int commsize = 1; │ │ │ │ │ +195 MPI_Comm_rank(mpicomm_, &myrank); │ │ │ │ │ +196 MPI_Comm_size(mpicomm_, &commsize); │ │ │ │ │ +197#endif // HAVE_MPI │ │ │ │ │ +198 │ │ │ │ │ +199 // which patches are local? │ │ │ │ │ +200 const bool patch0local = (myrank == patch0rank); │ │ │ │ │ +201 const bool patch1local = (myrank == patch1rank); │ │ │ │ │ +202 │ │ │ │ │ +203 // remember the number of previous remote intersections │ │ │ │ │ +204 const unsigned int offset = intersections_.size()-1; │ │ │ │ │ +205 │ │ │ │ │ +206 std::cout << myrank │ │ │ │ │ +207 << " GridGlue::mergePatches : rank " << patch0rank << " / " << patch1rank │ │ │ │ │ +<< std::endl; │ │ │ │ │ +208 │ │ │ │ │ +209 // start the actual build process │ │ │ │ │ +210 merger_->build(patch0coords, patch0entities, patch0types, │ │ │ │ │ +211 patch1coords, patch1entities, patch1types); │ │ │ │ │ +212 │ │ │ │ │ +213 // append to intersections list │ │ │ │ │ +214 intersections_.resize(merger_->nSimplices() + offset + 1); │ │ │ │ │ +215 for (unsigned int i = 0; i < merger_->nSimplices(); ++i) │ │ │ │ │ +216 intersections_[offset + i] = _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a(*this, i, offset, │ │ │ │ │ +patch0local, patch1local); │ │ │ │ │ +217 │ │ │ │ │ +218 index__sz = intersections_.size() - 1; │ │ │ │ │ +219 │ │ │ │ │ +220 std::cout << myrank │ │ │ │ │ +221 << " GridGlue::mergePatches : " │ │ │ │ │ +222 << "The number of remote intersections is " << intersections_.size()-1 << │ │ │ │ │ +std::endl; │ │ │ │ │ +223 │ │ │ │ │ +224#if 0 │ │ │ │ │ +225 _p_r_i_n_t_V_e_c_t_o_r(patch0coords,"patch0coords",myrank); │ │ │ │ │ +226 _p_r_i_n_t_V_e_c_t_o_r(patch0entities,"patch0entities",myrank); │ │ │ │ │ +227 _p_r_i_n_t_V_e_c_t_o_r(patch0types,"patch0types",myrank); │ │ │ │ │ +228 _p_r_i_n_t_V_e_c_t_o_r(patch1coords,"patch1coords",myrank); │ │ │ │ │ +229 _p_r_i_n_t_V_e_c_t_o_r(patch1entities,"patch1entities",myrank); │ │ │ │ │ +230 _p_r_i_n_t_V_e_c_t_o_r(patch1types,"patch1types",myrank); │ │ │ │ │ +231#endif │ │ │ │ │ +232 │ │ │ │ │ +233#if HAVE_MPI │ │ │ │ │ +234 if (commsize > 1) │ │ │ │ │ +235 { │ │ │ │ │ +236 // update remote index sets │ │ │ │ │ +237 assert(Dune::RESIZE == patch0_is_.state()); │ │ │ │ │ +238 assert(Dune::RESIZE == patch1_is_.state()); │ │ │ │ │ +239 │ │ │ │ │ +240 for (unsigned int i = 0; i < merger_->nSimplices(); i++) │ │ │ │ │ +241 { │ │ │ │ │ +242 // #warning only handle the newest intersections / merger info │ │ │ │ │ +243 const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a & it = intersections_[i]; │ │ │ │ │ +244 _G_l_o_b_a_l_I_d gid(patch0rank, patch1rank, i); │ │ │ │ │ +245 if (it.template local<0>()) │ │ │ │ │ +246 { │ │ │ │ │ +247 Dune::PartitionType ptype = patch<0>().element(it.template index<0> │ │ │ │ │ +()).partitionType(); │ │ │ │ │ +248 patch0_is_.add (gid, LocalIndex(offset+i, ptype) ); │ │ │ │ │ +249 } │ │ │ │ │ +250 if (it.template local<1>()) │ │ │ │ │ +251 { │ │ │ │ │ +252 Dune::PartitionType ptype = patch<1>().element(it.template index<1> │ │ │ │ │ +()).partitionType(); │ │ │ │ │ +253 patch1_is_.add (gid, LocalIndex(offset+i, ptype) ); │ │ │ │ │ +254 } │ │ │ │ │ +255 } │ │ │ │ │ +256 } │ │ │ │ │ +257#endif // HAVE_MPI │ │ │ │ │ +258 │ │ │ │ │ +259 // cleanup the merger │ │ │ │ │ +260 merger_->clear(); │ │ │ │ │ +261} │ │ │ │ │ +262 │ │ │ │ │ +263template │ │ │ │ │ +264template │ │ │ │ │ +_2_6_5void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_e_x_t_r_a_c_t_G_r_i_d (const _E_x_t_r_a_c_t_o_r & extractor, │ │ │ │ │ +266 std::vector > & coords, │ │ │ │ │ +267 std::vector & entities, │ │ │ │ │ +268 std::vector& geometryTypes) const │ │ │ │ │ +269{ │ │ │ │ │ +270 std::vector tempcoords; │ │ │ │ │ +271 std::vector tempentities; │ │ │ │ │ +272 │ │ │ │ │ +273 extractor._g_e_t_C_o_o_r_d_s(tempcoords); │ │ │ │ │ +274 coords.clear(); │ │ │ │ │ +275 coords.reserve(tempcoords.size()); │ │ │ │ │ +276 │ │ │ │ │ +277 for (unsigned int i = 0; i < tempcoords.size(); ++i) │ │ │ │ │ +278 { │ │ │ │ │ +279 assert(int(dimworld) == int(_E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d)); │ │ │ │ │ +280 coords.push_back(Dune::FieldVector()); │ │ │ │ │ +281 for (size_t j = 0; j │ │ │ │ │ +299template │ │ │ │ │ +_3_0_0void _G_r_i_d_G_l_u_e_<_P_0_,_ _P_1_>_:_:_c_o_m_m_u_n_i_c_a_t_e( │ │ │ │ │ +301 _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_D_a_t_a_H_a_n_d_l_e_I_m_p_,_D_a_t_a_T_y_p_e_I_m_p_> & data, │ │ │ │ │ +302 Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const │ │ │ │ │ +303{ │ │ │ │ │ +304 typedef _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_<_D_a_t_a_H_a_n_d_l_e_I_m_p_,_D_a_t_a_T_y_p_e_I_m_p_> │ │ │ │ │ +DataHandle; │ │ │ │ │ +305 typedef typename DataHandle::DataType DataType; │ │ │ │ │ +306 │ │ │ │ │ +307#if HAVE_MPI │ │ │ │ │ +308 │ │ │ │ │ +309 if (mpicomm_ != MPI_COMM_SELF) │ │ │ │ │ +310 { │ │ │ │ │ +311 /* │ │ │ │ │ +312 * P A R A L L E L V E R S I O N │ │ │ │ │ +313 */ │ │ │ │ │ +314 // setup communication interfaces │ │ │ │ │ +315 Dune::dinfo << "GridGlue: parallel communication" << std::endl; │ │ │ │ │ +316 typedef Dune::EnumItem │ │ │ │ │ +InteriorFlags; │ │ │ │ │ +317 typedef Dune::EnumItem │ │ │ │ │ +OverlapFlags; │ │ │ │ │ +318 typedef Dune::EnumRange AllFlags; │ │ │ │ │ +319 Dune::Interface interface; │ │ │ │ │ +320 assert(remoteIndices_.isSynced()); │ │ │ │ │ +321 switch (iftype) │ │ │ │ │ +322 { │ │ │ │ │ +323 case Dune::InteriorBorder_InteriorBorder_Interface : │ │ │ │ │ +324 interface.build (remoteIndices_, InteriorFlags(), InteriorFlags() ); │ │ │ │ │ +325 break; │ │ │ │ │ +326 case Dune::InteriorBorder_All_Interface : │ │ │ │ │ +327 if (dir == Dune::ForwardCommunication) │ │ │ │ │ +328 interface.build (remoteIndices_, InteriorFlags(), AllFlags() ); │ │ │ │ │ +329 else │ │ │ │ │ +330 interface.build (remoteIndices_, AllFlags(), InteriorFlags() ); │ │ │ │ │ +331 break; │ │ │ │ │ +332 case Dune::Overlap_OverlapFront_Interface : │ │ │ │ │ +333 interface.build (remoteIndices_, OverlapFlags(), OverlapFlags() ); │ │ │ │ │ +334 break; │ │ │ │ │ +335 case Dune::Overlap_All_Interface : │ │ │ │ │ +336 if (dir == Dune::ForwardCommunication) │ │ │ │ │ +337 interface.build (remoteIndices_, OverlapFlags(), AllFlags() ); │ │ │ │ │ +338 else │ │ │ │ │ +339 interface.build (remoteIndices_, AllFlags(), OverlapFlags() ); │ │ │ │ │ +340 break; │ │ │ │ │ +341 case Dune::All_All_Interface : │ │ │ │ │ +342 interface.build (remoteIndices_, AllFlags(), AllFlags() ); │ │ │ │ │ +343 break; │ │ │ │ │ +344 default : │ │ │ │ │ +345 DUNE_THROW(Dune::NotImplemented, "GridGlue::communicate for interface " << │ │ │ │ │ +iftype << " not implemented"); │ │ │ │ │ +346 } │ │ │ │ │ +347 │ │ │ │ │ +348 // setup communication info (class needed to tunnel all info to the │ │ │ │ │ +operator) │ │ │ │ │ +349 typedef _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_<_G_r_i_d_G_l_u_e_,_D_a_t_a_H_a_n_d_l_e_I_m_p_,_D_a_t_a_T_y_p_e_I_m_p_> │ │ │ │ │ +_C_o_m_m_I_n_f_o; │ │ │ │ │ +350 _C_o_m_m_I_n_f_o commInfo; │ │ │ │ │ +351 commInfo._d_i_r = dir; │ │ │ │ │ +352 commInfo._g_r_i_d_g_l_u_e = this; │ │ │ │ │ +353 commInfo._d_a_t_a = &data; │ │ │ │ │ +354 │ │ │ │ │ +355 // create communicator │ │ │ │ │ +356 Dune::BufferedCommunicator bComm ; │ │ │ │ │ +357 bComm.template build< CommInfo >(commInfo, commInfo, interface); │ │ │ │ │ +358 │ │ │ │ │ +359 // do communication │ │ │ │ │ +360 // choose communication direction. │ │ │ │ │ +361 if (dir == Dune::ForwardCommunication) │ │ │ │ │ +362 bComm.forward< _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_F_o_r_w_a_r_d_O_p_e_r_a_t_o_r >(commInfo, commInfo); │ │ │ │ │ +363 else │ │ │ │ │ +364 bComm.backward< _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_B_a_c_k_w_a_r_d_O_p_e_r_a_t_o_r >(commInfo, commInfo); │ │ │ │ │ +365 } │ │ │ │ │ +366 else │ │ │ │ │ +367#endif // HAVE_MPI │ │ │ │ │ +368 { │ │ │ │ │ +369 /* │ │ │ │ │ +370 * S E Q U E N T I A L V E R S I O N │ │ │ │ │ +371 */ │ │ │ │ │ +372 Dune::dinfo << "GridGlue: sequential fallback communication" << std::endl; │ │ │ │ │ +373 │ │ │ │ │ +374 // get comm buffer size │ │ │ │ │ +375 int ssz = size() * 10; // times data per intersection │ │ │ │ │ +376 int rsz = size() * 10; │ │ │ │ │ +377 │ │ │ │ │ +378 // allocate send/receive buffer │ │ │ │ │ +379 auto sendbuffer = std::make_unique(ssz); │ │ │ │ │ +380 auto receivebuffer = std::make_unique(rsz); │ │ │ │ │ +381 │ │ │ │ │ +382 // gather │ │ │ │ │ +383 _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r_<_D_a_t_a_T_y_p_e_> gatherbuffer │ │ │ │ │ +(sendbuffer.get()); │ │ │ │ │ +384 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(*this)) │ │ │ │ │ +385 { │ │ │ │ │ +386 /* │ │ │ │ │ +387 we need to have to variants depending on the communication direction. │ │ │ │ │ +388 */ │ │ │ │ │ +389 if (dir == Dune::ForwardCommunication) │ │ │ │ │ +390 { │ │ │ │ │ +391 /* │ │ │ │ │ +392 dir : Forward (grid0 -> grid1) │ │ │ │ │ +393 */ │ │ │ │ │ +394 if (in.self()) │ │ │ │ │ +395 { │ │ │ │ │ +396 data._g_a_t_h_e_r(gatherbuffer, in.inside(), in); │ │ │ │ │ +397 } │ │ │ │ │ +398 } │ │ │ │ │ +399 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ +400 { │ │ │ │ │ +401 /* │ │ │ │ │ +402 dir : Backward (grid1 -> grid0) │ │ │ │ │ +403 */ │ │ │ │ │ +404 if (in.neighbor()) │ │ │ │ │ +405 { │ │ │ │ │ +406 data._g_a_t_h_e_r(gatherbuffer, in.outside(), in.flip()); │ │ │ │ │ +407 } │ │ │ │ │ +408 } │ │ │ │ │ +409 } │ │ │ │ │ +410 │ │ │ │ │ +411 assert(ssz == rsz); │ │ │ │ │ +412 for (int i=0; i scatterbuffer │ │ │ │ │ +(receivebuffer.get()); │ │ │ │ │ +417 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(*this)) │ │ │ │ │ +418 { │ │ │ │ │ +419 /* │ │ │ │ │ +420 we need to have to variants depending on the communication direction. │ │ │ │ │ +421 */ │ │ │ │ │ +422 if (dir == Dune::ForwardCommunication) │ │ │ │ │ +423 { │ │ │ │ │ +424 /* │ │ │ │ │ +425 dir : Forward (grid0 -> grid1) │ │ │ │ │ +426 */ │ │ │ │ │ +427 if (in.neighbor()) │ │ │ │ │ +428 data._s_c_a_t_t_e_r(scatterbuffer, in.outside(), in.flip(), │ │ │ │ │ +429 data._s_i_z_e(in)); │ │ │ │ │ +430 } │ │ │ │ │ +431 else // (dir == Dune::BackwardCommunication) │ │ │ │ │ +432 { │ │ │ │ │ +433 /* │ │ │ │ │ +434 dir : Backward (grid1 -> grid0) │ │ │ │ │ +435 */ │ │ │ │ │ +436 if (in.self()) │ │ │ │ │ +437 data._s_c_a_t_t_e_r(scatterbuffer, in.inside(), in, │ │ │ │ │ +438 data._s_i_z_e(in)); │ │ │ │ │ +439 } │ │ │ │ │ +440 } │ │ │ │ │ +441 } │ │ │ │ │ +442} │ │ │ │ │ +443 │ │ │ │ │ +444} // end namespace GridGlue │ │ │ │ │ +445} // end namespace Dune │ │ │ │ │ +_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ +Model of the Intersection concept provided by GridGlue. │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ > &reverse=!reversed) │ │ │ │ │ Iterate over all intersections of a GridGlue. │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t_V_e_c_t_o_r │ │ │ │ │ +void printVector(const std::vector< T > &v, std::string name, int rank) │ │ │ │ │ +DDeeffiinniittiioonn gridglue.cc:168 │ │ │ │ │ +_D_u_n_e_:_:_P_a_r_a_l_l_e_l_:_:_M_P_I___A_l_l_A_p_p_l_y │ │ │ │ │ +void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data) │ │ │ │ │ +apply an operator locally to a difstributed data set │ │ │ │ │ +DDeeffiinniittiioonn ringcomm.hh:297 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │ sequential adapter to couple two grids at specified close together boundaries │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ -IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ -> &reverse=!reversed) │ │ │ │ │ -Iterate over all intersections of a GridGlue. │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e │ │ │ │ │ -DDeeffiinniittiioonn rangegenerators.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_:_:_r_e_v_e_r_s_e_d │ │ │ │ │ -const Reverse< true > reversed │ │ │ │ │ -DDeeffiinniittiioonn rangegenerators.hh:31 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_:_:_t_y_p_e │ │ │ │ │ -Reverse type │ │ │ │ │ -DDeeffiinniittiioonn rangegenerators.hh:18 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e_:_:_o_p_e_r_a_t_o_r_! │ │ │ │ │ -constexpr Reverse operator!() const │ │ │ │ │ -DDeeffiinniittiioonn rangegenerators.hh:21 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_m_e_r_g_e_P_a_t_c_h_e_s │ │ │ │ │ +void mergePatches(const std::vector< Dune::FieldVector< ctype, dimworld > > │ │ │ │ │ +&patch0coords, const std::vector< unsigned int > &patch0entities, const std:: │ │ │ │ │ +vector< Dune::GeometryType > &patch0types, const int patch0rank, const std:: │ │ │ │ │ +vector< Dune::FieldVector< ctype, dimworld > > &patch1coords, const std:: │ │ │ │ │ +vector< unsigned int > &patch1entities, const std::vector< Dune::GeometryType > │ │ │ │ │ +&patch1types, const int patch1rank) │ │ │ │ │ +after building the merged grid the intersection can be updated through this │ │ │ │ │ +method (for internal use) │ │ │ │ │ +DDeeffiinniittiioonn gridglue.cc:179 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_c_o_m_m_u_n_i_c_a_t_e │ │ │ │ │ +void communicate(Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > │ │ │ │ │ +&data, Dune::InterfaceType iftype, Dune::CommunicationDirection dir) const │ │ │ │ │ +Communicate information on the MergedGrid of a GridGlue. │ │ │ │ │ +DDeeffiinniittiioonn gridglue.cc:300 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_b_u_i_l_d │ │ │ │ │ +void build() │ │ │ │ │ +DDeeffiinniittiioonn gridglue.cc:36 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_e_x_t_r_a_c_t_G_r_i_d │ │ │ │ │ +void extractGrid(const Extractor &extractor, std::vector< Dune::FieldVector< │ │ │ │ │ +ctype, dimworld > > &coords, std::vector< unsigned int > &faces, std::vector< │ │ │ │ │ +Dune::GeometryType > &geometryTypes) const │ │ │ │ │ +DDeeffiinniittiioonn gridglue.cc:265 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_G_l_u_e_:_:_G_r_i_d_P_a_t_c_h │ │ │ │ │ +std::conditional_t< side==0, P0, std::conditional_t< side==1, P1, void > > │ │ │ │ │ +GridPatch │ │ │ │ │ +DDeeffiinniittiioonn gridglue.hh:96 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ │ +storage class for Dune::GridGlue::Intersection related data │ │ │ │ │ +DDeeffiinniittiioonn intersection.hh:38 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_G_l_o_b_a_l_I_d │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:26 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e │ │ │ │ │ +describes the features of a data handle for communication in parallel runs │ │ │ │ │ +using the GridGlue::commun... │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:77 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_i_z_e │ │ │ │ │ +size_t size(RISType &i) const │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_s_c_a_t_t_e_r │ │ │ │ │ +void scatter(MessageBufferImp &buff, const EntityType &e, const RISType &i, │ │ │ │ │ +size_t n) │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:118 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_D_a_t_a_H_a_n_d_l_e_:_:_g_a_t_h_e_r │ │ │ │ │ +void gather(MessageBufferImp &buff, const EntityType &e, const RISType &i) │ │ │ │ │ +const │ │ │ │ │ +pack data from user to message buffer │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:104 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_r_e_a_m_i_n_g_M_e_s_s_a_g_e_B_u_f_f_e_r │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:141 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_u_n_i_c_a_t_i_o_n_O_p_e_r_a_t_o_r │ │ │ │ │ +forward gather scatter to user defined CommInfo class │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:194 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o │ │ │ │ │ +collects all GridGlue data requried for communication │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:272 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_i_r │ │ │ │ │ +Dune::CommunicationDirection dir │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:288 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_d_a_t_a │ │ │ │ │ +::Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp > * data │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:282 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_m_I_n_f_o_:_:_g_r_i_d_g_l_u_e │ │ │ │ │ +const GridGlue * gridglue │ │ │ │ │ +DDeeffiinniittiioonn gridgluecommunicate.hh:281 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ +Provides codimension-independent methods for grid extraction. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ +static constexpr auto dimworld │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_F_a_c_e_s │ │ │ │ │ +void getFaces(std::vector< VertexVector > &faces) const │ │ │ │ │ +Get the corners of the extracted subentities. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:304 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_G_e_o_m_e_t_r_y_T_y_p_e_s │ │ │ │ │ +void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const │ │ │ │ │ +Get the list of geometry types. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:293 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_C_o_o_r_d_s │ │ │ │ │ +void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) │ │ │ │ │ +const │ │ │ │ │ +getter for the coordinates array │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:275 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projection.hh File Reference │ │ │ │ +dune-grid-glue: projectionwriter_impl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,41 +70,61 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
projection.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
projectionwriter_impl.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <bitset>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include "projection_impl.hh"
│ │ │ │ +
#include <fstream>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::GridGlue::Projection< Coordinate >
 Projection of a line (triangle) on another line (triangle). More...
 
struct  Dune::GridGlue::Projection< Coordinate >::EdgeIntersection
 Intersection between two edges of a triangle. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
namespace  Dune::GridGlue::ProjectionWriterImplementation
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +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
 
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
 
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.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,28 +1,60 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -projection.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_p_r_o_j_e_c_t_i_o_n___i_m_p_l_._h_h" │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +projectionwriter_impl.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ - class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_<_ _C_o_o_r_d_i_n_a_t_e_ _> │ │ │ │ │ -  _P_r_o_j_e_c_t_i_o_n of a line (triangle) on another line (triangle). _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_<_ _C_o_o_r_d_i_n_a_t_e_ _>_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -  _I_n_t_e_r_s_e_c_t_i_o_n between two edges of a triangle. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___p_o_i_n_t_s (const │ │ │ │ │ + _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const Corners &corners, std:: │ │ │ │ │ + ostream &out) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___n_o_r_m_a_l_s (const │ │ │ │ │ + _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const Normals &normals, std:: │ │ │ │ │ + ostream &out) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ │ + _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___p_o_i_n_t_s (const _P_r_o_j_e_c_t_i_o_n< Coordinate > │ │ │ │ │ + &projection, const Corners &corners, std::ostream &out) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ │ + _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___n_o_r_m_a_l_s (const _P_r_o_j_e_c_t_i_o_n< Coordinate > │ │ │ │ │ + &projection, const Normals &normals, std::ostream &out) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___s_u_c_c_e_s_s (const │ │ │ │ │ + _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, std::ostream &out) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ + Corners &corners, const Normals &normals, std::ostream &out) │ │ │ │ │ +  write projection in VTK format │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ + Corners &corners, const Normals &normals, const std::string &filename) │ │ │ │ │ +  write projection in VTK format │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ + Corners &corners, const Normals &normals) │ │ │ │ │ +  Print information about the projection to std::cout stream. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projection.hh Source File │ │ │ │ +dune-grid-glue: projectionwriter_impl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,137 +74,211 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
projection.hh
│ │ │ │ +
projectionwriter_impl.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │ -
5
│ │ │ │ -
6#include <array>
│ │ │ │ -
7#include <bitset>
│ │ │ │ -
8#include <tuple>
│ │ │ │ +
3#include <fstream>
│ │ │ │ +
4
│ │ │ │ +
5namespace Dune {
│ │ │ │ +
6namespace GridGlue {
│ │ │ │ +
7
│ │ │ │ +
│ │ │ │ +
8namespace ProjectionWriterImplementation {
│ │ │ │
9
│ │ │ │ -
10namespace Dune {
│ │ │ │ -
11namespace GridGlue {
│ │ │ │ -
12
│ │ │ │ -
19template<typename Coordinate>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
21{
│ │ │ │ -
22public:
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
29 {
│ │ │ │ -
33 std::array<unsigned, 2> edge;
│ │ │ │ -
34
│ │ │ │ -
41 std::array<Coordinate, 2> local;
│ │ │ │ -
42 };
│ │ │ │ -
│ │ │ │ -
43
│ │ │ │ -
47 constexpr static unsigned dim = Coordinate::dimension;
│ │ │ │ -
48
│ │ │ │ -
54 constexpr static unsigned maxEdgeIntersections = dim == 3 ? 9 : 0;
│ │ │ │ -
55
│ │ │ │ -
56 static_assert(dim == 2 || dim == 3, "Projection only implemented for dim=2 or dim=3");
│ │ │ │ -
57
│ │ │ │ -
61 typedef typename Coordinate::field_type Field;
│ │ │ │ -
62
│ │ │ │ -
70 typedef std::array<Coordinate, dim> Images;
│ │ │ │ -
71
│ │ │ │ - │ │ │ │ -
79
│ │ │ │ -
80private:
│ │ │ │ -
84 const Field m_overlap;
│ │ │ │ -
85
│ │ │ │ -
94 const Field m_max_normal_product;
│ │ │ │ +
10template<unsigned side, typename Coordinate, typename Corners>
│ │ │ │ +
│ │ │ │ +
11void write_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
│ │ │ │ +
12{
│ │ │ │ +
13 using namespace ProjectionImplementation;
│ │ │ │ +
14 using std::get;
│ │ │ │ +
15 const unsigned other_side = 1 - side;
│ │ │ │ +
16
│ │ │ │ +
17 for (const auto& c : get<side>(corners))
│ │ │ │ +
18 out << c << "\n";
│ │ │ │ +
19
│ │ │ │ +
20 for (const auto& i : get<side>(projection.images())) {
│ │ │ │ +
21 const auto global = interpolate(i, get<other_side>(corners));
│ │ │ │ +
22 out << global << "\n";
│ │ │ │ +
23 }
│ │ │ │ +
24}
│ │ │ │ +
│ │ │ │ +
25
│ │ │ │ +
26template<unsigned side, typename Coordinate, typename Normals>
│ │ │ │ +
│ │ │ │ +
27void write_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
│ │ │ │ +
28{
│ │ │ │ +
29 using namespace ProjectionImplementation;
│ │ │ │ +
30 using std::get;
│ │ │ │ +
31 const unsigned other_side = 1 - side;
│ │ │ │ +
32
│ │ │ │ +
33 for (const auto& n : get<side>(normals))
│ │ │ │ +
34 out << n << "\n";
│ │ │ │ +
35
│ │ │ │ +
36 for (const auto& x : get<side>(projection.images())) {
│ │ │ │ +
37 const auto n = interpolate_unit_normals(x, get<other_side>(normals));
│ │ │ │ +
38 out << n << "\n";
│ │ │ │ +
39 }
│ │ │ │ +
40}
│ │ │ │ +
│ │ │ │ +
41
│ │ │ │ +
42template<typename Coordinate, typename Corners>
│ │ │ │ +
│ │ │ │ +
43void write_edge_intersection_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
│ │ │ │ +
44{
│ │ │ │ +
45 using namespace ProjectionImplementation;
│ │ │ │ +
46 using std::get;
│ │ │ │ +
47
│ │ │ │ +
48 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
│ │ │ │ +
49 const auto& local = projection.edgeIntersections()[i].local;
│ │ │ │ +
50 out << interpolate(local[0], get<0>(corners)) << "\n"
│ │ │ │ +
51 << interpolate(local[1], get<1>(corners)) << "\n";
│ │ │ │ +
52 }
│ │ │ │ +
53}
│ │ │ │ +
│ │ │ │ +
54
│ │ │ │ +
55template<typename Coordinate, typename Normals>
│ │ │ │ +
│ │ │ │ +
56void write_edge_intersection_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
│ │ │ │ +
57{
│ │ │ │ +
58 using namespace ProjectionImplementation;
│ │ │ │ +
59 using std::get;
│ │ │ │ +
60
│ │ │ │ +
61 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
│ │ │ │ +
62 const auto& local = projection.edgeIntersections()[i].local;
│ │ │ │ +
63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals));
│ │ │ │ +
64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals));
│ │ │ │ +
65
│ │ │ │ +
66 out << n0 << "\n"
│ │ │ │ +
67 << n1 << "\n";
│ │ │ │ +
68 }
│ │ │ │ +
69}
│ │ │ │ +
│ │ │ │ +
70
│ │ │ │ +
71template<unsigned side, typename Coordinate>
│ │ │ │ +
│ │ │ │ +
72void write_success(const Projection<Coordinate>& projection, std::ostream& out)
│ │ │ │ +
73{
│ │ │ │ +
74 using std::get;
│ │ │ │ +
75
│ │ │ │ +
76 out << side << "\n";
│ │ │ │ +
77
│ │ │ │ +
78 const auto& success = get<side>(projection.success());
│ │ │ │ +
79 for (std::size_t i = 0; i < success.size(); ++i)
│ │ │ │ +
80 out << (success[i] ? "1\n" : "0\n");
│ │ │ │ +
81}
│ │ │ │ +
│ │ │ │ +
82
│ │ │ │ +
83} /* namespace ProjectionWriterImplementation */
│ │ │ │ +
│ │ │ │ +
84
│ │ │ │ +
85template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ +
│ │ │ │ +
86void write(const Projection<Coordinate>& projection,
│ │ │ │ +
87 const Corners& corners,
│ │ │ │ +
88 const Normals& normals,
│ │ │ │ +
89 std::ostream& out)
│ │ │ │ +
90{
│ │ │ │ +
91 using namespace ProjectionWriterImplementation;
│ │ │ │ +
92
│ │ │ │ +
93 const auto numberOfEdgeIntersections = projection.numberOfEdgeIntersections();
│ │ │ │ +
94 const auto nPoints = 12 + 2 * numberOfEdgeIntersections;
│ │ │ │
95
│ │ │ │ -
101 Field m_epsilon = Field(1e-12);
│ │ │ │ -
102
│ │ │ │ -
104 std::tuple<Images, Preimages> m_images;
│ │ │ │ -
105
│ │ │ │ -
107 std::tuple<std::bitset<dim>, std::bitset<dim> > m_success;
│ │ │ │ -
108
│ │ │ │ -
110 unsigned m_number_of_edge_intersections;
│ │ │ │ -
111
│ │ │ │ -
113 std::array<EdgeIntersection, maxEdgeIntersections> m_edge_intersections;
│ │ │ │ -
114
│ │ │ │ -
126 bool m_projection_valid;
│ │ │ │ -
127
│ │ │ │ -
133 template<typename Corners, typename Normals>
│ │ │ │ -
134 void doProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ -
135
│ │ │ │ -
144 template<typename Corners, typename Normals>
│ │ │ │ -
145 void doInverseProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ -
146
│ │ │ │ -
155 template<typename Corners, typename Normals>
│ │ │ │ -
156 void doEdgeIntersection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ -
157
│ │ │ │ -
183 template<typename Corners, typename Normals>
│ │ │ │ -
184 inline bool projectionFeasible(const Coordinate& x, const Coordinate& nx, const Coordinate& px, const Corners& corners, const Normals& normals) const;
│ │ │ │ -
185
│ │ │ │ -
186public:
│ │ │ │ -
191 Projection(const Field overlap = Field(0), const Field max_normal_product = Field(-0.1));
│ │ │ │ -
192
│ │ │ │ -
198 void epsilon(const Field epsilon);
│ │ │ │ -
199
│ │ │ │ -
212 template<typename Corners, typename Normals>
│ │ │ │ -
213 void project(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ -
214
│ │ │ │ -
│ │ │ │ -
235 const std::tuple<Images, Preimages>& images() const
│ │ │ │ -
236 { return m_images; }
│ │ │ │ -
│ │ │ │ -
237
│ │ │ │ -
│ │ │ │ -
252 const std::tuple<std::bitset<dim>, std::bitset<dim> >& success() const
│ │ │ │ -
253 { return m_success; }
│ │ │ │ -
│ │ │ │ -
254
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
263 { return m_number_of_edge_intersections; }
│ │ │ │ -
│ │ │ │ -
264
│ │ │ │ -
│ │ │ │ -
273 const std::array<EdgeIntersection, maxEdgeIntersections>& edgeIntersections() const
│ │ │ │ -
274 { return m_edge_intersections; }
│ │ │ │ -
│ │ │ │ -
275};
│ │ │ │ -
│ │ │ │ -
276
│ │ │ │ -
277} /* namespace GridGlue */
│ │ │ │ -
278} /* namespace Dune */
│ │ │ │ -
279
│ │ │ │ -
280#include "projection_impl.hh"
│ │ │ │ -
281
│ │ │ │ -
282#endif
│ │ │ │ - │ │ │ │ +
96 out << "# vtk DataFile Version2.0\n"
│ │ │ │ +
97 << "Filename: projection\n"
│ │ │ │ +
98 << "ASCII\n"
│ │ │ │ +
99 << "DATASET UNSTRUCTURED_GRID\n"
│ │ │ │ +
100 << "POINTS " << nPoints << " double\n";
│ │ │ │ +
101 write_points<0>(projection, corners, out);
│ │ │ │ +
102 write_points<1>(projection, corners, out);
│ │ │ │ +
103 write_edge_intersection_points(projection, corners, out);
│ │ │ │ +
104 out << "CELLS " << (8 + numberOfEdgeIntersections) << " " << (26 + 3 * numberOfEdgeIntersections) << "\n";
│ │ │ │ +
105 out << "3 0 1 2\n" "2 0 3\n" "2 1 4\n" "2 2 5\n"
│ │ │ │ +
106 << "3 6 7 8\n" "2 6 9\n" "2 7 10\n" "2 8 11\n";
│ │ │ │ +
107 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
│ │ │ │ +
108 out << "2 " << (12 + 2*i) << " " << (12 + 2*i + 1) << "\n";
│ │ │ │ +
109 out << "CELL_TYPES " << (8 + numberOfEdgeIntersections) << "\n" "5\n3\n3\n3\n" "5\n3\n3\n3\n";
│ │ │ │ +
110 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
│ │ │ │ +
111 out << "3\n";
│ │ │ │ +
112 out << "CELL_DATA " << (8 + numberOfEdgeIntersections) << "\n";
│ │ │ │ +
113 out << "SCALARS success int 1\n"
│ │ │ │ +
114 << "LOOKUP_TABLE success\n";
│ │ │ │ +
115 write_success<0>(projection, out);
│ │ │ │ +
116 write_success<1>(projection, out);
│ │ │ │ +
117 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
│ │ │ │ +
118 out << "2\n";
│ │ │ │ +
119 out << "LOOKUP_TABLE success 2\n"
│ │ │ │ +
120 << "1.0 0.0 0.0 1.0\n"
│ │ │ │ +
121 << "0.0 1.0 0.0 1.0\n";
│ │ │ │ +
122 out << "POINT_DATA " << nPoints << "\n"
│ │ │ │ +
123 << "NORMALS normals double\n";
│ │ │ │ +
124 write_normals<0>(projection, normals, out);
│ │ │ │ +
125 write_normals<1>(projection, normals, out);
│ │ │ │ +
126 write_edge_intersection_normals(projection, normals, out);
│ │ │ │ +
127}
│ │ │ │ +
│ │ │ │ +
128
│ │ │ │ +
129template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ +
│ │ │ │ +
130void write(const Projection<Coordinate>& projection,
│ │ │ │ +
131 const Corners& corners,
│ │ │ │ +
132 const Normals& normals,
│ │ │ │ +
133 const std::string& filename)
│ │ │ │ +
134{
│ │ │ │ +
135 std::ofstream out(filename.c_str());
│ │ │ │ +
136 write(projection, corners, normals, out);
│ │ │ │ +
137}
│ │ │ │ +
│ │ │ │ +
138
│ │ │ │ +
139template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ +
│ │ │ │ +
140void print(const Projection<Coordinate>& projection,
│ │ │ │ +
141 const Corners& corners,
│ │ │ │ +
142 const Normals& normals)
│ │ │ │ +
143{
│ │ │ │ +
144 using namespace ProjectionWriterImplementation;
│ │ │ │ +
145
│ │ │ │ +
146 std::cout << "Side 0 corners and images:\n";
│ │ │ │ +
147 write_points<0>(projection, corners, std::cout);
│ │ │ │ +
148 std::cout << "Side 0 success:\n";
│ │ │ │ +
149 write_success<0>(projection, std::cout);
│ │ │ │ +
150 std::cout << "Side 1 corners and images:\n";
│ │ │ │ +
151 write_points<1>(projection, corners, std::cout);
│ │ │ │ +
152 std::cout << "Side 1 success:\n";
│ │ │ │ +
153 write_success<1>(projection, std::cout);
│ │ │ │ +
154 std::cout << "Side 0 normals and projected normals:\n";
│ │ │ │ +
155 write_normals<0>(projection, normals, std::cout);
│ │ │ │ +
156 std::cout << "Side 1 normals and projected normals:\n";
│ │ │ │ +
157 write_normals<1>(projection, normals, std::cout);
│ │ │ │ +
158 std::cout << projection.numberOfEdgeIntersections() << " edge intersections:\n";
│ │ │ │ +
159 write_edge_intersection_points(projection, corners, std::cout);
│ │ │ │ +
160}
│ │ │ │ +
│ │ │ │ +
161
│ │ │ │ +
162} /* namespace GridGlue */
│ │ │ │ +
163} /* namespace Dune */
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ +
void write_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
Definition projectionwriter_impl.hh:27
│ │ │ │ +
void write_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
Definition projectionwriter_impl.hh:11
│ │ │ │ +
void write_success(const Projection< Coordinate > &projection, std::ostream &out)
Definition projectionwriter_impl.hh:72
│ │ │ │ +
void write_edge_intersection_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
Definition projectionwriter_impl.hh:43
│ │ │ │ +
void write_edge_intersection_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
Definition projectionwriter_impl.hh:56
│ │ │ │
Projection of a line (triangle) on another line (triangle).
Definition projection.hh:21
│ │ │ │ -
Coordinate::field_type Field
Scalar type.
Definition projection.hh:61
│ │ │ │
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
│ │ │ │ -
static constexpr unsigned maxEdgeIntersections
maximum number of edge-edge intersections
Definition projection.hh:54
│ │ │ │ -
Images Preimages
Definition projection.hh:78
│ │ │ │ -
std::array< Coordinate, dim > Images
List of corner images.
Definition projection.hh:70
│ │ │ │ -
void epsilon(const Field epsilon)
Set epsilon used for floating-point comparisons.
Definition projection_impl.hh:140
│ │ │ │ -
void project(const std::tuple< Corners &, Corners & > &corners, const std::tuple< Normals &, Normals & > &normals)
Do the actual projection.
Definition projection_impl.hh:469
│ │ │ │ -
static constexpr unsigned dim
dimension of coordinates
Definition projection.hh:47
│ │ │ │
unsigned numberOfEdgeIntersections() const
Number of edge intersections.
Definition projection.hh:262
│ │ │ │
const std::tuple< Images, Preimages > & images() const
Images and preimages of corners.
Definition projection.hh:235
│ │ │ │
const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections() const
Edge-edge intersections.
Definition projection.hh:273
│ │ │ │ -
Intersection between two edges of a triangle.
Definition projection.hh:29
│ │ │ │ -
std::array< Coordinate, 2 > local
Local coordinates of intersection and distance along normals.
Definition projection.hh:41
│ │ │ │ -
std::array< unsigned, 2 > edge
Edge numbers in image and preimage triangle.
Definition projection.hh:33
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,175 +1,238 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -projection.hh │ │ │ │ │ +projectionwriter_impl.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ -5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8#include │ │ │ │ │ +3#include │ │ │ │ │ +4 │ │ │ │ │ +5namespace _D_u_n_e { │ │ │ │ │ +6namespace GridGlue { │ │ │ │ │ +7 │ │ │ │ │ +_8namespace ProjectionWriterImplementation { │ │ │ │ │ 9 │ │ │ │ │ -10namespace _D_u_n_e { │ │ │ │ │ -11namespace GridGlue { │ │ │ │ │ -12 │ │ │ │ │ -19template │ │ │ │ │ -_2_0class _P_r_o_j_e_c_t_i_o_n │ │ │ │ │ -21{ │ │ │ │ │ -22public: │ │ │ │ │ -_2_8 struct _E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -29 { │ │ │ │ │ -_3_3 std::array _e_d_g_e; │ │ │ │ │ -34 │ │ │ │ │ -_4_1 std::array _l_o_c_a_l; │ │ │ │ │ -42 }; │ │ │ │ │ -43 │ │ │ │ │ -_4_7 constexpr static unsigned _d_i_m = Coordinate::dimension; │ │ │ │ │ -48 │ │ │ │ │ -_5_4 constexpr static unsigned _m_a_x_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s = _d_i_m == 3 ? 9 : 0; │ │ │ │ │ -55 │ │ │ │ │ -56 static_assert(_d_i_m == 2 || _d_i_m == 3, "Projection only implemented for dim=2 │ │ │ │ │ -or dim=3"); │ │ │ │ │ -57 │ │ │ │ │ -_6_1 typedef typename Coordinate::field_type _F_i_e_l_d; │ │ │ │ │ -62 │ │ │ │ │ -_7_0 typedef std::array _I_m_a_g_e_s; │ │ │ │ │ -71 │ │ │ │ │ -_7_8 typedef _I_m_a_g_e_s _P_r_e_i_m_a_g_e_s; │ │ │ │ │ -79 │ │ │ │ │ -80private: │ │ │ │ │ -84 const _F_i_e_l_d m_overlap; │ │ │ │ │ -85 │ │ │ │ │ -94 const _F_i_e_l_d m_max_normal_product; │ │ │ │ │ +10template │ │ │ │ │ +_1_1void _w_r_i_t_e___p_o_i_n_t_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, const Corners& │ │ │ │ │ +corners, std::ostream& out) │ │ │ │ │ +12{ │ │ │ │ │ +13 using namespace ProjectionImplementation; │ │ │ │ │ +14 using std::get; │ │ │ │ │ +15 const unsigned other_side = 1 - side; │ │ │ │ │ +16 │ │ │ │ │ +17 for (const auto& c : get(corners)) │ │ │ │ │ +18 out << c << "\n"; │ │ │ │ │ +19 │ │ │ │ │ +20 for (const auto& i : get(projection._i_m_a_g_e_s())) { │ │ │ │ │ +21 const auto global = interpolate(i, get(corners)); │ │ │ │ │ +22 out << global << "\n"; │ │ │ │ │ +23 } │ │ │ │ │ +24} │ │ │ │ │ +25 │ │ │ │ │ +26template │ │ │ │ │ +_2_7void _w_r_i_t_e___n_o_r_m_a_l_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, const Normals& │ │ │ │ │ +normals, std::ostream& out) │ │ │ │ │ +28{ │ │ │ │ │ +29 using namespace ProjectionImplementation; │ │ │ │ │ +30 using std::get; │ │ │ │ │ +31 const unsigned other_side = 1 - side; │ │ │ │ │ +32 │ │ │ │ │ +33 for (const auto& n : get(normals)) │ │ │ │ │ +34 out << n << "\n"; │ │ │ │ │ +35 │ │ │ │ │ +36 for (const auto& x : get(projection._i_m_a_g_e_s())) { │ │ │ │ │ +37 const auto n = interpolate_unit_normals(x, get(normals)); │ │ │ │ │ +38 out << n << "\n"; │ │ │ │ │ +39 } │ │ │ │ │ +40} │ │ │ │ │ +41 │ │ │ │ │ +42template │ │ │ │ │ +_4_3void _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___p_o_i_n_t_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, │ │ │ │ │ +const Corners& corners, std::ostream& out) │ │ │ │ │ +44{ │ │ │ │ │ +45 using namespace ProjectionImplementation; │ │ │ │ │ +46 using std::get; │ │ │ │ │ +47 │ │ │ │ │ +48 for (std::size_t i = 0; i < projection._n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s(); ++i) { │ │ │ │ │ +49 const auto& local = projection._e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s()[i].local; │ │ │ │ │ +50 out << interpolate(local[0], get<0>(corners)) << "\n" │ │ │ │ │ +51 << interpolate(local[1], get<1>(corners)) << "\n"; │ │ │ │ │ +52 } │ │ │ │ │ +53} │ │ │ │ │ +54 │ │ │ │ │ +55template │ │ │ │ │ +_5_6void _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___n_o_r_m_a_l_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& │ │ │ │ │ +projection, const Normals& normals, std::ostream& out) │ │ │ │ │ +57{ │ │ │ │ │ +58 using namespace ProjectionImplementation; │ │ │ │ │ +59 using std::get; │ │ │ │ │ +60 │ │ │ │ │ +61 for (std::size_t i = 0; i < projection._n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s(); ++i) { │ │ │ │ │ +62 const auto& local = projection._e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s()[i].local; │ │ │ │ │ +63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals)); │ │ │ │ │ +64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals)); │ │ │ │ │ +65 │ │ │ │ │ +66 out << n0 << "\n" │ │ │ │ │ +67 << n1 << "\n"; │ │ │ │ │ +68 } │ │ │ │ │ +69} │ │ │ │ │ +70 │ │ │ │ │ +71template │ │ │ │ │ +_7_2void _w_r_i_t_e___s_u_c_c_e_s_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, std::ostream& │ │ │ │ │ +out) │ │ │ │ │ +73{ │ │ │ │ │ +74 using std::get; │ │ │ │ │ +75 │ │ │ │ │ +76 out << side << "\n"; │ │ │ │ │ +77 │ │ │ │ │ +78 const auto& success = get(projection._s_u_c_c_e_s_s()); │ │ │ │ │ +79 for (std::size_t i = 0; i < success.size(); ++i) │ │ │ │ │ +80 out << (success[i] ? "1\n" : "0\n"); │ │ │ │ │ +81} │ │ │ │ │ +82 │ │ │ │ │ +83} /* namespace ProjectionWriterImplementation */ │ │ │ │ │ +84 │ │ │ │ │ +85template │ │ │ │ │ +_8_6void _w_r_i_t_e(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, │ │ │ │ │ +87 const Corners& corners, │ │ │ │ │ +88 const Normals& normals, │ │ │ │ │ +89 std::ostream& out) │ │ │ │ │ +90{ │ │ │ │ │ +91 using namespace ProjectionWriterImplementation; │ │ │ │ │ +92 │ │ │ │ │ +93 const auto numberOfEdgeIntersections = projection._n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +(); │ │ │ │ │ +94 const auto nPoints = 12 + 2 * numberOfEdgeIntersections; │ │ │ │ │ 95 │ │ │ │ │ -101 _F_i_e_l_d m_epsilon = _F_i_e_l_d(1e-12); │ │ │ │ │ -102 │ │ │ │ │ -104 std::tuple m_images; │ │ │ │ │ -105 │ │ │ │ │ -107 std::tuple, std::bitset > m_success; │ │ │ │ │ -108 │ │ │ │ │ -110 unsigned m_number_of_edge_intersections; │ │ │ │ │ -111 │ │ │ │ │ -113 std::array m_edge_intersections; │ │ │ │ │ -114 │ │ │ │ │ -126 bool m_projection_valid; │ │ │ │ │ -127 │ │ │ │ │ -133 template │ │ │ │ │ -134 void doProjection(const std::tuple& corners, const │ │ │ │ │ -std::tuple& normals); │ │ │ │ │ -135 │ │ │ │ │ -144 template │ │ │ │ │ -145 void doInverseProjection(const std::tuple& corners, │ │ │ │ │ -const std::tuple& normals); │ │ │ │ │ -146 │ │ │ │ │ -155 template │ │ │ │ │ -156 void doEdgeIntersection(const std::tuple& corners, │ │ │ │ │ -const std::tuple& normals); │ │ │ │ │ -157 │ │ │ │ │ -183 template │ │ │ │ │ -184 inline bool projectionFeasible(const Coordinate& x, const Coordinate& nx, │ │ │ │ │ -const Coordinate& px, const Corners& corners, const Normals& normals) const; │ │ │ │ │ -185 │ │ │ │ │ -186public: │ │ │ │ │ -191 _P_r_o_j_e_c_t_i_o_n(const _F_i_e_l_d overlap = _F_i_e_l_d(0), const _F_i_e_l_d max_normal_product = │ │ │ │ │ -_F_i_e_l_d(-0.1)); │ │ │ │ │ -192 │ │ │ │ │ -198 void _e_p_s_i_l_o_n(const _F_i_e_l_d _e_p_s_i_l_o_n); │ │ │ │ │ -199 │ │ │ │ │ -212 template │ │ │ │ │ -213 void _p_r_o_j_e_c_t(const std::tuple& corners, const std:: │ │ │ │ │ -tuple& normals); │ │ │ │ │ -214 │ │ │ │ │ -_2_3_5 const std::tuple& _i_m_a_g_e_s() const │ │ │ │ │ -236 { return m_images; } │ │ │ │ │ -237 │ │ │ │ │ -_2_5_2 const std::tuple, std::bitset >& _s_u_c_c_e_s_s() const │ │ │ │ │ -253 { return m_success; } │ │ │ │ │ -254 │ │ │ │ │ -_2_6_2 unsigned _n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s() const │ │ │ │ │ -263 { return m_number_of_edge_intersections; } │ │ │ │ │ -264 │ │ │ │ │ -_2_7_3 const std::array& _e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ -() const │ │ │ │ │ -274 { return m_edge_intersections; } │ │ │ │ │ -275}; │ │ │ │ │ -276 │ │ │ │ │ -277} /* namespace GridGlue */ │ │ │ │ │ -278} /* namespace Dune */ │ │ │ │ │ -279 │ │ │ │ │ -280#include "_p_r_o_j_e_c_t_i_o_n___i_m_p_l_._h_h" │ │ │ │ │ -281 │ │ │ │ │ -282#endif │ │ │ │ │ -_p_r_o_j_e_c_t_i_o_n___i_m_p_l_._h_h │ │ │ │ │ +96 out << "# vtk DataFile Version2.0\n" │ │ │ │ │ +97 << "Filename: projection\n" │ │ │ │ │ +98 << "ASCII\n" │ │ │ │ │ +99 << "DATASET UNSTRUCTURED_GRID\n" │ │ │ │ │ +100 << "POINTS " << nPoints << " double\n"; │ │ │ │ │ +101 write_points<0>(projection, corners, out); │ │ │ │ │ +102 write_points<1>(projection, corners, out); │ │ │ │ │ +103 write_edge_intersection_points(projection, corners, out); │ │ │ │ │ +104 out << "CELLS " << (8 + numberOfEdgeIntersections) << " " << (26 + 3 * │ │ │ │ │ +numberOfEdgeIntersections) << "\n"; │ │ │ │ │ +105 out << "3 0 1 2\n" "2 0 3\n" "2 1 4\n" "2 2 5\n" │ │ │ │ │ +106 << "3 6 7 8\n" "2 6 9\n" "2 7 10\n" "2 8 11\n"; │ │ │ │ │ +107 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i) │ │ │ │ │ +108 out << "2 " << (12 + 2*i) << " " << (12 + 2*i + 1) << "\n"; │ │ │ │ │ +109 out << "CELL_TYPES " << (8 + numberOfEdgeIntersections) << "\n" │ │ │ │ │ +"5\n3\n3\n3\n" "5\n3\n3\n3\n"; │ │ │ │ │ +110 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i) │ │ │ │ │ +111 out << "3\n"; │ │ │ │ │ +112 out << "CELL_DATA " << (8 + numberOfEdgeIntersections) << "\n"; │ │ │ │ │ +113 out << "SCALARS success int 1\n" │ │ │ │ │ +114 << "LOOKUP_TABLE success\n"; │ │ │ │ │ +115 write_success<0>(projection, out); │ │ │ │ │ +116 write_success<1>(projection, out); │ │ │ │ │ +117 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i) │ │ │ │ │ +118 out << "2\n"; │ │ │ │ │ +119 out << "LOOKUP_TABLE success 2\n" │ │ │ │ │ +120 << "1.0 0.0 0.0 1.0\n" │ │ │ │ │ +121 << "0.0 1.0 0.0 1.0\n"; │ │ │ │ │ +122 out << "POINT_DATA " << nPoints << "\n" │ │ │ │ │ +123 << "NORMALS normals double\n"; │ │ │ │ │ +124 write_normals<0>(projection, normals, out); │ │ │ │ │ +125 write_normals<1>(projection, normals, out); │ │ │ │ │ +126 write_edge_intersection_normals(projection, normals, out); │ │ │ │ │ +127} │ │ │ │ │ +128 │ │ │ │ │ +129template │ │ │ │ │ +_1_3_0void _w_r_i_t_e(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, │ │ │ │ │ +131 const Corners& corners, │ │ │ │ │ +132 const Normals& normals, │ │ │ │ │ +133 const std::string& filename) │ │ │ │ │ +134{ │ │ │ │ │ +135 std::ofstream out(filename.c_str()); │ │ │ │ │ +136 _w_r_i_t_e(projection, corners, normals, out); │ │ │ │ │ +137} │ │ │ │ │ +138 │ │ │ │ │ +139template │ │ │ │ │ +_1_4_0void _p_r_i_n_t(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, │ │ │ │ │ +141 const Corners& corners, │ │ │ │ │ +142 const Normals& normals) │ │ │ │ │ +143{ │ │ │ │ │ +144 using namespace ProjectionWriterImplementation; │ │ │ │ │ +145 │ │ │ │ │ +146 std::cout << "Side 0 corners and images:\n"; │ │ │ │ │ +147 write_points<0>(projection, corners, std::cout); │ │ │ │ │ +148 std::cout << "Side 0 success:\n"; │ │ │ │ │ +149 write_success<0>(projection, std::cout); │ │ │ │ │ +150 std::cout << "Side 1 corners and images:\n"; │ │ │ │ │ +151 write_points<1>(projection, corners, std::cout); │ │ │ │ │ +152 std::cout << "Side 1 success:\n"; │ │ │ │ │ +153 write_success<1>(projection, std::cout); │ │ │ │ │ +154 std::cout << "Side 0 normals and projected normals:\n"; │ │ │ │ │ +155 write_normals<0>(projection, normals, std::cout); │ │ │ │ │ +156 std::cout << "Side 1 normals and projected normals:\n"; │ │ │ │ │ +157 write_normals<1>(projection, normals, std::cout); │ │ │ │ │ +158 std::cout << projection._n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s() << " edge │ │ │ │ │ +intersections:\n"; │ │ │ │ │ +159 write_edge_intersection_points(projection, corners, std::cout); │ │ │ │ │ +160} │ │ │ │ │ +161 │ │ │ │ │ +162} /* namespace GridGlue */ │ │ │ │ │ +163} /* namespace Dune */ │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e │ │ │ │ │ +void write(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ │ +const Normals &normals, std::ostream &out) │ │ │ │ │ +write projection in VTK format │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t │ │ │ │ │ +void print(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ │ +const Normals &normals) │ │ │ │ │ +Print information about the projection to std::cout stream. │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___n_o_r_m_a_l_s │ │ │ │ │ +void write_normals(const Projection< Coordinate > &projection, const Normals │ │ │ │ │ +&normals, std::ostream &out) │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:27 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___p_o_i_n_t_s │ │ │ │ │ +void write_points(const Projection< Coordinate > &projection, const Corners │ │ │ │ │ +&corners, std::ostream &out) │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:11 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___s_u_c_c_e_s_s │ │ │ │ │ +void write_success(const Projection< Coordinate > &projection, std::ostream │ │ │ │ │ +&out) │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:72 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___p_o_i_n_t_s │ │ │ │ │ +void write_edge_intersection_points(const Projection< Coordinate > &projection, │ │ │ │ │ +const Corners &corners, std::ostream &out) │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___n_o_r_m_a_l_s │ │ │ │ │ +void write_edge_intersection_normals(const Projection< Coordinate > │ │ │ │ │ +&projection, const Normals &normals, std::ostream &out) │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:56 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n │ │ │ │ │ Projection of a line (triangle) on another line (triangle). │ │ │ │ │ DDeeffiinniittiioonn projection.hh:21 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_F_i_e_l_d │ │ │ │ │ -Coordinate::field_type Field │ │ │ │ │ -Scalar type. │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:61 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_s_u_c_c_e_s_s │ │ │ │ │ const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const │ │ │ │ │ Indicate whether projection (inverse projection) is valid for each corner or │ │ │ │ │ not. │ │ │ │ │ DDeeffiinniittiioonn projection.hh:252 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_m_a_x_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ -static constexpr unsigned maxEdgeIntersections │ │ │ │ │ -maximum number of edge-edge intersections │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_P_r_e_i_m_a_g_e_s │ │ │ │ │ -Images Preimages │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:78 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_I_m_a_g_e_s │ │ │ │ │ -std::array< Coordinate, dim > Images │ │ │ │ │ -List of corner images. │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_e_p_s_i_l_o_n │ │ │ │ │ -void epsilon(const Field epsilon) │ │ │ │ │ -Set epsilon used for floating-point comparisons. │ │ │ │ │ -DDeeffiinniittiioonn projection_impl.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ │ -void project(const std::tuple< Corners &, Corners & > &corners, const std:: │ │ │ │ │ -tuple< Normals &, Normals & > &normals) │ │ │ │ │ -Do the actual projection. │ │ │ │ │ -DDeeffiinniittiioonn projection_impl.hh:469 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_d_i_m │ │ │ │ │ -static constexpr unsigned dim │ │ │ │ │ -dimension of coordinates │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:47 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ unsigned numberOfEdgeIntersections() const │ │ │ │ │ Number of edge intersections. │ │ │ │ │ DDeeffiinniittiioonn projection.hh:262 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_i_m_a_g_e_s │ │ │ │ │ const std::tuple< Images, Preimages > & images() const │ │ │ │ │ Images and preimages of corners. │ │ │ │ │ DDeeffiinniittiioonn projection.hh:235 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections │ │ │ │ │ () const │ │ │ │ │ Edge-edge intersections. │ │ │ │ │ DDeeffiinniittiioonn projection.hh:273 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -Intersection between two edges of a triangle. │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:29 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_:_:_l_o_c_a_l │ │ │ │ │ -std::array< Coordinate, 2 > local │ │ │ │ │ -Local coordinates of intersection and distance along normals. │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:41 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_:_:_e_d_g_e │ │ │ │ │ -std::array< unsigned, 2 > edge │ │ │ │ │ -Edge numbers in image and preimage triangle. │ │ │ │ │ -DDeeffiinniittiioonn projection.hh:33 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projection_impl.hh File Reference │ │ │ │ +dune-grid-glue: areawriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,47 +72,41 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
projection_impl.hh File Reference
│ │ │ │ +
areawriter.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <cmath>
│ │ │ │ +
#include <ostream>
│ │ │ │ +#include <string>
│ │ │ │ +#include "areawriter_impl.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
namespace  Dune::GridGlue::ProjectionImplementation
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

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

Go to the source code of this file.

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
namespace  Dune::Parallel
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Macros

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

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

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ CheckMPIStatus

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

Go to the source code of this file.

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

│ │ │ │ Classes

struct  Dune::GridGlue::AreaWriterImplementation::FacetLayout< dimgrid >
class  Dune::GridGlue::Projection< Coordinate >
 Projection of a line (triangle) on another line (triangle). More...
 
struct  Dune::GridGlue::Projection< Coordinate >::EdgeIntersection
 Intersection between two edges of a triangle. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ -

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
namespace  Dune::GridGlue::AreaWriterImplementation
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -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)
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,43 +1,28 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -areawriter_impl.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +projection.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_p_r_o_j_e_c_t_i_o_n___i_m_p_l_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_F_a_c_e_t_L_a_y_o_u_t_<_ _d_i_m_g_r_i_d_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_<_ _C_o_o_r_d_i_n_a_t_e_ _> │ │ │ │ │ +  _P_r_o_j_e_c_t_i_o_n of a line (triangle) on another line (triangle). _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_<_ _C_o_o_r_d_i_n_a_t_e_ _>_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +  _I_n_t_e_r_s_e_c_t_i_o_n between two edges of a triangle. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ │ -  │ │ │ │ │ -FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y (const │ │ │ │ │ - GridView &gv, std::ostream &out) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k (const Glue &glue, std::ostream &out) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k (const Glue &glue, const std::string │ │ │ │ │ - &filename) │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k (const Glue &glue, const std::string │ │ │ │ │ - &base) │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: areawriter_impl.hh Source File │ │ │ │ +dune-grid-glue: projection.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,183 +74,137 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
areawriter_impl.hh
│ │ │ │ +
projection.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
3#include <fstream>
│ │ │ │ -
4#include <vector>
│ │ │ │ +
3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │ +
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │
5
│ │ │ │ -
6#include <dune/common/fvector.hh>
│ │ │ │ -
7#include <dune/geometry/type.hh>
│ │ │ │ -
8#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ +
6#include <array>
│ │ │ │ +
7#include <bitset>
│ │ │ │ +
8#include <tuple>
│ │ │ │
9
│ │ │ │
10namespace Dune {
│ │ │ │
11namespace GridGlue {
│ │ │ │
12
│ │ │ │ -
│ │ │ │ -
13namespace AreaWriterImplementation {
│ │ │ │ -
14
│ │ │ │ -
15template<int dimgrid>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
17{
│ │ │ │ -
│ │ │ │ -
18 bool contains(Dune::GeometryType gt) const
│ │ │ │ -
19 {
│ │ │ │ -
20 return gt.dim() == dimgrid - 1;
│ │ │ │ -
21 }
│ │ │ │ -
│ │ │ │ -
22};
│ │ │ │ -
│ │ │ │ -
23
│ │ │ │ -
24template<typename GridView>
│ │ │ │ -
│ │ │ │ -
25void write_facet_geometry(const GridView& gv, std::ostream& out)
│ │ │ │ -
26{
│ │ │ │ -
27 using Coordinate = Dune::FieldVector<double, 3>;
│ │ │ │ -
28
│ │ │ │ -
29 std::vector<Coordinate> corners;
│ │ │ │ -
30 for (const auto& facet : facets(gv)) {
│ │ │ │ -
31 const auto geometry = facet.geometry();
│ │ │ │ -
32 for (int i = 0; i < geometry.corners(); ++i) {
│ │ │ │ -
33 /* VTK always needs 3-dim coordinates... */
│ │ │ │ -
34 const auto c0 = geometry.corner(i);
│ │ │ │ -
35 Coordinate c1;
│ │ │ │ -
36 for (int d = 0; d < GridView::dimensionworld; ++d)
│ │ │ │ -
37 c1[d] = c0[d];
│ │ │ │ -
38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d)
│ │ │ │ -
39 c1[d] = double(0);
│ │ │ │ -
40 corners.push_back(c1);
│ │ │ │ -
41 }
│ │ │ │ -
42 }
│ │ │ │ +
19template<typename Coordinate>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
21{
│ │ │ │ +
22public:
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
29 {
│ │ │ │ +
33 std::array<unsigned, 2> edge;
│ │ │ │ +
34
│ │ │ │ +
41 std::array<Coordinate, 2> local;
│ │ │ │ +
42 };
│ │ │ │ +
│ │ │ │
43
│ │ │ │ -
44 {
│ │ │ │ -
45 out << "DATASET UNSTRUCTURED_GRID\n"
│ │ │ │ -
46 << "POINTS " << corners.size() << " double\n";
│ │ │ │ -
47 for (const auto& c : corners)
│ │ │ │ -
48 out << c << "\n";
│ │ │ │ -
49 }
│ │ │ │ -
50 {
│ │ │ │ -
51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << "\n";
│ │ │ │ -
52 std::size_t c = 0;
│ │ │ │ -
53 for (const auto& facet : facets(gv)) {
│ │ │ │ -
54 const auto geometry = facet.geometry();
│ │ │ │ -
55 out << geometry.corners();
│ │ │ │ -
56 for (int i = 0; i < geometry.corners(); ++i, ++c)
│ │ │ │ -
57 out << " " << c;
│ │ │ │ -
58 out << "\n";
│ │ │ │ -
59 }
│ │ │ │ -
60 }
│ │ │ │ -
61 {
│ │ │ │ -
62 out << "CELL_TYPES " << gv.size(1) << "\n";
│ │ │ │ -
63 for (const auto& facet : facets(gv)) {
│ │ │ │ -
64 const auto type = facet.type();
│ │ │ │ -
65 if (type.isVertex())
│ │ │ │ -
66 out << "1\n";
│ │ │ │ -
67 else if (type.isLine())
│ │ │ │ -
68 out << "2\n";
│ │ │ │ -
69 else if (type.isTriangle())
│ │ │ │ -
70 out << "5\n";
│ │ │ │ -
71 else if (type.isQuadrilateral())
│ │ │ │ -
72 out << "9\n";
│ │ │ │ -
73 else if (type.isTetrahedron())
│ │ │ │ -
74 out << "10\n";
│ │ │ │ -
75 else
│ │ │ │ -
76 DUNE_THROW(Dune::Exception, "Unhandled geometry type");
│ │ │ │ -
77 }
│ │ │ │ -
78 }
│ │ │ │ -
79}
│ │ │ │ -
│ │ │ │ -
80
│ │ │ │ -
81} /* namespace AreaWriterImplementation */
│ │ │ │ -
│ │ │ │ -
82
│ │ │ │ -
83template<int side, typename Glue>
│ │ │ │ -
│ │ │ │ -
84void write_glue_area_vtk(const Glue& glue, std::ostream& out)
│ │ │ │ -
85{
│ │ │ │ -
86 using GridView = typename std::decay< decltype(glue.template gridView<side>()) >::type;
│ │ │ │ -
87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, AreaWriterImplementation::FacetLayout>;
│ │ │ │ -
88 using ctype = typename GridView::ctype;
│ │ │ │ -
89
│ │ │ │ -
90 const GridView gv = glue.template gridView<side>();
│ │ │ │ -
91 Mapper mapper(gv);
│ │ │ │ -
92 std::vector<ctype> coveredArea(mapper.size(), ctype(0));
│ │ │ │ -
93 std::vector<ctype> totalArea(mapper.size(), ctype(1));
│ │ │ │ -
94
│ │ │ │ -
95 for (const auto& in : intersections(glue, Reverse<side == 1>())) {
│ │ │ │ -
96 const auto element = in.inside();
│ │ │ │ -
97 const auto index = mapper.subIndex(element, in.indexInInside(), 1);
│ │ │ │ -
98 coveredArea[index] += in.geometryInInside().volume();
│ │ │ │ -
99
│ │ │ │ -
100 const auto& refElement = Dune::ReferenceElements<ctype, GridView::dimension>::general(element.type());
│ │ │ │ -
101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside());
│ │ │ │ -
102 totalArea[index] = subGeometry.volume();
│ │ │ │ -
103 }
│ │ │ │ -
104
│ │ │ │ -
105 for (std::size_t i = 0; i < coveredArea.size(); ++i)
│ │ │ │ -
106 coveredArea[i] /= totalArea[i];
│ │ │ │ -
107
│ │ │ │ -
108 out << "# vtk DataFile Version 2.0\n"
│ │ │ │ -
109 << "Filename: Glue Area\n"
│ │ │ │ -
110 << "ASCII\n";
│ │ │ │ +
47 constexpr static unsigned dim = Coordinate::dimension;
│ │ │ │ +
48
│ │ │ │ +
54 constexpr static unsigned maxEdgeIntersections = dim == 3 ? 9 : 0;
│ │ │ │ +
55
│ │ │ │ +
56 static_assert(dim == 2 || dim == 3, "Projection only implemented for dim=2 or dim=3");
│ │ │ │ +
57
│ │ │ │ +
61 typedef typename Coordinate::field_type Field;
│ │ │ │ +
62
│ │ │ │ +
70 typedef std::array<Coordinate, dim> Images;
│ │ │ │ +
71
│ │ │ │ + │ │ │ │ +
79
│ │ │ │ +
80private:
│ │ │ │ +
84 const Field m_overlap;
│ │ │ │ +
85
│ │ │ │ +
94 const Field m_max_normal_product;
│ │ │ │ +
95
│ │ │ │ +
101 Field m_epsilon = Field(1e-12);
│ │ │ │ +
102
│ │ │ │ +
104 std::tuple<Images, Preimages> m_images;
│ │ │ │ +
105
│ │ │ │ +
107 std::tuple<std::bitset<dim>, std::bitset<dim> > m_success;
│ │ │ │ +
108
│ │ │ │ +
110 unsigned m_number_of_edge_intersections;
│ │ │ │
111
│ │ │ │ - │ │ │ │ -
113
│ │ │ │ -
114 out << "CELL_DATA " << coveredArea.size() << "\n"
│ │ │ │ -
115 << "SCALARS CoveredArea double 1\n"
│ │ │ │ -
116 << "LOOKUP_TABLE default\n";
│ │ │ │ -
117 for (const auto& value : coveredArea)
│ │ │ │ -
118 out << value << "\n";
│ │ │ │ -
119}
│ │ │ │ -
│ │ │ │ -
120
│ │ │ │ -
121template<int side, typename Glue>
│ │ │ │ -
│ │ │ │ -
122void write_glue_area_vtk(const Glue& glue, const std::string& filename)
│ │ │ │ -
123{
│ │ │ │ -
124 std::ofstream out(filename.c_str());
│ │ │ │ -
125 write_glue_area_vtk<side>(glue, out);
│ │ │ │ -
126}
│ │ │ │ -
│ │ │ │ +
113 std::array<EdgeIntersection, maxEdgeIntersections> m_edge_intersections;
│ │ │ │ +
114
│ │ │ │ +
126 bool m_projection_valid;
│ │ │ │
127
│ │ │ │ -
128template<typename Glue>
│ │ │ │ -
│ │ │ │ -
129void write_glue_areas_vtk(const Glue& glue, const std::string& base)
│ │ │ │ -
130{
│ │ │ │ -
131 {
│ │ │ │ -
132 std::string filename = base;
│ │ │ │ -
133 filename += "-inside.vtk";
│ │ │ │ -
134 write_glue_area_vtk<0>(glue, filename);
│ │ │ │ -
135 }
│ │ │ │ -
136 {
│ │ │ │ -
137 std::string filename = base;
│ │ │ │ -
138 filename += "-outside.vtk";
│ │ │ │ -
139 write_glue_area_vtk<1>(glue, filename);
│ │ │ │ -
140 }
│ │ │ │ -
141}
│ │ │ │ -
│ │ │ │ -
142
│ │ │ │ -
143} /* namespace GridGlue */
│ │ │ │ -
144} /* namespace Dune */
│ │ │ │ +
133 template<typename Corners, typename Normals>
│ │ │ │ +
134 void doProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ +
135
│ │ │ │ +
144 template<typename Corners, typename Normals>
│ │ │ │ +
145 void doInverseProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ +
146
│ │ │ │ +
155 template<typename Corners, typename Normals>
│ │ │ │ +
156 void doEdgeIntersection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ +
157
│ │ │ │ +
183 template<typename Corners, typename Normals>
│ │ │ │ +
184 inline bool projectionFeasible(const Coordinate& x, const Coordinate& nx, const Coordinate& px, const Corners& corners, const Normals& normals) const;
│ │ │ │ +
185
│ │ │ │ +
186public:
│ │ │ │ +
191 Projection(const Field overlap = Field(0), const Field max_normal_product = Field(-0.1));
│ │ │ │ +
192
│ │ │ │ +
198 void epsilon(const Field epsilon);
│ │ │ │ +
199
│ │ │ │ +
212 template<typename Corners, typename Normals>
│ │ │ │ +
213 void project(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals);
│ │ │ │ +
214
│ │ │ │ +
│ │ │ │ +
235 const std::tuple<Images, Preimages>& images() const
│ │ │ │ +
236 { return m_images; }
│ │ │ │ +
│ │ │ │ +
237
│ │ │ │ +
│ │ │ │ +
252 const std::tuple<std::bitset<dim>, std::bitset<dim> >& success() const
│ │ │ │ +
253 { return m_success; }
│ │ │ │ +
│ │ │ │ +
254
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
263 { return m_number_of_edge_intersections; }
│ │ │ │ +
│ │ │ │ +
264
│ │ │ │ +
│ │ │ │ +
273 const std::array<EdgeIntersection, maxEdgeIntersections>& edgeIntersections() const
│ │ │ │ +
274 { return m_edge_intersections; }
│ │ │ │ +
│ │ │ │ +
275};
│ │ │ │ +
│ │ │ │ +
276
│ │ │ │ +
277} /* namespace GridGlue */
│ │ │ │ +
278} /* namespace Dune */
│ │ │ │ +
279
│ │ │ │ +
280#include "projection_impl.hh"
│ │ │ │ +
281
│ │ │ │ +
282#endif
│ │ │ │ + │ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
void write_glue_area_vtk(const Glue &glue, std::ostream &out)
Definition areawriter_impl.hh:84
│ │ │ │ -
void write_glue_areas_vtk(const Glue &glue, const std::string &base)
Definition areawriter_impl.hh:129
│ │ │ │ -
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ -
void write_facet_geometry(const GridView &gv, std::ostream &out)
Definition areawriter_impl.hh:25
│ │ │ │ -
Definition rangegenerators.hh:17
│ │ │ │ - │ │ │ │ -
bool contains(Dune::GeometryType gt) const
Definition areawriter_impl.hh:18
│ │ │ │ +
Projection of a line (triangle) on another line (triangle).
Definition projection.hh:21
│ │ │ │ +
Coordinate::field_type Field
Scalar type.
Definition projection.hh:61
│ │ │ │ +
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
│ │ │ │ +
static constexpr unsigned maxEdgeIntersections
maximum number of edge-edge intersections
Definition projection.hh:54
│ │ │ │ +
Images Preimages
Definition projection.hh:78
│ │ │ │ +
std::array< Coordinate, dim > Images
List of corner images.
Definition projection.hh:70
│ │ │ │ +
void epsilon(const Field epsilon)
Set epsilon used for floating-point comparisons.
Definition projection_impl.hh:140
│ │ │ │ +
void project(const std::tuple< Corners &, Corners & > &corners, const std::tuple< Normals &, Normals & > &normals)
Do the actual projection.
Definition projection_impl.hh:469
│ │ │ │ +
static constexpr unsigned dim
dimension of coordinates
Definition projection.hh:47
│ │ │ │ +
unsigned numberOfEdgeIntersections() const
Number of edge intersections.
Definition projection.hh:262
│ │ │ │ +
const std::tuple< Images, Preimages > & images() const
Images and preimages of corners.
Definition projection.hh:235
│ │ │ │ +
const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections() const
Edge-edge intersections.
Definition projection.hh:273
│ │ │ │ +
Intersection between two edges of a triangle.
Definition projection.hh:29
│ │ │ │ +
std::array< Coordinate, 2 > local
Local coordinates of intersection and distance along normals.
Definition projection.hh:41
│ │ │ │ +
std::array< unsigned, 2 > edge
Edge numbers in image and preimage triangle.
Definition projection.hh:33
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,184 +1,175 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -areawriter_impl.hh │ │ │ │ │ +projection.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -3#include │ │ │ │ │ -4#include │ │ │ │ │ +3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ +4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ 5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8#include │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8#include │ │ │ │ │ 9 │ │ │ │ │ 10namespace _D_u_n_e { │ │ │ │ │ 11namespace GridGlue { │ │ │ │ │ 12 │ │ │ │ │ -_1_3namespace AreaWriterImplementation { │ │ │ │ │ -14 │ │ │ │ │ -15template │ │ │ │ │ -_1_6struct _F_a_c_e_t_L_a_y_o_u_t │ │ │ │ │ -17{ │ │ │ │ │ -_1_8 bool _c_o_n_t_a_i_n_s(Dune::GeometryType gt) const │ │ │ │ │ -19 { │ │ │ │ │ -20 return gt.dim() == dimgrid - 1; │ │ │ │ │ -21 } │ │ │ │ │ -22}; │ │ │ │ │ -23 │ │ │ │ │ -24template │ │ │ │ │ -_2_5void _w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y(const GridView& gv, std::ostream& out) │ │ │ │ │ -26{ │ │ │ │ │ -27 using Coordinate = Dune::FieldVector; │ │ │ │ │ -28 │ │ │ │ │ -29 std::vector corners; │ │ │ │ │ -30 for (const auto& facet : facets(gv)) { │ │ │ │ │ -31 const auto geometry = facet.geometry(); │ │ │ │ │ -32 for (int i = 0; i < geometry.corners(); ++i) { │ │ │ │ │ -33 /* VTK always needs 3-dim coordinates... */ │ │ │ │ │ -34 const auto c0 = geometry.corner(i); │ │ │ │ │ -35 Coordinate c1; │ │ │ │ │ -36 for (int d = 0; d < GridView::dimensionworld; ++d) │ │ │ │ │ -37 c1[d] = c0[d]; │ │ │ │ │ -38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d) │ │ │ │ │ -39 c1[d] = double(0); │ │ │ │ │ -40 corners.push_back(c1); │ │ │ │ │ -41 } │ │ │ │ │ -42 } │ │ │ │ │ +19template │ │ │ │ │ +_2_0class _P_r_o_j_e_c_t_i_o_n │ │ │ │ │ +21{ │ │ │ │ │ +22public: │ │ │ │ │ +_2_8 struct _E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +29 { │ │ │ │ │ +_3_3 std::array _e_d_g_e; │ │ │ │ │ +34 │ │ │ │ │ +_4_1 std::array _l_o_c_a_l; │ │ │ │ │ +42 }; │ │ │ │ │ 43 │ │ │ │ │ -44 { │ │ │ │ │ -45 out << "DATASET UNSTRUCTURED_GRID\n" │ │ │ │ │ -46 << "POINTS " << corners.size() << " double\n"; │ │ │ │ │ -47 for (const auto& c : corners) │ │ │ │ │ -48 out << c << "\n"; │ │ │ │ │ -49 } │ │ │ │ │ -50 { │ │ │ │ │ -51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << │ │ │ │ │ -"\n"; │ │ │ │ │ -52 std::size_t c = 0; │ │ │ │ │ -53 for (const auto& facet : facets(gv)) { │ │ │ │ │ -54 const auto geometry = facet.geometry(); │ │ │ │ │ -55 out << geometry.corners(); │ │ │ │ │ -56 for (int i = 0; i < geometry.corners(); ++i, ++c) │ │ │ │ │ -57 out << " " << c; │ │ │ │ │ -58 out << "\n"; │ │ │ │ │ -59 } │ │ │ │ │ -60 } │ │ │ │ │ -61 { │ │ │ │ │ -62 out << "CELL_TYPES " << gv.size(1) << "\n"; │ │ │ │ │ -63 for (const auto& facet : facets(gv)) { │ │ │ │ │ -64 const auto type = facet.type(); │ │ │ │ │ -65 if (type.isVertex()) │ │ │ │ │ -66 out << "1\n"; │ │ │ │ │ -67 else if (type.isLine()) │ │ │ │ │ -68 out << "2\n"; │ │ │ │ │ -69 else if (type.isTriangle()) │ │ │ │ │ -70 out << "5\n"; │ │ │ │ │ -71 else if (type.isQuadrilateral()) │ │ │ │ │ -72 out << "9\n"; │ │ │ │ │ -73 else if (type.isTetrahedron()) │ │ │ │ │ -74 out << "10\n"; │ │ │ │ │ -75 else │ │ │ │ │ -76 DUNE_THROW(Dune::Exception, "Unhandled geometry type"); │ │ │ │ │ -77 } │ │ │ │ │ -78 } │ │ │ │ │ -79} │ │ │ │ │ -80 │ │ │ │ │ -81} /* namespace AreaWriterImplementation */ │ │ │ │ │ -82 │ │ │ │ │ -83template │ │ │ │ │ -_8_4void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, std::ostream& out) │ │ │ │ │ -85{ │ │ │ │ │ -86 using GridView = typename std::decay< decltype(glue.template gridView │ │ │ │ │ -()) >::type; │ │ │ │ │ -87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper; │ │ │ │ │ -88 using ctype = typename GridView::ctype; │ │ │ │ │ -89 │ │ │ │ │ -90 const GridView gv = glue.template gridView(); │ │ │ │ │ -91 Mapper mapper(gv); │ │ │ │ │ -92 std::vector coveredArea(mapper.size(), ctype(0)); │ │ │ │ │ -93 std::vector totalArea(mapper.size(), ctype(1)); │ │ │ │ │ -94 │ │ │ │ │ -95 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(glue, _R_e_v_e_r_s_e_<_s_i_d_e_ _=_=_ _1_>())) { │ │ │ │ │ -96 const auto element = in.inside(); │ │ │ │ │ -97 const auto index = mapper.subIndex(element, in.indexInInside(), 1); │ │ │ │ │ -98 coveredArea[index] += in.geometryInInside().volume(); │ │ │ │ │ -99 │ │ │ │ │ -100 const auto& refElement = Dune::ReferenceElements::general(element.type()); │ │ │ │ │ -101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside │ │ │ │ │ -()); │ │ │ │ │ -102 totalArea[index] = subGeometry.volume(); │ │ │ │ │ -103 } │ │ │ │ │ -104 │ │ │ │ │ -105 for (std::size_t i = 0; i < coveredArea.size(); ++i) │ │ │ │ │ -106 coveredArea[i] /= totalArea[i]; │ │ │ │ │ -107 │ │ │ │ │ -108 out << "# vtk DataFile Version 2.0\n" │ │ │ │ │ -109 << "Filename: Glue Area\n" │ │ │ │ │ -110 << "ASCII\n"; │ │ │ │ │ +_4_7 constexpr static unsigned _d_i_m = Coordinate::dimension; │ │ │ │ │ +48 │ │ │ │ │ +_5_4 constexpr static unsigned _m_a_x_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s = _d_i_m == 3 ? 9 : 0; │ │ │ │ │ +55 │ │ │ │ │ +56 static_assert(_d_i_m == 2 || _d_i_m == 3, "Projection only implemented for dim=2 │ │ │ │ │ +or dim=3"); │ │ │ │ │ +57 │ │ │ │ │ +_6_1 typedef typename Coordinate::field_type _F_i_e_l_d; │ │ │ │ │ +62 │ │ │ │ │ +_7_0 typedef std::array _I_m_a_g_e_s; │ │ │ │ │ +71 │ │ │ │ │ +_7_8 typedef _I_m_a_g_e_s _P_r_e_i_m_a_g_e_s; │ │ │ │ │ +79 │ │ │ │ │ +80private: │ │ │ │ │ +84 const _F_i_e_l_d m_overlap; │ │ │ │ │ +85 │ │ │ │ │ +94 const _F_i_e_l_d m_max_normal_product; │ │ │ │ │ +95 │ │ │ │ │ +101 _F_i_e_l_d m_epsilon = _F_i_e_l_d(1e-12); │ │ │ │ │ +102 │ │ │ │ │ +104 std::tuple m_images; │ │ │ │ │ +105 │ │ │ │ │ +107 std::tuple, std::bitset > m_success; │ │ │ │ │ +108 │ │ │ │ │ +110 unsigned m_number_of_edge_intersections; │ │ │ │ │ 111 │ │ │ │ │ -112 _A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y(gv, out); │ │ │ │ │ -113 │ │ │ │ │ -114 out << "CELL_DATA " << coveredArea.size() << "\n" │ │ │ │ │ -115 << "SCALARS CoveredArea double 1\n" │ │ │ │ │ -116 << "LOOKUP_TABLE default\n"; │ │ │ │ │ -117 for (const auto& value : coveredArea) │ │ │ │ │ -118 out << value << "\n"; │ │ │ │ │ -119} │ │ │ │ │ -120 │ │ │ │ │ -121template │ │ │ │ │ -_1_2_2void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, const std::string& filename) │ │ │ │ │ -123{ │ │ │ │ │ -124 std::ofstream out(filename.c_str()); │ │ │ │ │ -125 write_glue_area_vtk(glue, out); │ │ │ │ │ -126} │ │ │ │ │ +113 std::array m_edge_intersections; │ │ │ │ │ +114 │ │ │ │ │ +126 bool m_projection_valid; │ │ │ │ │ 127 │ │ │ │ │ -128template │ │ │ │ │ -_1_2_9void _w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k(const Glue& glue, const std::string& base) │ │ │ │ │ -130{ │ │ │ │ │ -131 { │ │ │ │ │ -132 std::string filename = base; │ │ │ │ │ -133 filename += "-inside.vtk"; │ │ │ │ │ -134 write_glue_area_vtk<0>(glue, filename); │ │ │ │ │ -135 } │ │ │ │ │ -136 { │ │ │ │ │ -137 std::string filename = base; │ │ │ │ │ -138 filename += "-outside.vtk"; │ │ │ │ │ -139 write_glue_area_vtk<1>(glue, filename); │ │ │ │ │ -140 } │ │ │ │ │ -141} │ │ │ │ │ -142 │ │ │ │ │ -143} /* namespace GridGlue */ │ │ │ │ │ -144} /* namespace Dune */ │ │ │ │ │ +133 template │ │ │ │ │ +134 void doProjection(const std::tuple& corners, const │ │ │ │ │ +std::tuple& normals); │ │ │ │ │ +135 │ │ │ │ │ +144 template │ │ │ │ │ +145 void doInverseProjection(const std::tuple& corners, │ │ │ │ │ +const std::tuple& normals); │ │ │ │ │ +146 │ │ │ │ │ +155 template │ │ │ │ │ +156 void doEdgeIntersection(const std::tuple& corners, │ │ │ │ │ +const std::tuple& normals); │ │ │ │ │ +157 │ │ │ │ │ +183 template │ │ │ │ │ +184 inline bool projectionFeasible(const Coordinate& x, const Coordinate& nx, │ │ │ │ │ +const Coordinate& px, const Corners& corners, const Normals& normals) const; │ │ │ │ │ +185 │ │ │ │ │ +186public: │ │ │ │ │ +191 _P_r_o_j_e_c_t_i_o_n(const _F_i_e_l_d overlap = _F_i_e_l_d(0), const _F_i_e_l_d max_normal_product = │ │ │ │ │ +_F_i_e_l_d(-0.1)); │ │ │ │ │ +192 │ │ │ │ │ +198 void _e_p_s_i_l_o_n(const _F_i_e_l_d _e_p_s_i_l_o_n); │ │ │ │ │ +199 │ │ │ │ │ +212 template │ │ │ │ │ +213 void _p_r_o_j_e_c_t(const std::tuple& corners, const std:: │ │ │ │ │ +tuple& normals); │ │ │ │ │ +214 │ │ │ │ │ +_2_3_5 const std::tuple& _i_m_a_g_e_s() const │ │ │ │ │ +236 { return m_images; } │ │ │ │ │ +237 │ │ │ │ │ +_2_5_2 const std::tuple, std::bitset >& _s_u_c_c_e_s_s() const │ │ │ │ │ +253 { return m_success; } │ │ │ │ │ +254 │ │ │ │ │ +_2_6_2 unsigned _n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s() const │ │ │ │ │ +263 { return m_number_of_edge_intersections; } │ │ │ │ │ +264 │ │ │ │ │ +_2_7_3 const std::array& _e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +() const │ │ │ │ │ +274 { return m_edge_intersections; } │ │ │ │ │ +275}; │ │ │ │ │ +276 │ │ │ │ │ +277} /* namespace GridGlue */ │ │ │ │ │ +278} /* namespace Dune */ │ │ │ │ │ +279 │ │ │ │ │ +280#include "_p_r_o_j_e_c_t_i_o_n___i_m_p_l_._h_h" │ │ │ │ │ +281 │ │ │ │ │ +282#endif │ │ │ │ │ +_p_r_o_j_e_c_t_i_o_n___i_m_p_l_._h_h │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k │ │ │ │ │ -void write_glue_area_vtk(const Glue &glue, std::ostream &out) │ │ │ │ │ -DDeeffiinniittiioonn areawriter_impl.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k │ │ │ │ │ -void write_glue_areas_vtk(const Glue &glue, const std::string &base) │ │ │ │ │ -DDeeffiinniittiioonn areawriter_impl.hh:129 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ -IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ -> &reverse=!reversed) │ │ │ │ │ -Iterate over all intersections of a GridGlue. │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y │ │ │ │ │ -void write_facet_geometry(const GridView &gv, std::ostream &out) │ │ │ │ │ -DDeeffiinniittiioonn areawriter_impl.hh:25 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e │ │ │ │ │ -DDeeffiinniittiioonn rangegenerators.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_F_a_c_e_t_L_a_y_o_u_t │ │ │ │ │ -DDeeffiinniittiioonn areawriter_impl.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_F_a_c_e_t_L_a_y_o_u_t_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ -bool contains(Dune::GeometryType gt) const │ │ │ │ │ -DDeeffiinniittiioonn areawriter_impl.hh:18 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n │ │ │ │ │ +Projection of a line (triangle) on another line (triangle). │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:21 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_F_i_e_l_d │ │ │ │ │ +Coordinate::field_type Field │ │ │ │ │ +Scalar type. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_s_u_c_c_e_s_s │ │ │ │ │ +const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const │ │ │ │ │ +Indicate whether projection (inverse projection) is valid for each corner or │ │ │ │ │ +not. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:252 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_m_a_x_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +static constexpr unsigned maxEdgeIntersections │ │ │ │ │ +maximum number of edge-edge intersections │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:54 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_P_r_e_i_m_a_g_e_s │ │ │ │ │ +Images Preimages │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:78 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_I_m_a_g_e_s │ │ │ │ │ +std::array< Coordinate, dim > Images │ │ │ │ │ +List of corner images. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_e_p_s_i_l_o_n │ │ │ │ │ +void epsilon(const Field epsilon) │ │ │ │ │ +Set epsilon used for floating-point comparisons. │ │ │ │ │ +DDeeffiinniittiioonn projection_impl.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ │ +void project(const std::tuple< Corners &, Corners & > &corners, const std:: │ │ │ │ │ +tuple< Normals &, Normals & > &normals) │ │ │ │ │ +Do the actual projection. │ │ │ │ │ +DDeeffiinniittiioonn projection_impl.hh:469 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_d_i_m │ │ │ │ │ +static constexpr unsigned dim │ │ │ │ │ +dimension of coordinates │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:47 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +unsigned numberOfEdgeIntersections() const │ │ │ │ │ +Number of edge intersections. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:262 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_i_m_a_g_e_s │ │ │ │ │ +const std::tuple< Images, Preimages > & images() const │ │ │ │ │ +Images and preimages of corners. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:235 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections │ │ │ │ │ +() const │ │ │ │ │ +Edge-edge intersections. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:273 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +Intersection between two edges of a triangle. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:29 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_:_:_l_o_c_a_l │ │ │ │ │ +std::array< Coordinate, 2 > local │ │ │ │ │ +Local coordinates of intersection and distance along normals. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:41 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_:_:_e_d_g_e │ │ │ │ │ +std::array< unsigned, 2 > edge │ │ │ │ │ +Edge numbers in image and preimage triangle. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:33 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projectionwriter_impl.hh File Reference │ │ │ │ +dune-grid-glue: crossproduct.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,59 +72,33 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
projectionwriter_impl.hh File Reference
│ │ │ │ +
crossproduct.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <fstream>
│ │ │ │ -
│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
namespace  Dune::GridGlue::ProjectionWriterImplementation
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

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

Go to the source code of this file.

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

│ │ │ │ +Classes

struct  Dune::GridGlue::AreaWriterImplementation::FacetLayout< dimgrid >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
namespace  Dune::GridGlue::AreaWriterImplementation
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ Functions

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
 
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
 
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.
 
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)
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +1,43 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -projectionwriter.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_c_o_m_m_o_n_/_p_r_o_j_e_c_t_i_o_n_._h_h> │ │ │ │ │ -#include "_p_r_o_j_e_c_t_i_o_n_w_r_i_t_e_r___i_m_p_l_._h_h" │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +areawriter_impl.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ +CCllaasssseess │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_F_a_c_e_t_L_a_y_o_u_t_<_ _d_i_m_g_r_i_d_ _> │ │ │ │ │ +  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ +namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ │ +  │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ - Corners &corners, const Normals &normals, std::ostream &out) │ │ │ │ │ -  write projection in VTK format │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ - Corners &corners, const Normals &normals, const std::string &filename) │ │ │ │ │ -  write projection in VTK format │ │ │ │ │ -  │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ - Corners &corners, const Normals &normals) │ │ │ │ │ -  Print information about the projection to std::cout stream. │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y (const │ │ │ │ │ + GridView &gv, std::ostream &out) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k (const Glue &glue, std::ostream &out) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k (const Glue &glue, const std::string │ │ │ │ │ + &filename) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k (const Glue &glue, const std::string │ │ │ │ │ + &base) │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projectionwriter.hh Source File │ │ │ │ +dune-grid-glue: areawriter_impl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,57 +74,183 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
projectionwriter.hh
│ │ │ │ +
areawriter_impl.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
│ │ │ │ +
3#include <fstream>
│ │ │ │ +
4#include <vector>
│ │ │ │
5
│ │ │ │ -
6#include <iostream>
│ │ │ │ -
7#include <string>
│ │ │ │ -
8
│ │ │ │ - │ │ │ │ -
10
│ │ │ │ -
11namespace Dune {
│ │ │ │ -
12namespace GridGlue {
│ │ │ │ -
13
│ │ │ │ -
28template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ -
29void write(const Projection<Coordinate>& projection,
│ │ │ │ -
30 const Corners& corners,
│ │ │ │ -
31 const Normals& normals,
│ │ │ │ -
32 std::ostream& out);
│ │ │ │ -
33
│ │ │ │ -
40template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ -
41void write(const Projection<Coordinate>& projection,
│ │ │ │ -
42 const Corners& corners,
│ │ │ │ -
43 const Normals& normals,
│ │ │ │ -
44 const std::string& filename);
│ │ │ │ -
54template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ -
55void print(const Projection<Coordinate>& projection,
│ │ │ │ -
56 const Corners& corners,
│ │ │ │ -
57 const Normals& normals);
│ │ │ │ -
58
│ │ │ │ -
59} /* namespace GridGlue */
│ │ │ │ -
60} /* namespace Dune */
│ │ │ │ -
61
│ │ │ │ - │ │ │ │ -
63
│ │ │ │ -
64#endif
│ │ │ │ - │ │ │ │ - │ │ │ │ +
6#include <dune/common/fvector.hh>
│ │ │ │ +
7#include <dune/geometry/type.hh>
│ │ │ │ +
8#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ +
9
│ │ │ │ +
10namespace Dune {
│ │ │ │ +
11namespace GridGlue {
│ │ │ │ +
12
│ │ │ │ +
│ │ │ │ +
13namespace AreaWriterImplementation {
│ │ │ │ +
14
│ │ │ │ +
15template<int dimgrid>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
17{
│ │ │ │ +
│ │ │ │ +
18 bool contains(Dune::GeometryType gt) const
│ │ │ │ +
19 {
│ │ │ │ +
20 return gt.dim() == dimgrid - 1;
│ │ │ │ +
21 }
│ │ │ │ +
│ │ │ │ +
22};
│ │ │ │ +
│ │ │ │ +
23
│ │ │ │ +
24template<typename GridView>
│ │ │ │ +
│ │ │ │ +
25void write_facet_geometry(const GridView& gv, std::ostream& out)
│ │ │ │ +
26{
│ │ │ │ +
27 using Coordinate = Dune::FieldVector<double, 3>;
│ │ │ │ +
28
│ │ │ │ +
29 std::vector<Coordinate> corners;
│ │ │ │ +
30 for (const auto& facet : facets(gv)) {
│ │ │ │ +
31 const auto geometry = facet.geometry();
│ │ │ │ +
32 for (int i = 0; i < geometry.corners(); ++i) {
│ │ │ │ +
33 /* VTK always needs 3-dim coordinates... */
│ │ │ │ +
34 const auto c0 = geometry.corner(i);
│ │ │ │ +
35 Coordinate c1;
│ │ │ │ +
36 for (int d = 0; d < GridView::dimensionworld; ++d)
│ │ │ │ +
37 c1[d] = c0[d];
│ │ │ │ +
38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d)
│ │ │ │ +
39 c1[d] = double(0);
│ │ │ │ +
40 corners.push_back(c1);
│ │ │ │ +
41 }
│ │ │ │ +
42 }
│ │ │ │ +
43
│ │ │ │ +
44 {
│ │ │ │ +
45 out << "DATASET UNSTRUCTURED_GRID\n"
│ │ │ │ +
46 << "POINTS " << corners.size() << " double\n";
│ │ │ │ +
47 for (const auto& c : corners)
│ │ │ │ +
48 out << c << "\n";
│ │ │ │ +
49 }
│ │ │ │ +
50 {
│ │ │ │ +
51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << "\n";
│ │ │ │ +
52 std::size_t c = 0;
│ │ │ │ +
53 for (const auto& facet : facets(gv)) {
│ │ │ │ +
54 const auto geometry = facet.geometry();
│ │ │ │ +
55 out << geometry.corners();
│ │ │ │ +
56 for (int i = 0; i < geometry.corners(); ++i, ++c)
│ │ │ │ +
57 out << " " << c;
│ │ │ │ +
58 out << "\n";
│ │ │ │ +
59 }
│ │ │ │ +
60 }
│ │ │ │ +
61 {
│ │ │ │ +
62 out << "CELL_TYPES " << gv.size(1) << "\n";
│ │ │ │ +
63 for (const auto& facet : facets(gv)) {
│ │ │ │ +
64 const auto type = facet.type();
│ │ │ │ +
65 if (type.isVertex())
│ │ │ │ +
66 out << "1\n";
│ │ │ │ +
67 else if (type.isLine())
│ │ │ │ +
68 out << "2\n";
│ │ │ │ +
69 else if (type.isTriangle())
│ │ │ │ +
70 out << "5\n";
│ │ │ │ +
71 else if (type.isQuadrilateral())
│ │ │ │ +
72 out << "9\n";
│ │ │ │ +
73 else if (type.isTetrahedron())
│ │ │ │ +
74 out << "10\n";
│ │ │ │ +
75 else
│ │ │ │ +
76 DUNE_THROW(Dune::Exception, "Unhandled geometry type");
│ │ │ │ +
77 }
│ │ │ │ +
78 }
│ │ │ │ +
79}
│ │ │ │ +
│ │ │ │ +
80
│ │ │ │ +
81} /* namespace AreaWriterImplementation */
│ │ │ │ +
│ │ │ │ +
82
│ │ │ │ +
83template<int side, typename Glue>
│ │ │ │ +
│ │ │ │ +
84void write_glue_area_vtk(const Glue& glue, std::ostream& out)
│ │ │ │ +
85{
│ │ │ │ +
86 using GridView = typename std::decay< decltype(glue.template gridView<side>()) >::type;
│ │ │ │ +
87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, AreaWriterImplementation::FacetLayout>;
│ │ │ │ +
88 using ctype = typename GridView::ctype;
│ │ │ │ +
89
│ │ │ │ +
90 const GridView gv = glue.template gridView<side>();
│ │ │ │ +
91 Mapper mapper(gv);
│ │ │ │ +
92 std::vector<ctype> coveredArea(mapper.size(), ctype(0));
│ │ │ │ +
93 std::vector<ctype> totalArea(mapper.size(), ctype(1));
│ │ │ │ +
94
│ │ │ │ +
95 for (const auto& in : intersections(glue, Reverse<side == 1>())) {
│ │ │ │ +
96 const auto element = in.inside();
│ │ │ │ +
97 const auto index = mapper.subIndex(element, in.indexInInside(), 1);
│ │ │ │ +
98 coveredArea[index] += in.geometryInInside().volume();
│ │ │ │ +
99
│ │ │ │ +
100 const auto& refElement = Dune::ReferenceElements<ctype, GridView::dimension>::general(element.type());
│ │ │ │ +
101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside());
│ │ │ │ +
102 totalArea[index] = subGeometry.volume();
│ │ │ │ +
103 }
│ │ │ │ +
104
│ │ │ │ +
105 for (std::size_t i = 0; i < coveredArea.size(); ++i)
│ │ │ │ +
106 coveredArea[i] /= totalArea[i];
│ │ │ │ +
107
│ │ │ │ +
108 out << "# vtk DataFile Version 2.0\n"
│ │ │ │ +
109 << "Filename: Glue Area\n"
│ │ │ │ +
110 << "ASCII\n";
│ │ │ │ +
111
│ │ │ │ + │ │ │ │ +
113
│ │ │ │ +
114 out << "CELL_DATA " << coveredArea.size() << "\n"
│ │ │ │ +
115 << "SCALARS CoveredArea double 1\n"
│ │ │ │ +
116 << "LOOKUP_TABLE default\n";
│ │ │ │ +
117 for (const auto& value : coveredArea)
│ │ │ │ +
118 out << value << "\n";
│ │ │ │ +
119}
│ │ │ │ +
│ │ │ │ +
120
│ │ │ │ +
121template<int side, typename Glue>
│ │ │ │ +
│ │ │ │ +
122void write_glue_area_vtk(const Glue& glue, const std::string& filename)
│ │ │ │ +
123{
│ │ │ │ +
124 std::ofstream out(filename.c_str());
│ │ │ │ +
125 write_glue_area_vtk<side>(glue, out);
│ │ │ │ +
126}
│ │ │ │ +
│ │ │ │ +
127
│ │ │ │ +
128template<typename Glue>
│ │ │ │ +
│ │ │ │ +
129void write_glue_areas_vtk(const Glue& glue, const std::string& base)
│ │ │ │ +
130{
│ │ │ │ +
131 {
│ │ │ │ +
132 std::string filename = base;
│ │ │ │ +
133 filename += "-inside.vtk";
│ │ │ │ +
134 write_glue_area_vtk<0>(glue, filename);
│ │ │ │ +
135 }
│ │ │ │ +
136 {
│ │ │ │ +
137 std::string filename = base;
│ │ │ │ +
138 filename += "-outside.vtk";
│ │ │ │ +
139 write_glue_area_vtk<1>(glue, filename);
│ │ │ │ +
140 }
│ │ │ │ +
141}
│ │ │ │ +
│ │ │ │ +
142
│ │ │ │ +
143} /* namespace GridGlue */
│ │ │ │ +
144} /* namespace Dune */
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
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
│ │ │ │ -
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
│ │ │ │ +
void write_glue_area_vtk(const Glue &glue, std::ostream &out)
Definition areawriter_impl.hh:84
│ │ │ │ +
void write_glue_areas_vtk(const Glue &glue, const std::string &base)
Definition areawriter_impl.hh:129
│ │ │ │ +
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ +
void write_facet_geometry(const GridView &gv, std::ostream &out)
Definition areawriter_impl.hh:25
│ │ │ │ +
Definition rangegenerators.hh:17
│ │ │ │ + │ │ │ │ +
bool contains(Dune::GeometryType gt) const
Definition areawriter_impl.hh:18
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,62 +1,184 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -projectionwriter.hh │ │ │ │ │ +areawriter_impl.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH │ │ │ │ │ +3#include │ │ │ │ │ +4#include │ │ │ │ │ 5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8 │ │ │ │ │ -9#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_c_o_m_m_o_n_/_p_r_o_j_e_c_t_i_o_n_._h_h> │ │ │ │ │ -10 │ │ │ │ │ -11namespace _D_u_n_e { │ │ │ │ │ -12namespace GridGlue { │ │ │ │ │ -13 │ │ │ │ │ -28template │ │ │ │ │ -29void _w_r_i_t_e(const Projection& projection, │ │ │ │ │ -30 const Corners& corners, │ │ │ │ │ -31 const Normals& normals, │ │ │ │ │ -32 std::ostream& out); │ │ │ │ │ -33 │ │ │ │ │ -40template │ │ │ │ │ -41void _w_r_i_t_e(const Projection& projection, │ │ │ │ │ -42 const Corners& corners, │ │ │ │ │ -43 const Normals& normals, │ │ │ │ │ -44 const std::string& filename); │ │ │ │ │ -54template │ │ │ │ │ -55void _p_r_i_n_t(const Projection& projection, │ │ │ │ │ -56 const Corners& corners, │ │ │ │ │ -57 const Normals& normals); │ │ │ │ │ -58 │ │ │ │ │ -59} /* namespace GridGlue */ │ │ │ │ │ -60} /* namespace Dune */ │ │ │ │ │ -61 │ │ │ │ │ -62#include "_p_r_o_j_e_c_t_i_o_n_w_r_i_t_e_r___i_m_p_l_._h_h" │ │ │ │ │ -63 │ │ │ │ │ -64#endif │ │ │ │ │ -_p_r_o_j_e_c_t_i_o_n_._h_h │ │ │ │ │ -_p_r_o_j_e_c_t_i_o_n_w_r_i_t_e_r___i_m_p_l_._h_h │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8#include │ │ │ │ │ +9 │ │ │ │ │ +10namespace _D_u_n_e { │ │ │ │ │ +11namespace GridGlue { │ │ │ │ │ +12 │ │ │ │ │ +_1_3namespace AreaWriterImplementation { │ │ │ │ │ +14 │ │ │ │ │ +15template │ │ │ │ │ +_1_6struct _F_a_c_e_t_L_a_y_o_u_t │ │ │ │ │ +17{ │ │ │ │ │ +_1_8 bool _c_o_n_t_a_i_n_s(Dune::GeometryType gt) const │ │ │ │ │ +19 { │ │ │ │ │ +20 return gt.dim() == dimgrid - 1; │ │ │ │ │ +21 } │ │ │ │ │ +22}; │ │ │ │ │ +23 │ │ │ │ │ +24template │ │ │ │ │ +_2_5void _w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y(const GridView& gv, std::ostream& out) │ │ │ │ │ +26{ │ │ │ │ │ +27 using Coordinate = Dune::FieldVector; │ │ │ │ │ +28 │ │ │ │ │ +29 std::vector corners; │ │ │ │ │ +30 for (const auto& facet : facets(gv)) { │ │ │ │ │ +31 const auto geometry = facet.geometry(); │ │ │ │ │ +32 for (int i = 0; i < geometry.corners(); ++i) { │ │ │ │ │ +33 /* VTK always needs 3-dim coordinates... */ │ │ │ │ │ +34 const auto c0 = geometry.corner(i); │ │ │ │ │ +35 Coordinate c1; │ │ │ │ │ +36 for (int d = 0; d < GridView::dimensionworld; ++d) │ │ │ │ │ +37 c1[d] = c0[d]; │ │ │ │ │ +38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d) │ │ │ │ │ +39 c1[d] = double(0); │ │ │ │ │ +40 corners.push_back(c1); │ │ │ │ │ +41 } │ │ │ │ │ +42 } │ │ │ │ │ +43 │ │ │ │ │ +44 { │ │ │ │ │ +45 out << "DATASET UNSTRUCTURED_GRID\n" │ │ │ │ │ +46 << "POINTS " << corners.size() << " double\n"; │ │ │ │ │ +47 for (const auto& c : corners) │ │ │ │ │ +48 out << c << "\n"; │ │ │ │ │ +49 } │ │ │ │ │ +50 { │ │ │ │ │ +51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << │ │ │ │ │ +"\n"; │ │ │ │ │ +52 std::size_t c = 0; │ │ │ │ │ +53 for (const auto& facet : facets(gv)) { │ │ │ │ │ +54 const auto geometry = facet.geometry(); │ │ │ │ │ +55 out << geometry.corners(); │ │ │ │ │ +56 for (int i = 0; i < geometry.corners(); ++i, ++c) │ │ │ │ │ +57 out << " " << c; │ │ │ │ │ +58 out << "\n"; │ │ │ │ │ +59 } │ │ │ │ │ +60 } │ │ │ │ │ +61 { │ │ │ │ │ +62 out << "CELL_TYPES " << gv.size(1) << "\n"; │ │ │ │ │ +63 for (const auto& facet : facets(gv)) { │ │ │ │ │ +64 const auto type = facet.type(); │ │ │ │ │ +65 if (type.isVertex()) │ │ │ │ │ +66 out << "1\n"; │ │ │ │ │ +67 else if (type.isLine()) │ │ │ │ │ +68 out << "2\n"; │ │ │ │ │ +69 else if (type.isTriangle()) │ │ │ │ │ +70 out << "5\n"; │ │ │ │ │ +71 else if (type.isQuadrilateral()) │ │ │ │ │ +72 out << "9\n"; │ │ │ │ │ +73 else if (type.isTetrahedron()) │ │ │ │ │ +74 out << "10\n"; │ │ │ │ │ +75 else │ │ │ │ │ +76 DUNE_THROW(Dune::Exception, "Unhandled geometry type"); │ │ │ │ │ +77 } │ │ │ │ │ +78 } │ │ │ │ │ +79} │ │ │ │ │ +80 │ │ │ │ │ +81} /* namespace AreaWriterImplementation */ │ │ │ │ │ +82 │ │ │ │ │ +83template │ │ │ │ │ +_8_4void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, std::ostream& out) │ │ │ │ │ +85{ │ │ │ │ │ +86 using GridView = typename std::decay< decltype(glue.template gridView │ │ │ │ │ +()) >::type; │ │ │ │ │ +87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper; │ │ │ │ │ +88 using ctype = typename GridView::ctype; │ │ │ │ │ +89 │ │ │ │ │ +90 const GridView gv = glue.template gridView(); │ │ │ │ │ +91 Mapper mapper(gv); │ │ │ │ │ +92 std::vector coveredArea(mapper.size(), ctype(0)); │ │ │ │ │ +93 std::vector totalArea(mapper.size(), ctype(1)); │ │ │ │ │ +94 │ │ │ │ │ +95 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(glue, _R_e_v_e_r_s_e_<_s_i_d_e_ _=_=_ _1_>())) { │ │ │ │ │ +96 const auto element = in.inside(); │ │ │ │ │ +97 const auto index = mapper.subIndex(element, in.indexInInside(), 1); │ │ │ │ │ +98 coveredArea[index] += in.geometryInInside().volume(); │ │ │ │ │ +99 │ │ │ │ │ +100 const auto& refElement = Dune::ReferenceElements::general(element.type()); │ │ │ │ │ +101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside │ │ │ │ │ +()); │ │ │ │ │ +102 totalArea[index] = subGeometry.volume(); │ │ │ │ │ +103 } │ │ │ │ │ +104 │ │ │ │ │ +105 for (std::size_t i = 0; i < coveredArea.size(); ++i) │ │ │ │ │ +106 coveredArea[i] /= totalArea[i]; │ │ │ │ │ +107 │ │ │ │ │ +108 out << "# vtk DataFile Version 2.0\n" │ │ │ │ │ +109 << "Filename: Glue Area\n" │ │ │ │ │ +110 << "ASCII\n"; │ │ │ │ │ +111 │ │ │ │ │ +112 _A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y(gv, out); │ │ │ │ │ +113 │ │ │ │ │ +114 out << "CELL_DATA " << coveredArea.size() << "\n" │ │ │ │ │ +115 << "SCALARS CoveredArea double 1\n" │ │ │ │ │ +116 << "LOOKUP_TABLE default\n"; │ │ │ │ │ +117 for (const auto& value : coveredArea) │ │ │ │ │ +118 out << value << "\n"; │ │ │ │ │ +119} │ │ │ │ │ +120 │ │ │ │ │ +121template │ │ │ │ │ +_1_2_2void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, const std::string& filename) │ │ │ │ │ +123{ │ │ │ │ │ +124 std::ofstream out(filename.c_str()); │ │ │ │ │ +125 write_glue_area_vtk(glue, out); │ │ │ │ │ +126} │ │ │ │ │ +127 │ │ │ │ │ +128template │ │ │ │ │ +_1_2_9void _w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k(const Glue& glue, const std::string& base) │ │ │ │ │ +130{ │ │ │ │ │ +131 { │ │ │ │ │ +132 std::string filename = base; │ │ │ │ │ +133 filename += "-inside.vtk"; │ │ │ │ │ +134 write_glue_area_vtk<0>(glue, filename); │ │ │ │ │ +135 } │ │ │ │ │ +136 { │ │ │ │ │ +137 std::string filename = base; │ │ │ │ │ +138 filename += "-outside.vtk"; │ │ │ │ │ +139 write_glue_area_vtk<1>(glue, filename); │ │ │ │ │ +140 } │ │ │ │ │ +141} │ │ │ │ │ +142 │ │ │ │ │ +143} /* namespace GridGlue */ │ │ │ │ │ +144} /* namespace Dune */ │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e │ │ │ │ │ -void write(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ │ -const Normals &normals, std::ostream &out) │ │ │ │ │ -write projection in VTK format │ │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:86 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t │ │ │ │ │ -void print(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ │ -const Normals &normals) │ │ │ │ │ -Print information about the projection to std::cout stream. │ │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k │ │ │ │ │ +void write_glue_area_vtk(const Glue &glue, std::ostream &out) │ │ │ │ │ +DDeeffiinniittiioonn areawriter_impl.hh:84 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k │ │ │ │ │ +void write_glue_areas_vtk(const Glue &glue, const std::string &base) │ │ │ │ │ +DDeeffiinniittiioonn areawriter_impl.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ +> &reverse=!reversed) │ │ │ │ │ +Iterate over all intersections of a GridGlue. │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y │ │ │ │ │ +void write_facet_geometry(const GridView &gv, std::ostream &out) │ │ │ │ │ +DDeeffiinniittiioonn areawriter_impl.hh:25 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_R_e_v_e_r_s_e │ │ │ │ │ +DDeeffiinniittiioonn rangegenerators.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_F_a_c_e_t_L_a_y_o_u_t │ │ │ │ │ +DDeeffiinniittiioonn areawriter_impl.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_F_a_c_e_t_L_a_y_o_u_t_:_:_c_o_n_t_a_i_n_s │ │ │ │ │ +bool contains(Dune::GeometryType gt) const │ │ │ │ │ +DDeeffiinniittiioonn areawriter_impl.hh:18 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: ringcomm.hh File Reference │ │ │ │ +dune-grid-glue: projection_impl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,77 +71,49 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ Functions
│ │ │ │ -
ringcomm.hh File Reference
│ │ │ │ +
projection_impl.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <mpi.h>
│ │ │ │ -#include <functional>
│ │ │ │ -#include <utility>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/hybridutilities.hh>
│ │ │ │ -#include <dune/geometry/type.hh>
│ │ │ │ +
#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <cmath>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Parallel
namespace  Dune::GridGlue
 
namespace  Dune::GridGlue::ProjectionImplementation
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │

│ │ │ │ -Macros

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

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

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ CheckMPIStatus

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define CheckMPIStatus( A,
 
)   {}
│ │ │ │ -
│ │ │ │ -
Todo:
Implement MPI Status check with exception handling
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,39 +1,44 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -_N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -ringcomm.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +projection_impl.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ -namespace   _D_u_n_e_:_:_P_a_r_a_l_l_e_l │ │ │ │ │ +namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ -MMaaccrrooss │ │ │ │ │ -#define  _C_h_e_c_k_M_P_I_S_t_a_t_u_s(A, B)   {} │ │ │ │ │ +namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_P_a_r_a_l_l_e_l_:_:_M_P_I___A_l_l_A_p_p_l_y (MPI_Comm mpicomm, OP &&op, const Args &... │ │ │ │ │ - data) │ │ │ │ │ -  apply an operator locally to a difstributed data set │ │ │ │ │ -  │ │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ -********** _?◆_? CChheecckkMMPPIISSttaattuuss ********** │ │ │ │ │ -#define CheckMPIStatus (   A, │ │ │ │ │ -   B  │ │ │ │ │ - )    {} │ │ │ │ │ - _TT_oo_dd_oo_:: │ │ │ │ │ - Implement MPI Status check with exception handling │ │ │ │ │ +template │ │ │ │ │ + Coordinate  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ │ + _c_o_r_n_e_r (unsigned c) │ │ │ │ │ +  │ │ │ │ │ +std::pair< unsigned, unsigned >  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ │ + _e_d_g_e_T_o_C_o_r_n_e_r_s (unsigned edge) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + Corners::value_type  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ │ + _i_n_t_e_r_p_o_l_a_t_e (const Coordinate &x, const │ │ │ │ │ + Corners &corners) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + Normals::value_type  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ │ + _i_n_t_e_r_p_o_l_a_t_e___u_n_i_t___n_o_r_m_a_l_s (const Coordinate &x, │ │ │ │ │ + const Normals &normals) │ │ │ │ │ +  │ │ │ │ │ +template │ │ │ │ │ + bool  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ │ + _i_n_s_i_d_e (const Coordinate &x, const Field │ │ │ │ │ + &epsilon) │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: ringcomm.hh Source File │ │ │ │ +dune-grid-glue: projection_impl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,309 +74,464 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
ringcomm.hh
│ │ │ │ +
projection_impl.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │ -
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │ -
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ -
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
5/* IMPLEMENTATION OF CLASS G R I D G L U E */
│ │ │ │ +Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ +
3#include <dune/common/fmatrix.hh>
│ │ │ │ +
4
│ │ │ │ +
5#include <cmath>
│ │ │ │
6
│ │ │ │ -
8#define CheckMPIStatus(A,B) {}
│ │ │ │ +
7namespace Dune {
│ │ │ │ +
8namespace GridGlue {
│ │ │ │
9
│ │ │ │ -
10#include <mpi.h>
│ │ │ │ -
11#include <functional>
│ │ │ │ -
12#include <utility>
│ │ │ │ -
13
│ │ │ │ -
14#include <dune/common/fvector.hh>
│ │ │ │ -
15#include <dune/common/hybridutilities.hh>
│ │ │ │ -
16
│ │ │ │ -
17#include <dune/geometry/type.hh>
│ │ │ │ -
18
│ │ │ │ -
19namespace Dune {
│ │ │ │ -
│ │ │ │ -
20namespace Parallel {
│ │ │ │ -
21
│ │ │ │ -
22 namespace Impl {
│ │ │ │ -
23
│ │ │ │ -
25 template<typename T>
│ │ │ │ -
26 struct MPITypeInfo {};
│ │ │ │ -
27
│ │ │ │ -
28 template<>
│ │ │ │ -
29 struct MPITypeInfo< int >
│ │ │ │ -
30 {
│ │ │ │ -
31 static const unsigned int size = 1;
│ │ │ │ -
32 static inline MPI_Datatype getType()
│ │ │ │ -
33 {
│ │ │ │ -
34 return MPI_INT;
│ │ │ │ -
35 }
│ │ │ │ -
36 };
│ │ │ │ -
37
│ │ │ │ -
38 template<typename K, int N>
│ │ │ │ -
39 struct MPITypeInfo< Dune::FieldVector<K,N> >
│ │ │ │ -
40 {
│ │ │ │ -
41 static const unsigned int size = N;
│ │ │ │ -
42 static inline MPI_Datatype getType()
│ │ │ │ -
43 {
│ │ │ │ -
44 return Dune::MPITraits<K>::getType();
│ │ │ │ -
45 }
│ │ │ │ -
46 };
│ │ │ │ -
47
│ │ │ │ -
48 template<>
│ │ │ │ -
49 struct MPITypeInfo< unsigned int >
│ │ │ │ -
50 {
│ │ │ │ -
51 static const unsigned int size = 1;
│ │ │ │ -
52 static inline MPI_Datatype getType()
│ │ │ │ -
53 {
│ │ │ │ -
54 return MPI_UNSIGNED;
│ │ │ │ -
55 }
│ │ │ │ -
56 };
│ │ │ │ -
57
│ │ │ │ -
58 template<>
│ │ │ │ -
59 struct MPITypeInfo< Dune::GeometryType >
│ │ │ │ -
60 {
│ │ │ │ -
61 static const unsigned int size = 1;
│ │ │ │ -
62 static inline MPI_Datatype getType()
│ │ │ │ -
63 {
│ │ │ │ -
64 return Dune::MPITraits< Dune::GeometryType >::getType();
│ │ │ │ -
65 }
│ │ │ │ -
66 };
│ │ │ │ -
67
│ │ │ │ -
68 template<typename T>
│ │ │ │ -
69 void MPI_SetVectorSize(
│ │ │ │ -
70 std::vector<T> & data,
│ │ │ │ -
71 MPI_Status & status)
│ │ │ │ -
72 {
│ │ │ │ -
73 typedef MPITypeInfo<T> Info;
│ │ │ │ -
74 int sz;
│ │ │ │ -
75 MPI_Get_count(&status, Info::getType(), &sz);
│ │ │ │ -
76 assert(sz%Info::size == 0);
│ │ │ │ -
77 data.resize(sz/Info::size);
│ │ │ │ -
78 }
│ │ │ │ -
79
│ │ │ │ -
89 template<typename T>
│ │ │ │ -
90 void MPI_SendVectorInRing(
│ │ │ │ -
91 std::vector<T> & data,
│ │ │ │ -
92 std::vector<T> & next,
│ │ │ │ -
93 int tag,
│ │ │ │ -
94 int rightrank,
│ │ │ │ -
95 int leftrank,
│ │ │ │ -
96 MPI_Comm comm,
│ │ │ │ -
97 MPI_Request& r_send,
│ │ │ │ -
98 MPI_Request& r_recv
│ │ │ │ -
99 )
│ │ │ │ -
100 {
│ │ │ │ -
101 // mpi status stuff
│ │ │ │ -
102 [[maybe_unused]] int result = 0;
│ │ │ │ -
103 typedef MPITypeInfo<T> Info;
│ │ │ │ -
104 // resize next buffer to maximum size
│ │ │ │ -
105 next.resize(next.capacity());
│ │ │ │ -
106 // send data (explicitly send data.size elements)
│ │ │ │ -
107 result =
│ │ │ │ -
108 MPI_Isend(
│ │ │ │ -
109 &(data[0]), Info::size*data.size(), Info::getType(), rightrank, tag,
│ │ │ │ -
110 comm, &r_send);
│ │ │ │ -
111 // receive up to maximum size. The acutal size is stored in the status
│ │ │ │ -
112 result =
│ │ │ │ -
113 MPI_Irecv(
│ │ │ │ -
114 &(next[0]), Info::size*next.size(), Info::getType(), leftrank, tag,
│ │ │ │ -
115 comm, &r_recv);
│ │ │ │ -
116 // // check result
│ │ │ │ -
117 // MPI_Status status;
│ │ │ │ -
118 // CheckMPIStatus(result, status);
│ │ │ │ -
119 }
│ │ │ │ -
120
│ │ │ │ -
121 template<typename T>
│ │ │ │ -
122 using ptr_t = T*;
│ │ │ │ -
123
│ │ │ │ -
124 /* these helper structs are needed as long as we still support
│ │ │ │ -
125 C++11, as we can't use variadic lambdas */
│ │ │ │ -
126 template<typename... Args>
│ │ │ │ -
127 struct call_MPI_SendVectorInRing
│ │ │ │ -
128 {
│ │ │ │ -
129 std::tuple<Args...> & remotedata;
│ │ │ │ -
130 std::tuple<Args...> & nextdata;
│ │ │ │ -
131 int & tag;
│ │ │ │ -
132 int & rightrank;
│ │ │ │ -
133 int & leftrank;
│ │ │ │ -
134 MPI_Comm & mpicomm;
│ │ │ │ -
135 std::array<MPI_Request,sizeof...(Args)> & requests_send;
│ │ │ │ -
136 std::array<MPI_Request,sizeof...(Args)> & requests_recv;
│ │ │ │ -
137
│ │ │ │ -
138 template<typename I>
│ │ │ │ -
139 void operator()(I i)
│ │ │ │ -
140 {
│ │ │ │ -
141 MPI_SendVectorInRing(
│ │ │ │ -
142 std::get<i>(remotedata),
│ │ │ │ -
143 std::get<i>(nextdata),
│ │ │ │ -
144 tag+i,
│ │ │ │ -
145 rightrank, leftrank, mpicomm,
│ │ │ │ -
146 requests_send[i],
│ │ │ │ -
147 requests_recv[i]);
│ │ │ │ -
148 }
│ │ │ │ -
149 };
│ │ │ │ -
150 template<typename... Args>
│ │ │ │ -
151 struct call_MPI_SetVectorSize
│ │ │ │ -
152 {
│ │ │ │ -
153 std::tuple<Args...> & nextdata;
│ │ │ │ -
154 std::array<MPI_Status,sizeof...(Args)> & status_recv;
│ │ │ │ -
155
│ │ │ │ -
156 template<typename I>
│ │ │ │ -
157 void operator()(I i)
│ │ │ │ -
158 {
│ │ │ │ -
159 MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
│ │ │ │ -
160 }
│ │ │ │ -
161 };
│ │ │ │ -
162
│ │ │ │ -
163 template<typename OP, std::size_t... Indices, typename... Args>
│ │ │ │ -
164 void MPI_AllApply_impl(MPI_Comm mpicomm,
│ │ │ │ -
165 OP && op,
│ │ │ │ -
166 std::index_sequence<Indices...> indices,
│ │ │ │ -
167 const Args&... data)
│ │ │ │ -
168 {
│ │ │ │ -
169 constexpr std::size_t N = sizeof...(Args);
│ │ │ │ -
170 int myrank = 0;
│ │ │ │ -
171 int commsize = 0;
│ │ │ │ -
172#if HAVE_MPI
│ │ │ │ -
173 MPI_Comm_rank(mpicomm, &myrank);
│ │ │ │ -
174 MPI_Comm_size(mpicomm, &commsize);
│ │ │ │ -
175#endif // HAVE_MPI
│ │ │ │ -
176
│ │ │ │ -
177 if (commsize > 1)
│ │ │ │ -
178 {
│ │ │ │ -
179#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
│ │ │ │ -
180 std::cout << myrank << " Start Communication, size " << commsize << std::endl;
│ │ │ │ -
181#endif
│ │ │ │ -
182
│ │ │ │ -
183 // get data sizes
│ │ │ │ -
184 std::array<unsigned int, N> size({ ((unsigned int)data.size())... });
│ │ │ │ -
185
│ │ │ │ -
186 // communicate max data size
│ │ │ │ -
187 std::array<unsigned int, N> maxSize;
│ │ │ │ -
188 MPI_Allreduce(&size, &maxSize,
│ │ │ │ -
189 size.size(), MPI_UNSIGNED, MPI_MAX, mpicomm);
│ │ │ │ -
190#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
│ │ │ │ -
191 std::cout << myrank << " maxSize " << "done... " << std::endl;
│ │ │ │ -
192#endif
│ │ │ │ -
193
│ │ │ │ -
194 // allocate receiving buffers with maxsize to ensure sufficient buffer size for communication
│ │ │ │ -
195 std::tuple<Args...> remotedata { Args(maxSize[Indices])... };
│ │ │ │ -
196
│ │ │ │ -
197 // copy local data to receiving buffer
│ │ │ │ -
198 remotedata = std::tie(data...);
│ │ │ │ -
199
│ │ │ │ -
200 // allocate second set of receiving buffers necessary for async communication
│ │ │ │ -
201 std::tuple<Args...> nextdata { Args(maxSize[Indices])... };
│ │ │ │ +
│ │ │ │ +
10namespace ProjectionImplementation {
│ │ │ │ +
11
│ │ │ │ +
22template<typename Coordinate, typename Field>
│ │ │ │ +
23inline Coordinate
│ │ │ │ +
│ │ │ │ +
24corner(unsigned c)
│ │ │ │ +
25{
│ │ │ │ +
26 Coordinate x(Field(0));
│ │ │ │ +
27 if (c == 0)
│ │ │ │ +
28 return x;
│ │ │ │ +
29 x[c-1] = Field(1);
│ │ │ │ +
30 return x;
│ │ │ │ +
31}
│ │ │ │ +
│ │ │ │ +
32
│ │ │ │ +
42inline std::pair<unsigned, unsigned>
│ │ │ │ +
│ │ │ │ +
43edgeToCorners(unsigned edge)
│ │ │ │ +
44{
│ │ │ │ +
45 switch(edge) {
│ │ │ │ +
46 case 0: return {0, 1};
│ │ │ │ +
47 case 1: return {0, 2};
│ │ │ │ +
48 case 2: return {1, 2};
│ │ │ │ +
49 }
│ │ │ │ +
50 DUNE_THROW(Dune::Exception, "Unexpected edge number.");
│ │ │ │ +
51}
│ │ │ │ +
│ │ │ │ +
52
│ │ │ │ +
68template<typename Coordinate, typename Corners>
│ │ │ │ +
69inline typename Corners::value_type
│ │ │ │ +
│ │ │ │ +
70interpolate(const Coordinate& x, const Corners& corners)
│ │ │ │ +
71{
│ │ │ │ +
72 auto y = corners[0];
│ │ │ │ +
73 for (unsigned i = 0; i < corners.size() - 1; ++i)
│ │ │ │ +
74 y.axpy(x[i], corners[i+1] - corners[0]);
│ │ │ │ +
75 return y;
│ │ │ │ +
76}
│ │ │ │ +
│ │ │ │ +
77
│ │ │ │ +
89template<typename Coordinate, typename Normals>
│ │ │ │ +
90inline typename Normals::value_type
│ │ │ │ +
│ │ │ │ +
91interpolate_unit_normals(const Coordinate& x, const Normals& normals)
│ │ │ │ +
92{
│ │ │ │ +
93 auto n = interpolate(x, normals);
│ │ │ │ +
94 n /= n.two_norm();
│ │ │ │ +
95 return n;
│ │ │ │ +
96}
│ │ │ │ +
│ │ │ │ +
97
│ │ │ │ +
109template<typename Coordinate, typename Field>
│ │ │ │ +
110inline bool
│ │ │ │ +
│ │ │ │ +
111inside(const Coordinate& x, const Field& epsilon)
│ │ │ │ +
112{
│ │ │ │ +
113 const unsigned dim = Coordinate::dimension;
│ │ │ │ +
114 Field sum(0);
│ │ │ │ +
115 for (unsigned i = 0; i < dim-1; ++i) {
│ │ │ │ +
116 if (x[i] < -epsilon)
│ │ │ │ +
117 return false;
│ │ │ │ +
118 sum += x[i];
│ │ │ │ +
119 }
│ │ │ │ +
120 /* If any xᵢ is NaN, sum will be NaN and this comparison false! */
│ │ │ │ +
121 if (sum <= Field(1) + epsilon)
│ │ │ │ +
122 return true;
│ │ │ │ +
123 return false;
│ │ │ │ +
124}
│ │ │ │ +
│ │ │ │ +
125
│ │ │ │ +
126} /* namespace ProjectionImplementation */
│ │ │ │ +
│ │ │ │ +
127
│ │ │ │ +
128template<typename Coordinate>
│ │ │ │ +
129Projection<Coordinate>
│ │ │ │ +
│ │ │ │ +
130::Projection(const Field overlap, const Field max_normal_product)
│ │ │ │ +
131 : m_overlap(overlap)
│ │ │ │ +
132 , m_max_normal_product(max_normal_product)
│ │ │ │ +
133{
│ │ │ │ +
134 /* Nothing. */
│ │ │ │ +
135}
│ │ │ │ +
│ │ │ │ +
136
│ │ │ │ +
137template<typename Coordinate>
│ │ │ │ +
138void
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
140::epsilon(const Field epsilon)
│ │ │ │ +
141{
│ │ │ │ +
142 m_epsilon = epsilon;
│ │ │ │ +
143}
│ │ │ │ +
│ │ │ │ +
144
│ │ │ │ +
145template<typename Coordinate>
│ │ │ │ +
146template<typename Corners, typename Normals>
│ │ │ │ +
147void
│ │ │ │ + │ │ │ │ +
149::doProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
│ │ │ │ +
150{
│ │ │ │ +
151 /* Try to obtain Φ(xᵢ) for each corner xᵢ of the preimage triangle.
│ │ │ │ +
152 * This means solving a linear system of equations
│ │ │ │ +
153 * Φ(xᵢ) = (1-α-β) y₀ + α y₁ + β y₂ = xᵢ + δ nᵢ
│ │ │ │ +
154 * or α (y₁ - y₀) + β (y₂ - y₀) - δ nᵢ = xᵢ - y₀
│ │ │ │ +
155 * to obtain the barycentric coordinates (α, β) of Φ(xᵢ) in the image
│ │ │ │ +
156 * triangle and the distance δ.
│ │ │ │ +
157 *
│ │ │ │ +
158 * In the matrix m corresponding to the system, only the third column and the
│ │ │ │ +
159 * right-hand side depend on i. The first two columns can be assembled before
│ │ │ │ +
160 * and reused.
│ │ │ │ +
161 */
│ │ │ │ +
162 using namespace ProjectionImplementation;
│ │ │ │ +
163 using std::get;
│ │ │ │ +
164 typedef Dune::FieldMatrix<Field, dim, dim> Matrix;
│ │ │ │ +
165 Matrix m;
│ │ │ │ +
166
│ │ │ │ +
167 const auto& origin = get<0>(corners);
│ │ │ │ +
168 const auto& origin_normals = get<0>(normals);
│ │ │ │ +
169 const auto& target = get<1>(corners);
│ │ │ │ +
170 const auto& target_normals = get<1>(normals);
│ │ │ │ +
171 auto& images = get<0>(m_images);
│ │ │ │ +
172 auto& success = get<0>(m_success);
│ │ │ │ +
173
│ │ │ │ +
174 /* directionsᵢ = (yᵢ - y₀) / ||yᵢ - y₀||
│ │ │ │ +
175 * These are the first to columns of the system matrix; the rescaling is done
│ │ │ │ +
176 * to ensure all columns have a comparable norm (the last has the normal with norm 1.
│ │ │ │ +
177 */
│ │ │ │ +
178 std::array<Coordinate, dim-1> directions;
│ │ │ │ +
179 std::array<Field, dim-1> scales;
│ │ │ │ +
180 /* estimator for the diameter of the target face */
│ │ │ │ +
181 Field scaleSum(0);
│ │ │ │ +
182 for (unsigned i = 0; i < dim-1; ++i) {
│ │ │ │ +
183 directions[i] = target[i+1] - target[0];
│ │ │ │ +
184 scales[i] = directions[i].infinity_norm();
│ │ │ │ +
185 directions[i] /= scales[i];
│ │ │ │ +
186 scaleSum += scales[i];
│ │ │ │ +
187 }
│ │ │ │ +
188
│ │ │ │ +
189 for (unsigned i = 0; i < dim-1; ++i) {
│ │ │ │ +
190 for (unsigned j = 0; j < dim; ++j) {
│ │ │ │ +
191 m[j][i] = directions[i][j];
│ │ │ │ +
192 }
│ │ │ │ +
193 }
│ │ │ │ +
194
│ │ │ │ +
195 m_projection_valid = true;
│ │ │ │ +
196 success.reset();
│ │ │ │ +
197
│ │ │ │ +
198 /* Now project xᵢ for each i */
│ │ │ │ +
199 for (unsigned i = 0; i < origin.size(); ++i) {
│ │ │ │ +
200 for (unsigned j = 0; j < dim; ++j)
│ │ │ │ +
201 m[j][dim-1] = origin_normals[i][j];
│ │ │ │
202
│ │ │ │ -
203 // communicate data in the ring
│ │ │ │ -
204 int rightrank = (myrank + 1 + commsize) % commsize;
│ │ │ │ -
205 int leftrank = (myrank - 1 + commsize) % commsize;
│ │ │ │ -
206
│ │ │ │ -
207 std::cout << myrank << ": size = " << commsize << std::endl;
│ │ │ │ -
208 std::cout << myrank << ": left = " << leftrank
│ │ │ │ -
209 << " right = " << rightrank << std::endl;
│ │ │ │ -
210
│ │ │ │ -
211 // currently the remote data is our own data
│ │ │ │ -
212 int remoterank = myrank;
│ │ │ │ +
203 const Coordinate rhs = origin[i] - target[0];
│ │ │ │ +
204
│ │ │ │ +
205 try {
│ │ │ │ +
206 /* y = (α, β, δ) */
│ │ │ │ +
207 auto& y = images[i];
│ │ │ │ +
208 m.solve(y, rhs);
│ │ │ │ +
209 for (unsigned j = 0; j < dim-1; ++j)
│ │ │ │ +
210 y[j] /= scales[j];
│ │ │ │ +
211 /* Solving gave us -δ as the term is "-δ nᵢ". */
│ │ │ │ +
212 y[dim-1] *= Field(-1);
│ │ │ │
213
│ │ │ │ -
214 for (int i=1; i<commsize; i++)
│ │ │ │ -
215 {
│ │ │ │ -
216 // in this iteration we will receive data from nextrank
│ │ │ │ -
217 int nextrank = (myrank - i + commsize) % commsize;
│ │ │ │ -
218
│ │ │ │ -
219 std::cout << myrank << ": next = " << nextrank << std::endl;
│ │ │ │ -
220
│ │ │ │ -
221 // send remote data to right neighbor and receive from left neighbor
│ │ │ │ -
222 std::array<MPI_Request,N> requests_send;
│ │ │ │ -
223 std::array<MPI_Request,N> requests_recv;
│ │ │ │ -
224
│ │ │ │ -
225 int tag = 0;
│ │ │ │ -
226 Dune::Hybrid::forEach(indices,
│ │ │ │ -
227 // [&](auto i){
│ │ │ │ -
228 // MPI_SendVectorInRing(
│ │ │ │ -
229 // std::get<i>(remotedata),
│ │ │ │ -
230 // std::get<i>(nextdata),
│ │ │ │ -
231 // tag+i,
│ │ │ │ -
232 // rightrank, leftrank, mpicomm,
│ │ │ │ -
233 // requests_send[i],
│ │ │ │ -
234 // requests_recv[i]);
│ │ │ │ -
235 // });
│ │ │ │ -
236 call_MPI_SendVectorInRing<Args...>({
│ │ │ │ -
237 remotedata,
│ │ │ │ -
238 nextdata,
│ │ │ │ -
239 tag,
│ │ │ │ -
240 rightrank, leftrank, mpicomm,
│ │ │ │ -
241 requests_send,
│ │ │ │ -
242 requests_recv
│ │ │ │ -
243 }));
│ │ │ │ -
244
│ │ │ │ -
245 // apply operator
│ │ │ │ -
246 op(remoterank,std::get<Indices>(remotedata)...);
│ │ │ │ -
247
│ │ │ │ -
248 // wait for communication to finalize
│ │ │ │ -
249 std::array<MPI_Status,N> status_send;
│ │ │ │ -
250 std::array<MPI_Status,N> status_recv;
│ │ │ │ -
251 MPI_Waitall(N,&requests_recv[0],&status_recv[0]);
│ │ │ │ +
214 /* If the forward projection is too far in the wrong direction
│ │ │ │ +
215 * then this might result in artificial inverse projections or
│ │ │ │ +
216 * edge intersections. To prevent these wrong cases but not
│ │ │ │ +
217 * dismiss feasible intersections, the projection is dismissed
│ │ │ │ +
218 * if the forward projection is further than two times the
│ │ │ │ +
219 * approximate diameter of the image triangle.
│ │ │ │ +
220 */
│ │ │ │ +
221 if(y[dim-1] < -2*scaleSum) {
│ │ │ │ +
222 success.set(i,false);
│ │ │ │ +
223 m_projection_valid = false;
│ │ │ │ +
224 return;
│ │ │ │ +
225 }
│ │ │ │ +
226
│ │ │ │ +
227 const bool feasible = projectionFeasible(origin[i], origin_normals[i], y, target, target_normals);
│ │ │ │ +
228 success.set(i, feasible);
│ │ │ │ +
229 }
│ │ │ │ +
230 catch (const Dune::FMatrixError&) {
│ │ │ │ +
231 success.set(i, false);
│ │ │ │ +
232 m_projection_valid = false;
│ │ │ │ +
233 }
│ │ │ │ +
234 }
│ │ │ │ +
235}
│ │ │ │ +
236
│ │ │ │ +
237template<typename Coordinate>
│ │ │ │ +
238template<typename Corners, typename Normals>
│ │ │ │ +
239void
│ │ │ │ +
240Projection<Coordinate>
│ │ │ │ +
241::doInverseProjection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
│ │ │ │ +
242{
│ │ │ │ +
243 /* Try to obtain Φ⁻¹(yᵢ) for each corner yᵢ of the image triangle.
│ │ │ │ +
244 * Instead of solving the problem directly (which would lead to
│ │ │ │ +
245 * non-linear equations), we make use of the forward projection Φ
│ │ │ │ +
246 * which projects the preimage triangle on the plane spanned by the
│ │ │ │ +
247 * image triangle. The inverse projection is then given by finding
│ │ │ │ +
248 * the barycentric coordinates of yᵢ with respect to the triangle
│ │ │ │ +
249 * with the corners Φ(xᵢ). This way we only have to solve linear
│ │ │ │ +
250 * equations.
│ │ │ │ +
251 */
│ │ │ │
252
│ │ │ │ -
253 // we finished receiving from nextrank and thus remoterank = nextrank
│ │ │ │ -
254 remoterank = nextrank;
│ │ │ │ -
255
│ │ │ │ -
256 // get current data sizes
│ │ │ │ -
257 // and resize vectors
│ │ │ │ -
258 Dune::Hybrid::forEach(indices,
│ │ │ │ -
259 // [&](auto i){
│ │ │ │ -
260 // MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
│ │ │ │ -
261 // });
│ │ │ │ -
262 call_MPI_SetVectorSize<Args...>({
│ │ │ │ -
263 nextdata, status_recv
│ │ │ │ -
264 }));
│ │ │ │ +
253 using namespace ProjectionImplementation;
│ │ │ │ +
254 using std::get;
│ │ │ │ +
255 typedef Dune::FieldMatrix<Field, dim-1, dim-1> Matrix;
│ │ │ │ +
256 typedef Dune::FieldVector<Field, dim-1> Vector;
│ │ │ │ +
257
│ │ │ │ +
258 /* The inverse projection can only be computed if the forward projection
│ │ │ │ +
259 * managed to project all xᵢ on the plane spanned by the yᵢ
│ │ │ │ +
260 */
│ │ │ │ +
261 if (!m_projection_valid) {
│ │ │ │ +
262 get<1>(m_success).reset();
│ │ │ │ +
263 return;
│ │ │ │ +
264 }
│ │ │ │
265
│ │ │ │ -
266 MPI_Waitall(N,&requests_send[0],&status_send[0]);
│ │ │ │ -
267
│ │ │ │ -
268 // swap the communication buffers
│ │ │ │ -
269 std::swap(remotedata,nextdata);
│ │ │ │ -
270 }
│ │ │ │ -
271
│ │ │ │ -
272 // last apply (or the only one in the case of sequential application)
│ │ │ │ -
273 op(remoterank,std::get<Indices>(remotedata)...);
│ │ │ │ -
274 }
│ │ │ │ -
275 else // sequential
│ │ │ │ -
276 {
│ │ │ │ -
277 op(myrank,data...);
│ │ │ │ -
278 }
│ │ │ │ -
279 }
│ │ │ │ -
280
│ │ │ │ -
281 } // end namespace Impl
│ │ │ │ -
282
│ │ │ │ -
296template<typename OP, typename... Args>
│ │ │ │ -
│ │ │ │ -
297void MPI_AllApply(MPI_Comm mpicomm,
│ │ │ │ -
298 OP && op,
│ │ │ │ -
299 const Args& ... data)
│ │ │ │ -
300{
│ │ │ │ -
301 Impl::MPI_AllApply_impl(
│ │ │ │ -
302 mpicomm,
│ │ │ │ -
303 std::forward<OP>(op),
│ │ │ │ -
304 std::make_index_sequence<sizeof...(Args)>(),
│ │ │ │ -
305 data...
│ │ │ │ -
306 );
│ │ │ │ -
307}
│ │ │ │ -
│ │ │ │ -
308
│ │ │ │ -
309} // end namespace Parallel
│ │ │ │ +
266 const auto& images = get<0>(m_images);
│ │ │ │ +
267 const auto& target_corners = get<1>(corners);
│ │ │ │ +
268 auto& preimages = get<1>(m_images);
│ │ │ │ +
269 auto& success = get<1>(m_success);
│ │ │ │ +
270
│ │ │ │ +
271 std::array<Coordinate, dim> v;
│ │ │ │ +
272 for (unsigned i = 0; i < dim-1; ++i) {
│ │ │ │ +
273 v[i] = interpolate(images[i+1], target_corners);
│ │ │ │ +
274 v[i] -= interpolate(images[0], target_corners);
│ │ │ │ +
275 }
│ │ │ │ +
276
│ │ │ │ +
277 Matrix m;
│ │ │ │ +
278 for (unsigned i = 0; i < dim-1; ++i) {
│ │ │ │ +
279 for (unsigned j = 0; j < dim-1; ++j) {
│ │ │ │ +
280 m[i][j] = v[i]*v[j];
│ │ │ │ +
281 }
│ │ │ │ +
282 }
│ │ │ │ +
283
│ │ │ │ +
284 for (unsigned i = 0; i < dim; ++i) {
│ │ │ │ +
285 /* Convert yᵢ to barycentric coordinates with respect to Φ(xⱼ) */
│ │ │ │ +
286 v[dim-1] = target_corners[i];
│ │ │ │ +
287 v[dim-1] -= interpolate(images[0], target_corners);
│ │ │ │ +
288
│ │ │ │ +
289 Vector rhs, z;
│ │ │ │ +
290 for (unsigned j = 0; j < dim-1; ++j)
│ │ │ │ +
291 rhs[j] = v[dim-1]*v[j];
│ │ │ │ +
292 m.solve(z, rhs);
│ │ │ │ +
293
│ │ │ │ +
294 for (unsigned j = 0; j < dim-1; ++j)
│ │ │ │ +
295 preimages[i][j] = z[j];
│ │ │ │ +
296
│ │ │ │ +
297 /* Calculate distance along normal direction */
│ │ │ │ +
298 const auto x = interpolate(z, get<0>(corners));
│ │ │ │ +
299 preimages[i][dim-1] = (x - target_corners[i]) * get<1>(normals)[i];
│ │ │ │ +
300
│ │ │ │ +
301 /* Check y_i lies inside the Φ(xⱼ) */
│ │ │ │ +
302 const bool feasible = projectionFeasible(target_corners[i], get<1>(normals)[i], preimages[i], get<0>(corners), get<0>(normals));
│ │ │ │ +
303 success.set(i, feasible);
│ │ │ │ +
304 }
│ │ │ │ +
305}
│ │ │ │ +
306
│ │ │ │ +
307template<typename Coordinate>
│ │ │ │ +
308template<typename Corners, typename Normals>
│ │ │ │ +
309void
│ │ │ │ +
310Projection<Coordinate>
│ │ │ │ +
311::doEdgeIntersection(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
│ │ │ │ +
312{
│ │ │ │ +
313 using namespace ProjectionImplementation;
│ │ │ │ +
314 using std::get;
│ │ │ │ +
315
│ │ │ │ +
316 m_number_of_edge_intersections = 0;
│ │ │ │ +
317
│ │ │ │ +
318 /* There are no edge intersections for 2d, only for 3d */
│ │ │ │ +
319 if (dim != 3)
│ │ │ │ +
320 return;
│ │ │ │ +
321
│ │ │ │ +
322 /* There are no edge intersections
│ │ │ │ +
323 * - when the projection is invalid,
│ │ │ │ +
324 * - when the projected triangle lies fully in the target triangle,
│ │ │ │ +
325 * - or when the target triangle lies fully in the projected triangle.
│ │ │ │ +
326 */
│ │ │ │ +
327 if (!m_projection_valid || get<0>(m_success).all() || get<1>(m_success).all()) {
│ │ │ │ +
328 return;
│ │ │ │ +
329 }
│ │ │ │ +
330
│ │ │ │ +
331 const auto& images = get<0>(m_images);
│ │ │ │ +
332 const auto& ys = get<1>(corners);
│ │ │ │ +
333
│ │ │ │ +
334 /* Intersect line through Φ(xᵢ), Φ(xⱼ) with line through yₖ, yₗ:
│ │ │ │ +
335 We want α, β ∈ ℝ such that
│ │ │ │ +
336 Φ(xᵢ) + α (Φ(xⱼ) - Φ(xᵢ)) = yₖ + β (yₗ - yₖ)
│ │ │ │ +
337 or
│ │ │ │ +
338 α (Φ(xⱼ)-Φ(xᵢ)) + β (yₗ-yₖ) = yₖ-Φ(xᵢ)
│ │ │ │ +
339 To get a 2×2 system of equations, multiply with yₘ-y₀ for
│ │ │ │ +
340 m ∈ {1,̣̣2} which are linear indep. (and so the system is
│ │ │ │ +
341 equivalent to the original 3×2 system)
│ │ │ │ +
342 */
│ │ │ │ +
343 for (unsigned edgex = 0; edgex < dim; ++edgex) {
│ │ │ │ +
344 unsigned i, j;
│ │ │ │ +
345 std::tie(i, j) = edgeToCorners(edgex);
│ │ │ │ +
346
│ │ │ │ +
347 /* Both sides of edgex lie in the target triangle means no edge intersection */
│ │ │ │ +
348 if (get<0>(m_success)[i] && get<0>(m_success)[j])
│ │ │ │ +
349 continue;
│ │ │ │ +
350
│ │ │ │ +
351 const auto pxi = interpolate(images[i], ys);
│ │ │ │ +
352 const auto pxj = interpolate(images[j], ys);
│ │ │ │ +
353 const auto pxjpxi = pxj - pxi;
│ │ │ │ +
354
│ │ │ │ +
355 typedef Dune::FieldMatrix<Field, dim-1, dim-1> Matrix;
│ │ │ │ +
356 typedef Dune::FieldVector<Field, dim-1> Vector;
│ │ │ │ +
357
│ │ │ │ +
358 for (unsigned edgey = 0; edgey < dim; ++edgey) {
│ │ │ │ +
359 unsigned k, l;
│ │ │ │ +
360 std::tie(k, l) = edgeToCorners(edgey);
│ │ │ │ +
361
│ │ │ │ +
362 /* Both sides of edgey lie in the projected triangle means no edge intersection */
│ │ │ │ +
363 if (get<1>(m_success)[k] && get<1>(m_success)[l])
│ │ │ │ +
364 continue;
│ │ │ │ +
365
│ │ │ │ +
366 const auto ykyl = ys[k] - ys[l];
│ │ │ │ +
367 const auto ykpxi = ys[k] - pxi;
│ │ │ │ +
368
│ │ │ │ +
369 /* If edges are parallel then the intersection is already computed by vertex projections. */
│ │ │ │ +
370 bool parallel = true;
│ │ │ │ +
371 for (unsigned h=0; h<3; h++)
│ │ │ │ +
372 parallel &= std::abs(ykyl[(h+1)%3]*pxjpxi[(h+2)%3] - ykyl[(h+2)%3]*pxjpxi[(h+1)%3])<1e-14;
│ │ │ │ +
373 if (parallel)
│ │ │ │ +
374 continue;
│ │ │ │ +
375
│ │ │ │ +
376 Matrix mat;
│ │ │ │ +
377 Vector rhs, z;
│ │ │ │ +
378
│ │ │ │ +
379 for (unsigned m = 0; m < dim-1; ++m) {
│ │ │ │ +
380 const auto ym1y0 = ys[m+1] - ys[0];
│ │ │ │ +
381 mat[m][0] = pxjpxi * ym1y0;
│ │ │ │ +
382 mat[m][1] = ykyl * ym1y0;
│ │ │ │ +
383 rhs[m] = ykpxi * ym1y0;
│ │ │ │ +
384 }
│ │ │ │ +
385
│ │ │ │ +
386 try {
│ │ │ │ +
387 using std::isfinite;
│ │ │ │ +
388
│ │ │ │ +
389 mat.solve(z, rhs);
│ │ │ │ +
390
│ │ │ │ +
391 /* If solving the system gives a NaN, the edges are probably parallel. */
│ │ │ │ +
392 if (!isfinite(z[0]) || !isfinite(z[1]))
│ │ │ │ +
393 continue;
│ │ │ │ +
394
│ │ │ │ +
395 /* Filter out corner (pre)images. We only want "real" edge-edge intersections here. */
│ │ │ │ +
396 if (z[0] < m_epsilon || z[0] > Field(1) - m_epsilon
│ │ │ │ +
397 || z[1] < m_epsilon || z[1] > Field(1) - m_epsilon)
│ │ │ │ +
398 continue;
│ │ │ │ +
399
│ │ │ │ +
400 Coordinate local_x = corner<Coordinate, Field>(i);
│ │ │ │ +
401 local_x.axpy(z[0], corner<Coordinate, Field>(j) - corner<Coordinate, Field>(i));
│ │ │ │ +
402 Coordinate local_y = corner<Coordinate, Field>(k);
│ │ │ │ +
403 local_y.axpy(z[1], corner<Coordinate, Field>(l) - corner<Coordinate, Field>(k));
│ │ │ │ +
404
│ │ │ │ +
405 /* Make sure the intersection is in the triangle. */
│ │ │ │ +
406 if (!inside(local_x, m_epsilon) || !inside(local_y, m_epsilon))
│ │ │ │ +
407 continue;
│ │ │ │ +
408
│ │ │ │ +
409 /* Make sure the intersection respects overlap. */
│ │ │ │ +
410 auto xy = interpolate(local_x, get<0>(corners));
│ │ │ │ +
411 xy -= interpolate(local_y, get<1>(corners));
│ │ │ │ +
412 const auto nx = interpolate_unit_normals(local_x, get<0>(normals));
│ │ │ │ +
413 const auto ny = interpolate_unit_normals(local_y, get<1>(normals));
│ │ │ │ +
414 local_x[dim-1] = -(xy*nx);
│ │ │ │ +
415 local_y[dim-1] = xy*ny;
│ │ │ │ +
416
│ │ │ │ +
417 if (local_x[dim-1] < -m_overlap-m_epsilon || local_y[dim-1] < -m_overlap-m_epsilon)
│ │ │ │ +
418 continue;
│ │ │ │ +
419
│ │ │ │ +
420 /* Normals should be opposing. */
│ │ │ │ +
421 if (nx*ny > m_max_normal_product + m_epsilon)
│ │ │ │ +
422 continue;
│ │ │ │ +
423
│ │ │ │ +
424 /* Intersection is feasible. Store it. */
│ │ │ │ +
425 auto& intersection = m_edge_intersections[m_number_of_edge_intersections++];
│ │ │ │ +
426 intersection = { {{edgex, edgey}}, {{local_x, local_y}} };
│ │ │ │ +
427 }
│ │ │ │ +
428 catch(const Dune::FMatrixError&) {
│ │ │ │ +
429 /* Edges might be parallel, ignore and continue with next edge */
│ │ │ │ +
430 }
│ │ │ │ +
431 }
│ │ │ │ +
432 }
│ │ │ │ +
433}
│ │ │ │ +
434
│ │ │ │ +
435template<typename Coordinate>
│ │ │ │ +
436template<typename Corners, typename Normals>
│ │ │ │ +
437bool Projection<Coordinate>
│ │ │ │ +
438::projectionFeasible(const Coordinate& x, const Coordinate& nx, const Coordinate& px, const Corners& corners, const Normals& normals) const
│ │ │ │ +
439{
│ │ │ │ +
440 using namespace ProjectionImplementation;
│ │ │ │ +
441
│ │ │ │ +
442 /* Image must be within simplex. */
│ │ │ │ +
443 if (!inside(px, m_epsilon))
│ │ │ │ +
444 return false;
│ │ │ │ +
445
│ │ │ │ +
446 /* Distance along normal must not be smaller than -overlap. */
│ │ │ │ +
447 if (px[dim-1] < -m_overlap-m_epsilon)
│ │ │ │ +
448 return false;
│ │ │ │ +
449
│ │ │ │ +
450 /* Distance along normal at image must not be smaller than -overlap. */
│ │ │ │ +
451 auto xmy = x;
│ │ │ │ +
452 xmy -= interpolate(px, corners);
│ │ │ │ +
453 const auto n = interpolate_unit_normals(px, normals);
│ │ │ │ +
454 const auto d = xmy * n;
│ │ │ │ +
455 if (d < -m_overlap-m_epsilon)
│ │ │ │ +
456 return false;
│ │ │ │ +
457
│ │ │ │ +
458 /* Normals at x and Φ(x) are opposing. */
│ │ │ │ +
459 if (nx * n > m_max_normal_product + m_epsilon)
│ │ │ │ +
460 return false;
│ │ │ │ +
461
│ │ │ │ +
462 /* Okay, projection is feasible. */
│ │ │ │ +
463 return true;
│ │ │ │ +
464}
│ │ │ │ +
465
│ │ │ │ +
466template<typename Coordinate>
│ │ │ │ +
467template<typename Corners, typename Normals>
│ │ │ │ +
468void Projection<Coordinate>
│ │ │ │ +
│ │ │ │ +
469::project(const std::tuple<Corners&, Corners&>& corners, const std::tuple<Normals&, Normals&>& normals)
│ │ │ │ +
470{
│ │ │ │ +
471 doProjection(corners, normals);
│ │ │ │ +
472 doInverseProjection(corners, normals);
│ │ │ │ +
473 doEdgeIntersection(corners, normals);
│ │ │ │ +
474}
│ │ │ │
│ │ │ │ -
310} // end namespace Dune
│ │ │ │ +
475
│ │ │ │ +
476} /* namespace GridGlue */
│ │ │ │ +
477} /* namespace Dune */
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data)
apply an operator locally to a difstributed data set
Definition ringcomm.hh:297
│ │ │ │ +
Corners::value_type interpolate(const Coordinate &x, const Corners &corners)
Definition projection_impl.hh:70
│ │ │ │ +
bool inside(const Coordinate &x, const Field &epsilon)
Definition projection_impl.hh:111
│ │ │ │ +
std::pair< unsigned, unsigned > edgeToCorners(unsigned edge)
Definition projection_impl.hh:43
│ │ │ │ +
Coordinate corner(unsigned c)
Definition projection_impl.hh:24
│ │ │ │ +
Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals &normals)
Definition projection_impl.hh:91
│ │ │ │ +
Projection of a line (triangle) on another line (triangle).
Definition projection.hh:21
│ │ │ │ +
Coordinate::field_type Field
Scalar type.
Definition projection.hh:61
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,308 +1,480 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -ringcomm.hh │ │ │ │ │ +projection_impl.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ -2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ -3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ +1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ -4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ +2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -5/* IMPLEMENTATION OF CLASS G R I D G L U E */ │ │ │ │ │ +3#include │ │ │ │ │ +4 │ │ │ │ │ +5#include │ │ │ │ │ 6 │ │ │ │ │ -_8#define CheckMPIStatus(A,B) {} │ │ │ │ │ +7namespace _D_u_n_e { │ │ │ │ │ +8namespace GridGlue { │ │ │ │ │ 9 │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12#include │ │ │ │ │ -13 │ │ │ │ │ -14#include │ │ │ │ │ -15#include │ │ │ │ │ -16 │ │ │ │ │ -17#include │ │ │ │ │ -18 │ │ │ │ │ -19namespace _D_u_n_e { │ │ │ │ │ -_2_0namespace Parallel { │ │ │ │ │ -21 │ │ │ │ │ -22 namespace Impl { │ │ │ │ │ -23 │ │ │ │ │ -25 template │ │ │ │ │ -26 struct MPITypeInfo {}; │ │ │ │ │ -27 │ │ │ │ │ -28 template<> │ │ │ │ │ -29 struct MPITypeInfo< int > │ │ │ │ │ -30 { │ │ │ │ │ -31 static const unsigned int size = 1; │ │ │ │ │ -32 static inline MPI_Datatype getType() │ │ │ │ │ -33 { │ │ │ │ │ -34 return MPI_INT; │ │ │ │ │ -35 } │ │ │ │ │ -36 }; │ │ │ │ │ -37 │ │ │ │ │ -38 template │ │ │ │ │ -39 struct MPITypeInfo< _D_u_n_e::FieldVector > │ │ │ │ │ -40 { │ │ │ │ │ -41 static const unsigned int size = N; │ │ │ │ │ -42 static inline MPI_Datatype getType() │ │ │ │ │ -43 { │ │ │ │ │ -44 return Dune::MPITraits::getType(); │ │ │ │ │ -45 } │ │ │ │ │ -46 }; │ │ │ │ │ -47 │ │ │ │ │ -48 template<> │ │ │ │ │ -49 struct MPITypeInfo< unsigned int > │ │ │ │ │ -50 { │ │ │ │ │ -51 static const unsigned int size = 1; │ │ │ │ │ -52 static inline MPI_Datatype getType() │ │ │ │ │ -53 { │ │ │ │ │ -54 return MPI_UNSIGNED; │ │ │ │ │ -55 } │ │ │ │ │ -56 }; │ │ │ │ │ -57 │ │ │ │ │ -58 template<> │ │ │ │ │ -59 struct MPITypeInfo< _D_u_n_e::GeometryType > │ │ │ │ │ -60 { │ │ │ │ │ -61 static const unsigned int size = 1; │ │ │ │ │ -62 static inline MPI_Datatype getType() │ │ │ │ │ -63 { │ │ │ │ │ -64 return Dune::MPITraits< Dune::GeometryType >::getType(); │ │ │ │ │ -65 } │ │ │ │ │ -66 }; │ │ │ │ │ -67 │ │ │ │ │ -68 template │ │ │ │ │ -69 void MPI_SetVectorSize( │ │ │ │ │ -70 std::vector & data, │ │ │ │ │ -71 MPI_Status & status) │ │ │ │ │ -72 { │ │ │ │ │ -73 typedef MPITypeInfo Info; │ │ │ │ │ -74 int sz; │ │ │ │ │ -75 MPI_Get_count(&status, Info::getType(), &sz); │ │ │ │ │ -76 assert(sz%Info::size == 0); │ │ │ │ │ -77 data.resize(sz/Info::size); │ │ │ │ │ -78 } │ │ │ │ │ -79 │ │ │ │ │ -89 template │ │ │ │ │ -90 void MPI_SendVectorInRing( │ │ │ │ │ -91 std::vector & data, │ │ │ │ │ -92 std::vector & next, │ │ │ │ │ -93 int tag, │ │ │ │ │ -94 int rightrank, │ │ │ │ │ -95 int leftrank, │ │ │ │ │ -96 MPI_Comm comm, │ │ │ │ │ -97 MPI_Request& r_send, │ │ │ │ │ -98 MPI_Request& r_recv │ │ │ │ │ -99 ) │ │ │ │ │ -100 { │ │ │ │ │ -101 // mpi status stuff │ │ │ │ │ -102 [[maybe_unused]] int result = 0; │ │ │ │ │ -103 typedef MPITypeInfo Info; │ │ │ │ │ -104 // resize next buffer to maximum size │ │ │ │ │ -105 next.resize(next.capacity()); │ │ │ │ │ -106 // send data (explicitly send data.size elements) │ │ │ │ │ -107 result = │ │ │ │ │ -108 MPI_Isend( │ │ │ │ │ -109 &(data[0]), Info::size*data.size(), Info::getType(), rightrank, tag, │ │ │ │ │ -110 comm, &r_send); │ │ │ │ │ -111 // receive up to maximum size. The acutal size is stored in the status │ │ │ │ │ -112 result = │ │ │ │ │ -113 MPI_Irecv( │ │ │ │ │ -114 &(next[0]), Info::size*next.size(), Info::getType(), leftrank, tag, │ │ │ │ │ -115 comm, &r_recv); │ │ │ │ │ -116 // // check result │ │ │ │ │ -117 // MPI_Status status; │ │ │ │ │ -118 // CheckMPIStatus(result, status); │ │ │ │ │ +_1_0namespace ProjectionImplementation { │ │ │ │ │ +11 │ │ │ │ │ +22template │ │ │ │ │ +23inline Coordinate │ │ │ │ │ +_2_4_c_o_r_n_e_r(unsigned c) │ │ │ │ │ +25{ │ │ │ │ │ +26 Coordinate x(Field(0)); │ │ │ │ │ +27 if (c == 0) │ │ │ │ │ +28 return x; │ │ │ │ │ +29 x[c-1] = Field(1); │ │ │ │ │ +30 return x; │ │ │ │ │ +31} │ │ │ │ │ +32 │ │ │ │ │ +42inline std::pair │ │ │ │ │ +_4_3_e_d_g_e_T_o_C_o_r_n_e_r_s(unsigned edge) │ │ │ │ │ +44{ │ │ │ │ │ +45 switch(edge) { │ │ │ │ │ +46 case 0: return {0, 1}; │ │ │ │ │ +47 case 1: return {0, 2}; │ │ │ │ │ +48 case 2: return {1, 2}; │ │ │ │ │ +49 } │ │ │ │ │ +50 DUNE_THROW(Dune::Exception, "Unexpected edge number."); │ │ │ │ │ +51} │ │ │ │ │ +52 │ │ │ │ │ +68template │ │ │ │ │ +69inline typename Corners::value_type │ │ │ │ │ +_7_0_i_n_t_e_r_p_o_l_a_t_e(const Coordinate& x, const Corners& corners) │ │ │ │ │ +71{ │ │ │ │ │ +72 auto y = corners[0]; │ │ │ │ │ +73 for (unsigned i = 0; i < corners.size() - 1; ++i) │ │ │ │ │ +74 y.axpy(x[i], corners[i+1] - corners[0]); │ │ │ │ │ +75 return y; │ │ │ │ │ +76} │ │ │ │ │ +77 │ │ │ │ │ +89template │ │ │ │ │ +90inline typename Normals::value_type │ │ │ │ │ +_9_1_i_n_t_e_r_p_o_l_a_t_e___u_n_i_t___n_o_r_m_a_l_s(const Coordinate& x, const Normals& normals) │ │ │ │ │ +92{ │ │ │ │ │ +93 auto n = _i_n_t_e_r_p_o_l_a_t_e(x, normals); │ │ │ │ │ +94 n /= n.two_norm(); │ │ │ │ │ +95 return n; │ │ │ │ │ +96} │ │ │ │ │ +97 │ │ │ │ │ +109template │ │ │ │ │ +110inline bool │ │ │ │ │ +_1_1_1_i_n_s_i_d_e(const Coordinate& x, const Field& epsilon) │ │ │ │ │ +112{ │ │ │ │ │ +113 const unsigned dim = Coordinate::dimension; │ │ │ │ │ +114 Field sum(0); │ │ │ │ │ +115 for (unsigned i = 0; i < dim-1; ++i) { │ │ │ │ │ +116 if (x[i] < -epsilon) │ │ │ │ │ +117 return false; │ │ │ │ │ +118 sum += x[i]; │ │ │ │ │ 119 } │ │ │ │ │ -120 │ │ │ │ │ -121 template │ │ │ │ │ -122 using ptr_t = T*; │ │ │ │ │ -123 │ │ │ │ │ -124 /* these helper structs are needed as long as we still support │ │ │ │ │ -125 C++11, as we can't use variadic lambdas */ │ │ │ │ │ -126 template │ │ │ │ │ -127 struct call_MPI_SendVectorInRing │ │ │ │ │ -128 { │ │ │ │ │ -129 std::tuple & remotedata; │ │ │ │ │ -130 std::tuple & nextdata; │ │ │ │ │ -131 int & tag; │ │ │ │ │ -132 int & rightrank; │ │ │ │ │ -133 int & leftrank; │ │ │ │ │ -134 MPI_Comm & mpicomm; │ │ │ │ │ -135 std::array & requests_send; │ │ │ │ │ -136 std::array & requests_recv; │ │ │ │ │ -137 │ │ │ │ │ -138 template │ │ │ │ │ -139 void operator()(I i) │ │ │ │ │ -140 { │ │ │ │ │ -141 MPI_SendVectorInRing( │ │ │ │ │ -142 std::get(remotedata), │ │ │ │ │ -143 std::get(nextdata), │ │ │ │ │ -144 tag+i, │ │ │ │ │ -145 rightrank, leftrank, mpicomm, │ │ │ │ │ -146 requests_send[i], │ │ │ │ │ -147 requests_recv[i]); │ │ │ │ │ -148 } │ │ │ │ │ -149 }; │ │ │ │ │ -150 template │ │ │ │ │ -151 struct call_MPI_SetVectorSize │ │ │ │ │ -152 { │ │ │ │ │ -153 std::tuple & nextdata; │ │ │ │ │ -154 std::array & status_recv; │ │ │ │ │ -155 │ │ │ │ │ -156 template │ │ │ │ │ -157 void operator()(I i) │ │ │ │ │ -158 { │ │ │ │ │ -159 MPI_SetVectorSize(std::get(nextdata),status_recv[i]); │ │ │ │ │ -160 } │ │ │ │ │ -161 }; │ │ │ │ │ -162 │ │ │ │ │ -163 template │ │ │ │ │ -164 void MPI_AllApply_impl(MPI_Comm mpicomm, │ │ │ │ │ -165 OP && op, │ │ │ │ │ -166 std::index_sequence indices, │ │ │ │ │ -167 const Args&... data) │ │ │ │ │ -168 { │ │ │ │ │ -169 constexpr std::size_t N = sizeof...(Args); │ │ │ │ │ -170 int myrank = 0; │ │ │ │ │ -171 int commsize = 0; │ │ │ │ │ -172#if HAVE_MPI │ │ │ │ │ -173 MPI_Comm_rank(mpicomm, &myrank); │ │ │ │ │ -174 MPI_Comm_size(mpicomm, &commsize); │ │ │ │ │ -175#endif // HAVE_MPI │ │ │ │ │ -176 │ │ │ │ │ -177 if (commsize > 1) │ │ │ │ │ -178 { │ │ │ │ │ -179#ifdef DEBUG_GRIDGLUE_PARALLELMERGE │ │ │ │ │ -180 std::cout << myrank << " Start Communication, size " << commsize << std:: │ │ │ │ │ -endl; │ │ │ │ │ -181#endif │ │ │ │ │ -182 │ │ │ │ │ -183 // get data sizes │ │ │ │ │ -184 std::array size({ ((unsigned int)data.size())... }); │ │ │ │ │ -185 │ │ │ │ │ -186 // communicate max data size │ │ │ │ │ -187 std::array maxSize; │ │ │ │ │ -188 MPI_Allreduce(&size, &maxSize, │ │ │ │ │ -189 size.size(), MPI_UNSIGNED, MPI_MAX, mpicomm); │ │ │ │ │ -190#ifdef DEBUG_GRIDGLUE_PARALLELMERGE │ │ │ │ │ -191 std::cout << myrank << " maxSize " << "done... " << std::endl; │ │ │ │ │ -192#endif │ │ │ │ │ -193 │ │ │ │ │ -194 // allocate receiving buffers with maxsize to ensure sufficient buffer size │ │ │ │ │ -for communication │ │ │ │ │ -195 std::tuple remotedata { Args(maxSize[Indices])... }; │ │ │ │ │ -196 │ │ │ │ │ -197 // copy local data to receiving buffer │ │ │ │ │ -198 remotedata = std::tie(data...); │ │ │ │ │ -199 │ │ │ │ │ -200 // allocate second set of receiving buffers necessary for async │ │ │ │ │ -communication │ │ │ │ │ -201 std::tuple nextdata { Args(maxSize[Indices])... }; │ │ │ │ │ +120 /* If any xáµ¢ is NaN, sum will be NaN and this comparison false! */ │ │ │ │ │ +121 if (sum <= Field(1) + epsilon) │ │ │ │ │ +122 return true; │ │ │ │ │ +123 return false; │ │ │ │ │ +124} │ │ │ │ │ +125 │ │ │ │ │ +126} /* namespace ProjectionImplementation */ │ │ │ │ │ +127 │ │ │ │ │ +128template │ │ │ │ │ +129Projection │ │ │ │ │ +_1_3_0::Projection(const _F_i_e_l_d overlap, const _F_i_e_l_d max_normal_product) │ │ │ │ │ +131 : m_overlap(overlap) │ │ │ │ │ +132 , m_max_normal_product(max_normal_product) │ │ │ │ │ +133{ │ │ │ │ │ +134 /* Nothing. */ │ │ │ │ │ +135} │ │ │ │ │ +136 │ │ │ │ │ +137template │ │ │ │ │ +138void │ │ │ │ │ +139_P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_> │ │ │ │ │ +_1_4_0_:_:_e_p_s_i_l_o_n(const _F_i_e_l_d epsilon) │ │ │ │ │ +141{ │ │ │ │ │ +142 m_epsilon = epsilon; │ │ │ │ │ +143} │ │ │ │ │ +144 │ │ │ │ │ +145template │ │ │ │ │ +146template │ │ │ │ │ +147void │ │ │ │ │ +148_P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_> │ │ │ │ │ +149_:_:_d_o_P_r_o_j_e_c_t_i_o_n(const std::tuple& corners, const std:: │ │ │ │ │ +tuple& normals) │ │ │ │ │ +150{ │ │ │ │ │ +151 /* Try to obtain Φ(xáµ¢) for each corner xáµ¢ of the preimage triangle. │ │ │ │ │ +152 * This means solving a linear system of equations │ │ │ │ │ +153 * Φ(xáµ¢) = (1-α-β) y₀ + α y₁ + β y₂ = xáµ¢ + δ náµ¢ │ │ │ │ │ +154 * or α (y₁ - y₀) + β (y₂ - y₀) - δ náµ¢ = xáµ¢ - y₀ │ │ │ │ │ +155 * to obtain the barycentric coordinates (α, β) of Φ(xáµ¢) in the image │ │ │ │ │ +156 * triangle and the distance δ. │ │ │ │ │ +157 * │ │ │ │ │ +158 * In the matrix m corresponding to the system, only the third column and │ │ │ │ │ +the │ │ │ │ │ +159 * right-hand side depend on i. The first two columns can be assembled │ │ │ │ │ +before │ │ │ │ │ +160 * and reused. │ │ │ │ │ +161 */ │ │ │ │ │ +162 using namespace ProjectionImplementation; │ │ │ │ │ +163 using std::get; │ │ │ │ │ +164 typedef Dune::FieldMatrix Matrix; │ │ │ │ │ +165 Matrix m; │ │ │ │ │ +166 │ │ │ │ │ +167 const auto& origin = get<0>(corners); │ │ │ │ │ +168 const auto& origin_normals = get<0>(normals); │ │ │ │ │ +169 const auto& target = get<1>(corners); │ │ │ │ │ +170 const auto& target_normals = get<1>(normals); │ │ │ │ │ +171 auto& images = get<0>(m_images); │ │ │ │ │ +172 auto& success = get<0>(m_success); │ │ │ │ │ +173 │ │ │ │ │ +174 /* directionsáµ¢ = (yáµ¢ - y₀) / ||yáµ¢ - y₀|| │ │ │ │ │ +175 * These are the first to columns of the system matrix; the rescaling is │ │ │ │ │ +done │ │ │ │ │ +176 * to ensure all columns have a comparable norm (the last has the normal │ │ │ │ │ +with norm 1. │ │ │ │ │ +177 */ │ │ │ │ │ +178 std::array directions; │ │ │ │ │ +179 std::array scales; │ │ │ │ │ +180 /* estimator for the diameter of the target face */ │ │ │ │ │ +181 Field scaleSum(0); │ │ │ │ │ +182 for (unsigned i = 0; i < dim-1; ++i) { │ │ │ │ │ +183 directions[i] = target[i+1] - target[0]; │ │ │ │ │ +184 scales[i] = directions[i].infinity_norm(); │ │ │ │ │ +185 directions[i] /= scales[i]; │ │ │ │ │ +186 scaleSum += scales[i]; │ │ │ │ │ +187 } │ │ │ │ │ +188 │ │ │ │ │ +189 for (unsigned i = 0; i < dim-1; ++i) { │ │ │ │ │ +190 for (unsigned j = 0; j < dim; ++j) { │ │ │ │ │ +191 m[j][i] = directions[i][j]; │ │ │ │ │ +192 } │ │ │ │ │ +193 } │ │ │ │ │ +194 │ │ │ │ │ +195 m_projection_valid = true; │ │ │ │ │ +196 success.reset(); │ │ │ │ │ +197 │ │ │ │ │ +198 /* Now project xáµ¢ for each i */ │ │ │ │ │ +199 for (unsigned i = 0; i < origin.size(); ++i) { │ │ │ │ │ +200 for (unsigned j = 0; j < dim; ++j) │ │ │ │ │ +201 m[j][dim-1] = origin_normals[i][j]; │ │ │ │ │ 202 │ │ │ │ │ -203 // communicate data in the ring │ │ │ │ │ -204 int rightrank = (myrank + 1 + commsize) % commsize; │ │ │ │ │ -205 int leftrank = (myrank - 1 + commsize) % commsize; │ │ │ │ │ -206 │ │ │ │ │ -207 std::cout << myrank << ": size = " << commsize << std::endl; │ │ │ │ │ -208 std::cout << myrank << ": left = " << leftrank │ │ │ │ │ -209 << " right = " << rightrank << std::endl; │ │ │ │ │ -210 │ │ │ │ │ -211 // currently the remote data is our own data │ │ │ │ │ -212 int remoterank = myrank; │ │ │ │ │ +203 const Coordinate rhs = origin[i] - target[0]; │ │ │ │ │ +204 │ │ │ │ │ +205 try { │ │ │ │ │ +206 /* y = (α, β, δ) */ │ │ │ │ │ +207 auto& y = images[i]; │ │ │ │ │ +208 m.solve(y, rhs); │ │ │ │ │ +209 for (unsigned j = 0; j < dim-1; ++j) │ │ │ │ │ +210 y[j] /= scales[j]; │ │ │ │ │ +211 /* Solving gave us -δ as the term is "-δ náµ¢". */ │ │ │ │ │ +212 y[dim-1] *= Field(-1); │ │ │ │ │ 213 │ │ │ │ │ -214 for (int i=1; i Field(1) - m_epsilon │ │ │ │ │ +397 || z[1] < m_epsilon || z[1] > Field(1) - m_epsilon) │ │ │ │ │ +398 continue; │ │ │ │ │ +399 │ │ │ │ │ +400 Coordinate local_x = corner(i); │ │ │ │ │ +401 local_x.axpy(z[0], corner(j) - corner │ │ │ │ │ +(i)); │ │ │ │ │ +402 Coordinate local_y = corner(k); │ │ │ │ │ +403 local_y.axpy(z[1], corner(l) - corner │ │ │ │ │ +(k)); │ │ │ │ │ +404 │ │ │ │ │ +405 /* Make sure the intersection is in the triangle. */ │ │ │ │ │ +406 if (!_i_n_s_i_d_e(local_x, m_epsilon) || !_i_n_s_i_d_e(local_y, m_epsilon)) │ │ │ │ │ +407 continue; │ │ │ │ │ +408 │ │ │ │ │ +409 /* Make sure the intersection respects overlap. */ │ │ │ │ │ +410 auto xy = _i_n_t_e_r_p_o_l_a_t_e(local_x, get<0>(corners)); │ │ │ │ │ +411 xy -= _i_n_t_e_r_p_o_l_a_t_e(local_y, get<1>(corners)); │ │ │ │ │ +412 const auto nx = _i_n_t_e_r_p_o_l_a_t_e___u_n_i_t___n_o_r_m_a_l_s(local_x, get<0>(normals)); │ │ │ │ │ +413 const auto ny = _i_n_t_e_r_p_o_l_a_t_e___u_n_i_t___n_o_r_m_a_l_s(local_y, get<1>(normals)); │ │ │ │ │ +414 local_x[dim-1] = -(xy*nx); │ │ │ │ │ +415 local_y[dim-1] = xy*ny; │ │ │ │ │ +416 │ │ │ │ │ +417 if (local_x[dim-1] < -m_overlap-m_epsilon || local_y[dim-1] < -m_overlap- │ │ │ │ │ +m_epsilon) │ │ │ │ │ +418 continue; │ │ │ │ │ +419 │ │ │ │ │ +420 /* Normals should be opposing. */ │ │ │ │ │ +421 if (nx*ny > m_max_normal_product + m_epsilon) │ │ │ │ │ +422 continue; │ │ │ │ │ +423 │ │ │ │ │ +424 /* Intersection is feasible. Store it. */ │ │ │ │ │ +425 auto& intersection = m_edge_intersections │ │ │ │ │ +[m_number_of_edge_intersections++]; │ │ │ │ │ +426 intersection = { {{edgex, edgey}}, {{local_x, local_y}} }; │ │ │ │ │ +427 } │ │ │ │ │ +428 catch(const Dune::FMatrixError&) { │ │ │ │ │ +429 /* Edges might be parallel, ignore and continue with next edge */ │ │ │ │ │ +430 } │ │ │ │ │ +431 } │ │ │ │ │ +432 } │ │ │ │ │ +433} │ │ │ │ │ +434 │ │ │ │ │ +435template │ │ │ │ │ +436template │ │ │ │ │ +437bool Projection │ │ │ │ │ +438::projectionFeasible(const Coordinate& x, const Coordinate& nx, const │ │ │ │ │ +Coordinate& px, const Corners& corners, const Normals& normals) const │ │ │ │ │ +439{ │ │ │ │ │ +440 using namespace ProjectionImplementation; │ │ │ │ │ +441 │ │ │ │ │ +442 /* Image must be within simplex. */ │ │ │ │ │ +443 if (!_i_n_s_i_d_e(px, m_epsilon)) │ │ │ │ │ +444 return false; │ │ │ │ │ +445 │ │ │ │ │ +446 /* Distance along normal must not be smaller than -overlap. */ │ │ │ │ │ +447 if (px[dim-1] < -m_overlap-m_epsilon) │ │ │ │ │ +448 return false; │ │ │ │ │ +449 │ │ │ │ │ +450 /* Distance along normal at image must not be smaller than -overlap. */ │ │ │ │ │ +451 auto xmy = x; │ │ │ │ │ +452 xmy -= _i_n_t_e_r_p_o_l_a_t_e(px, corners); │ │ │ │ │ +453 const auto n = _i_n_t_e_r_p_o_l_a_t_e___u_n_i_t___n_o_r_m_a_l_s(px, normals); │ │ │ │ │ +454 const auto d = xmy * n; │ │ │ │ │ +455 if (d < -m_overlap-m_epsilon) │ │ │ │ │ +456 return false; │ │ │ │ │ +457 │ │ │ │ │ +458 /* Normals at x and Φ(x) are opposing. */ │ │ │ │ │ +459 if (nx * n > m_max_normal_product + m_epsilon) │ │ │ │ │ +460 return false; │ │ │ │ │ +461 │ │ │ │ │ +462 /* Okay, projection is feasible. */ │ │ │ │ │ +463 return true; │ │ │ │ │ +464} │ │ │ │ │ +465 │ │ │ │ │ +466template │ │ │ │ │ +467template │ │ │ │ │ +468void Projection │ │ │ │ │ +_4_6_9::project(const std::tuple& corners, const std:: │ │ │ │ │ +tuple& normals) │ │ │ │ │ +470{ │ │ │ │ │ +471 doProjection(corners, normals); │ │ │ │ │ +472 doInverseProjection(corners, normals); │ │ │ │ │ +473 doEdgeIntersection(corners, normals); │ │ │ │ │ +474} │ │ │ │ │ +475 │ │ │ │ │ +476} /* namespace GridGlue */ │ │ │ │ │ +477} /* namespace Dune */ │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_:_:_M_P_I___A_l_l_A_p_p_l_y │ │ │ │ │ -void MPI_AllApply(MPI_Comm mpicomm, OP &&op, const Args &... data) │ │ │ │ │ -apply an operator locally to a difstributed data set │ │ │ │ │ -DDeeffiinniittiioonn ringcomm.hh:297 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_i_n_t_e_r_p_o_l_a_t_e │ │ │ │ │ +Corners::value_type interpolate(const Coordinate &x, const Corners &corners) │ │ │ │ │ +DDeeffiinniittiioonn projection_impl.hh:70 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_i_n_s_i_d_e │ │ │ │ │ +bool inside(const Coordinate &x, const Field &epsilon) │ │ │ │ │ +DDeeffiinniittiioonn projection_impl.hh:111 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_e_d_g_e_T_o_C_o_r_n_e_r_s │ │ │ │ │ +std::pair< unsigned, unsigned > edgeToCorners(unsigned edge) │ │ │ │ │ +DDeeffiinniittiioonn projection_impl.hh:43 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_c_o_r_n_e_r │ │ │ │ │ +Coordinate corner(unsigned c) │ │ │ │ │ +DDeeffiinniittiioonn projection_impl.hh:24 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_i_n_t_e_r_p_o_l_a_t_e___u_n_i_t___n_o_r_m_a_l_s │ │ │ │ │ +Normals::value_type interpolate_unit_normals(const Coordinate &x, const Normals │ │ │ │ │ +&normals) │ │ │ │ │ +DDeeffiinniittiioonn projection_impl.hh:91 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n │ │ │ │ │ +Projection of a line (triangle) on another line (triangle). │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:21 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_F_i_e_l_d │ │ │ │ │ +Coordinate::field_type Field │ │ │ │ │ +Scalar type. │ │ │ │ │ +DDeeffiinniittiioonn projection.hh:61 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: areawriter.hh File Reference │ │ │ │ +dune-grid-glue: projectionwriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,41 +72,45 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
areawriter.hh File Reference
│ │ │ │ +
projectionwriter.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <ostream>
│ │ │ │ +
#include <iostream>
│ │ │ │ #include <string>
│ │ │ │ -#include "areawriter_impl.hh"
│ │ │ │ +#include <dune/grid-glue/common/projection.hh>
│ │ │ │ +#include "projectionwriter_impl.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ 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 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
 
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
 
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.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,31 +2,36 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -areawriter.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +projectionwriter.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include "_a_r_e_a_w_r_i_t_e_r___i_m_p_l_._h_h" │ │ │ │ │ +#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_c_o_m_m_o_n_/_p_r_o_j_e_c_t_i_o_n_._h_h> │ │ │ │ │ +#include "_p_r_o_j_e_c_t_i_o_n_w_r_i_t_e_r___i_m_p_l_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ FFuunnccttiioonnss │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k (const Glue &glue, std::ostream &out) │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ + Corners &corners, const Normals &normals, std::ostream &out) │ │ │ │ │ +  write projection in VTK format │ │ │ │ │   │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k (const Glue &glue, const std::string │ │ │ │ │ - &filename) │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ + Corners &corners, const Normals &normals, const std::string &filename) │ │ │ │ │ +  write projection in VTK format │ │ │ │ │   │ │ │ │ │ -template │ │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k (const Glue &glue, const std::string │ │ │ │ │ - &base) │ │ │ │ │ +template │ │ │ │ │ +void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ │ + Corners &corners, const Normals &normals) │ │ │ │ │ +  Print information about the projection to std::cout stream. │ │ │ │ │   │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: areawriter.hh Source File │ │ │ │ +dune-grid-glue: projectionwriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,47 +74,57 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
areawriter.hh
│ │ │ │ +
projectionwriter.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
3#ifndef DUNE_GRIDGLUE_COMMON_AREAWRITER_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_COMMON_AREAWRITER_HH
│ │ │ │ +
3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
│ │ │ │ +
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
│ │ │ │
5
│ │ │ │ -
6#include <ostream>
│ │ │ │ +
6#include <iostream>
│ │ │ │
7#include <string>
│ │ │ │
8
│ │ │ │ -
9namespace Dune {
│ │ │ │ -
10namespace GridGlue {
│ │ │ │ -
11
│ │ │ │ -
12template<int side, typename Glue>
│ │ │ │ -
13void write_glue_area_vtk(const Glue& glue, std::ostream& out);
│ │ │ │ -
14
│ │ │ │ -
15template<int side, typename Glue>
│ │ │ │ -
16void write_glue_area_vtk(const Glue& glue, const std::string& filename);
│ │ │ │ -
17
│ │ │ │ -
37template<typename Glue>
│ │ │ │ -
38void write_glue_areas_vtk(const Glue& glue, const std::string& base);
│ │ │ │ -
39
│ │ │ │ -
40} /* namespace GridGlue */
│ │ │ │ -
41} /* namespace Dune */
│ │ │ │ -
42
│ │ │ │ -
43#include "areawriter_impl.hh"
│ │ │ │ -
44
│ │ │ │ -
45#endif
│ │ │ │ - │ │ │ │ + │ │ │ │ +
10
│ │ │ │ +
11namespace Dune {
│ │ │ │ +
12namespace GridGlue {
│ │ │ │ +
13
│ │ │ │ +
28template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ +
29void write(const Projection<Coordinate>& projection,
│ │ │ │ +
30 const Corners& corners,
│ │ │ │ +
31 const Normals& normals,
│ │ │ │ +
32 std::ostream& out);
│ │ │ │ +
33
│ │ │ │ +
40template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ +
41void write(const Projection<Coordinate>& projection,
│ │ │ │ +
42 const Corners& corners,
│ │ │ │ +
43 const Normals& normals,
│ │ │ │ +
44 const std::string& filename);
│ │ │ │ +
54template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ +
55void print(const Projection<Coordinate>& projection,
│ │ │ │ +
56 const Corners& corners,
│ │ │ │ +
57 const Normals& normals);
│ │ │ │ +
58
│ │ │ │ +
59} /* namespace GridGlue */
│ │ │ │ +
60} /* namespace Dune */
│ │ │ │ +
61
│ │ │ │ + │ │ │ │ +
63
│ │ │ │ +
64#endif
│ │ │ │ + │ │ │ │ + │ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
void write_glue_area_vtk(const Glue &glue, std::ostream &out)
Definition areawriter_impl.hh:84
│ │ │ │ -
void write_glue_areas_vtk(const Glue &glue, const std::string &base)
Definition areawriter_impl.hh:129
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,48 +1,62 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _c_o_m_m_o_n │ │ │ │ │ -areawriter.hh │ │ │ │ │ +projectionwriter.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -3#ifndef DUNE_GRIDGLUE_COMMON_AREAWRITER_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_COMMON_AREAWRITER_HH │ │ │ │ │ +3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH │ │ │ │ │ +4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH │ │ │ │ │ 5 │ │ │ │ │ -6#include │ │ │ │ │ +6#include │ │ │ │ │ 7#include │ │ │ │ │ 8 │ │ │ │ │ -9namespace _D_u_n_e { │ │ │ │ │ -10namespace GridGlue { │ │ │ │ │ -11 │ │ │ │ │ -12template │ │ │ │ │ -13void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, std::ostream& out); │ │ │ │ │ -14 │ │ │ │ │ -15template │ │ │ │ │ -16void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, const std::string& filename); │ │ │ │ │ -17 │ │ │ │ │ -37template │ │ │ │ │ -38void _w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k(const Glue& glue, const std::string& base); │ │ │ │ │ -39 │ │ │ │ │ -40} /* namespace GridGlue */ │ │ │ │ │ -41} /* namespace Dune */ │ │ │ │ │ -42 │ │ │ │ │ -43#include "_a_r_e_a_w_r_i_t_e_r___i_m_p_l_._h_h" │ │ │ │ │ -44 │ │ │ │ │ -45#endif │ │ │ │ │ -_a_r_e_a_w_r_i_t_e_r___i_m_p_l_._h_h │ │ │ │ │ +9#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_c_o_m_m_o_n_/_p_r_o_j_e_c_t_i_o_n_._h_h> │ │ │ │ │ +10 │ │ │ │ │ +11namespace _D_u_n_e { │ │ │ │ │ +12namespace GridGlue { │ │ │ │ │ +13 │ │ │ │ │ +28template │ │ │ │ │ +29void _w_r_i_t_e(const Projection& projection, │ │ │ │ │ +30 const Corners& corners, │ │ │ │ │ +31 const Normals& normals, │ │ │ │ │ +32 std::ostream& out); │ │ │ │ │ +33 │ │ │ │ │ +40template │ │ │ │ │ +41void _w_r_i_t_e(const Projection& projection, │ │ │ │ │ +42 const Corners& corners, │ │ │ │ │ +43 const Normals& normals, │ │ │ │ │ +44 const std::string& filename); │ │ │ │ │ +54template │ │ │ │ │ +55void _p_r_i_n_t(const Projection& projection, │ │ │ │ │ +56 const Corners& corners, │ │ │ │ │ +57 const Normals& normals); │ │ │ │ │ +58 │ │ │ │ │ +59} /* namespace GridGlue */ │ │ │ │ │ +60} /* namespace Dune */ │ │ │ │ │ +61 │ │ │ │ │ +62#include "_p_r_o_j_e_c_t_i_o_n_w_r_i_t_e_r___i_m_p_l_._h_h" │ │ │ │ │ +63 │ │ │ │ │ +64#endif │ │ │ │ │ +_p_r_o_j_e_c_t_i_o_n_w_r_i_t_e_r___i_m_p_l_._h_h │ │ │ │ │ +_p_r_o_j_e_c_t_i_o_n_._h_h │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k │ │ │ │ │ -void write_glue_area_vtk(const Glue &glue, std::ostream &out) │ │ │ │ │ -DDeeffiinniittiioonn areawriter_impl.hh:84 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k │ │ │ │ │ -void write_glue_areas_vtk(const Glue &glue, const std::string &base) │ │ │ │ │ -DDeeffiinniittiioonn areawriter_impl.hh:129 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e │ │ │ │ │ +void write(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ │ +const Normals &normals, std::ostream &out) │ │ │ │ │ +write projection in VTK format │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:86 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t │ │ │ │ │ +void print(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ │ +const Normals &normals) │ │ │ │ │ +Print information about the projection to std::cout stream. │ │ │ │ │ +DDeeffiinniittiioonn projectionwriter_impl.hh:140 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053.html │ │ │ │ @@ -82,15 +82,15 @@ │ │ │ │ │ │ │ │

helper class for graphical output of grids in generic representation │ │ │ │ More...

│ │ │ │
#include <fstream>
│ │ │ │ #include <iomanip>
│ │ │ │ #include <vector>
│ │ │ │ #include <cstring>
│ │ │ │ -#include "../adapter/gridgluevtkwriter.hh"
│ │ │ │ +#include "../adapter/gridgluevtkwriter.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: codim1extractor.hh File Reference │ │ │ │ +dune-grid-glue: extractor.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,44 +72,62 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
codim1extractor.hh File Reference
│ │ │ │ +
extractor.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Grid extractor class for codim 1 subgrids. │ │ │ │ +

extractor base class │ │ │ │ More...

│ │ │ │ -
#include "extractor.hh"
│ │ │ │ -#include <array>
│ │ │ │ -#include <deque>
│ │ │ │ -#include <functional>
│ │ │ │ -#include <dune/common/deprecated.hh>
│ │ │ │ +
#include <vector>
│ │ │ │ +#include <map>
│ │ │ │ +#include <algorithm>
│ │ │ │ +#include <dune/common/exceptions.hh>
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ #include <dune/common/version.hh>
│ │ │ │ -#include <dune/grid-glue/common/crossproduct.hh>
│ │ │ │ +#include <dune/grid/common/geometry.hh>
│ │ │ │ +#include <dune/grid/common/grid.hh>
│ │ │ │ +#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ +#include <dune/geometry/multilineargeometry.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

│ │ │ │

│ │ │ │ Classes

class  Dune::GridGlue::VtkSurfaceWriter
 
│ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Classes

class  Dune::GridGlue::Codim1Extractor< GV >
class  Dune::GridGlue::Extractor< GV, cd >
 Provides codimension-independent methods for grid extraction. More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::CornerInfo
 Helpful struct holding one index for the coordinate (vertex) to which it is associated and the element's corner index;. More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::CoordinateInfo
 
struct  Dune::GridGlue::Extractor< GV, cd >::VertexInfo
 simple struct holding a vertex pointer and an index More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::ElementInfo
 simple struct holding an element seed and an index More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::SubEntityInfo
 Holds some information about an element's subentity involved in a coupling. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

Grid extractor class for codim 1 subgrids.

│ │ │ │ +

extractor base class

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,29 +2,49 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _e_x_t_r_a_c_t_o_r_s │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -codim1extractor.hh File Reference │ │ │ │ │ -Grid extractor class for codim 1 subgrids. _M_o_r_e_._._. │ │ │ │ │ -#include "_e_x_t_r_a_c_t_o_r_._h_h" │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +extractor.hh File Reference │ │ │ │ │ +extractor base class _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_c_o_m_m_o_n_/_c_r_o_s_s_p_r_o_d_u_c_t_._h_h> │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_<_ _G_V_ _> │ │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _> │ │ │ │ │ +  Provides codimension-independent methods for grid extraction. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_C_o_r_n_e_r_I_n_f_o │ │ │ │ │ +  Helpful struct holding one index for the coordinate (vertex) to which │ │ │ │ │ + it is associated and the element's corner index;. _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ +  simple struct holding a vertex pointer and an index _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ +  simple struct holding an element seed and an index _M_o_r_e_._._. │ │ │ │ │ +  │ │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ +  Holds some information about an element's subentity involved in a │ │ │ │ │ + coupling. _M_o_r_e_._._. │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Grid extractor class for codim 1 subgrids. │ │ │ │ │ +extractor base class │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: codim1extractor.hh Source File │ │ │ │ +dune-grid-glue: extractor.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,415 +74,490 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
codim1extractor.hh
│ │ │ │ +
extractor.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │
5/*
│ │ │ │ -
6 * Filename: codim1extractor.hh
│ │ │ │ +
6 * Filename: extractor.hh
│ │ │ │
7 * Version: 1.0
│ │ │ │ -
8 * Created on: Jun 23, 2009
│ │ │ │ -
9 * Author: Oliver Sander, Christian Engwer
│ │ │ │ +
8 * Created on: Oct 05, 2009
│ │ │ │ +
9 * Author: Christian Engwer
│ │ │ │
10 * ---------------------------------
│ │ │ │
11 * Project: dune-grid-glue
│ │ │ │ -
12 * Description: class for grid extractors extracting surface grids
│ │ │ │ +
12 * Description: base class for all grid extractors
│ │ │ │
13 *
│ │ │ │
14 */
│ │ │ │ -
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
│ │ │ │ -
21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
│ │ │ │ +
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH
│ │ │ │ +
21#define DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH
│ │ │ │
22
│ │ │ │ -
23#include "extractor.hh"
│ │ │ │ -
24
│ │ │ │ -
25#include <array>
│ │ │ │ -
26#include <deque>
│ │ │ │ -
27#include <functional>
│ │ │ │ -
28
│ │ │ │ -
29#include <dune/common/deprecated.hh>
│ │ │ │ -
30#include <dune/common/version.hh>
│ │ │ │ - │ │ │ │ -
32
│ │ │ │ -
33namespace Dune {
│ │ │ │ -
34
│ │ │ │ -
35 namespace GridGlue {
│ │ │ │ -
36
│ │ │ │ -
40template<typename GV>
│ │ │ │ -
│ │ │ │ -
41class Codim1Extractor : public Extractor<GV,1>
│ │ │ │ -
42{
│ │ │ │ -
43public:
│ │ │ │ -
44
│ │ │ │ -
45 /* 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 */
│ │ │ │ -
46
│ │ │ │ -
47 using Extractor<GV,1>::dimworld;
│ │ │ │ -
48 using Extractor<GV,1>::dim;
│ │ │ │ -
49 using Extractor<GV,1>::codim;
│ │ │ │ -
50 using Extractor<GV,1>::cube_corners;
│ │ │ │ - │ │ │ │ -
52
│ │ │ │ -
54 static constexpr int simplex_corners = dim;
│ │ │ │ +
23#include <vector>
│ │ │ │ +
24#include <map>
│ │ │ │ +
25#include <algorithm>
│ │ │ │ +
26#include <dune/common/exceptions.hh>
│ │ │ │ +
27#include <dune/common/fvector.hh>
│ │ │ │ +
28#include <dune/common/version.hh>
│ │ │ │ +
29#include <dune/grid/common/geometry.hh>
│ │ │ │ +
30#include <dune/grid/common/grid.hh>
│ │ │ │ +
31#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ +
32#include <dune/geometry/multilineargeometry.hh>
│ │ │ │ +
33
│ │ │ │ +
34namespace Dune {
│ │ │ │ +
35
│ │ │ │ +
36 namespace GridGlue {
│ │ │ │ +
37
│ │ │ │ +
44template<typename GV, int cd>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
46{
│ │ │ │ +
47
│ │ │ │ +
48public:
│ │ │ │ +
49
│ │ │ │ +
50 static constexpr auto dimworld = GV::dimensionworld;
│ │ │ │ +
51 static constexpr auto dim = GV::dimension;
│ │ │ │ +
52 static constexpr auto codim = cd;
│ │ │ │ +
53
│ │ │ │ +
54 static constexpr int cube_corners = 1 << (dim-codim);
│ │ │ │
55
│ │ │ │ -
56 typedef GV GridView;
│ │ │ │ -
57
│ │ │ │ -
58 typedef typename GV::Grid::ctype ctype;
│ │ │ │ -
59 typedef Dune::FieldVector<ctype, dimworld> Coords;
│ │ │ │ -
60
│ │ │ │ -
61 typedef typename GV::Traits::template Codim<dim>::Entity Vertex;
│ │ │ │ -
62 typedef typename GV::Traits::template Codim<0>::Entity Element;
│ │ │ │ -
63 typedef std::function<bool(const Element&, unsigned int subentity)> Predicate;
│ │ │ │ -
64
│ │ │ │ -
65 // import typedefs from base class
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
71
│ │ │ │ -
72public:
│ │ │ │ -
73
│ │ │ │ -
74 /* C O N S T R U C T O R S A N D D E S T R U C T O R S */
│ │ │ │ -
75
│ │ │ │ -
│ │ │ │ -
81 Codim1Extractor(const GV& gv, const Predicate& predicate)
│ │ │ │ -
82 : Extractor<GV,1>(gv)
│ │ │ │ -
83 {
│ │ │ │ -
84 std::cout << "This is Codim1Extractor on a <" << dim
│ │ │ │ -
85 << "," << dimworld << "> grid!"
│ │ │ │ -
86 << std::endl;
│ │ │ │ -
87 update(predicate);
│ │ │ │ -
88 }
│ │ │ │ -
│ │ │ │ -
89
│ │ │ │ -
90private:
│ │ │ │ -
91
│ │ │ │ -
105 void update(const Predicate& predicate);
│ │ │ │ -
106
│ │ │ │ -
107};
│ │ │ │ +
56 typedef GV GridView;
│ │ │ │ +
57 typedef typename GridView::Grid Grid;
│ │ │ │ +
58
│ │ │ │ +
59 typedef typename GV::Grid::ctype ctype;
│ │ │ │ +
60 typedef Dune::FieldVector<ctype, dimworld> Coords;
│ │ │ │ +
61 typedef Dune::FieldVector<ctype, dim> LocalCoords;
│ │ │ │ +
62
│ │ │ │ +
63 typedef typename GV::Traits::template Codim<dim>::Entity Vertex;
│ │ │ │ +
64 typedef typename Vertex::EntitySeed VertexSeed;
│ │ │ │ +
65
│ │ │ │ +
66 typedef typename GV::Traits::template Codim<0>::Entity Element;
│ │ │ │ +
67 typedef typename Element::EntitySeed ElementSeed;
│ │ │ │ +
68
│ │ │ │ +
69 typedef std::vector<unsigned int> VertexVector;
│ │ │ │ +
70
│ │ │ │ +
71#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6)
│ │ │ │ +
72 using CellMapper = MultipleCodimMultipleGeomTypeMapper<GridView>;
│ │ │ │ +
73#else
│ │ │ │ +
74 using CellMapper = MultipleCodimMultipleGeomTypeMapper<GridView, MCMGElementLayout>;
│ │ │ │ +
75#endif
│ │ │ │ +
76 // typedef typename CellMapper::IndexType IndexType;
│ │ │ │ +
77 typedef int IndexType;
│ │ │ │ +
78public:
│ │ │ │ +
79
│ │ │ │ +
80 // transformations
│ │ │ │ +
81 typedef Dune::MultiLinearGeometry<ctype, dim-codim, dimworld> Geometry;
│ │ │ │ +
82 typedef Dune::MultiLinearGeometry<ctype, dim-codim, dim> LocalGeometry;
│ │ │ │ +
83
│ │ │ │ +
84protected:
│ │ │ │ +
85 /************************** PRIVATE SUBCLASSES **********************/
│ │ │ │ +
86
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
92 {
│ │ │ │ +
93 unsigned int idx : 28;
│ │ │ │ +
94 unsigned int num : 4;
│ │ │ │ +
95 };
│ │ │ │
│ │ │ │ +
96
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
98 {
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
100 {}
│ │ │ │ +
│ │ │ │ +
101
│ │ │ │ +
│ │ │ │ +
102 CoordinateInfo(unsigned int index_, IndexType vtxindex_)
│ │ │ │ +
103 : vtxindex(vtxindex_), index(index_)
│ │ │ │ +
104 {}
│ │ │ │ +
│ │ │ │ +
105
│ │ │ │ + │ │ │ │
108
│ │ │ │ -
109
│ │ │ │ -
110template<typename GV>
│ │ │ │ -
111void Codim1Extractor<GV>::update(const Predicate& predicate)
│ │ │ │ -
112{
│ │ │ │ -
113 // free everything there is in this object
│ │ │ │ -
114 this->clear();
│ │ │ │ + │ │ │ │ +
111
│ │ │ │ +
113 unsigned int index;
│ │ │ │ +
114 };
│ │ │ │ +
│ │ │ │
115
│ │ │ │ -
116 // In this first pass iterate over all entities of codim 0.
│ │ │ │ -
117 // For each codim 1 intersection check if it is part of the boundary and if so,
│ │ │ │ -
118 // get its corner vertices, find resp. store them together with their associated index,
│ │ │ │ -
119 // and remember the indices of the boundary faces' corners.
│ │ │ │ +
│ │ │ │ + │ │ │ │
120 {
│ │ │ │ -
121 // several counter for consecutive indexing are needed
│ │ │ │ -
122 int simplex_index = 0;
│ │ │ │ -
123 int vertex_index = 0;
│ │ │ │ -
124 IndexType eindex = 0; // supress warning
│ │ │ │ -
125
│ │ │ │ -
126 // needed later for insertion into a std::set which only
│ │ │ │ -
127 // works with const references
│ │ │ │ -
128
│ │ │ │ -
129 // a temporary container where newly acquired face
│ │ │ │ -
130 // information can be stored at first
│ │ │ │ -
131 std::deque<SubEntityInfo> temp_faces;
│ │ │ │ -
132
│ │ │ │ -
133 // iterate over interior codim 0 elements on the grid
│ │ │ │ -
134 for (const auto& elmt : elements(this->gv_, Partitions::interior))
│ │ │ │ -
135 {
│ │ │ │ -
136 Dune::GeometryType gt = elmt.type();
│ │ │ │ -
137
│ │ │ │ -
138 // if some face is part of the surface add it!
│ │ │ │ -
139 if (elmt.hasBoundaryIntersections())
│ │ │ │ -
140 {
│ │ │ │ -
141 // add an entry to the element info map, the index will be set properly later,
│ │ │ │ -
142 // whereas the number of faces is already known
│ │ │ │ -
143 eindex = this->cellMapper_.index(elmt);
│ │ │ │ -
144 this->elmtInfo_.emplace(eindex, ElementInfo(simplex_index, elmt, 0));
│ │ │ │ +
│ │ │ │ +
121 VertexInfo(unsigned int idx_, const Vertex& p_) : idx(idx_), p(p_.seed())
│ │ │ │ +
122 {}
│ │ │ │ +
│ │ │ │ +
123 unsigned int idx;
│ │ │ │ + │ │ │ │ +
125 };
│ │ │ │ +
│ │ │ │ +
126
│ │ │ │ +
127
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
132 {
│ │ │ │ +
│ │ │ │ +
133 ElementInfo(unsigned int idx_, const Element& p_, unsigned int f_) : idx(idx_), faces(f_), p(p_.seed())
│ │ │ │ +
134 {}
│ │ │ │ +
│ │ │ │ +
135
│ │ │ │ +
137 unsigned int idx : 28;
│ │ │ │ +
138
│ │ │ │ +
140 unsigned int faces : 4;
│ │ │ │ +
141
│ │ │ │ + │ │ │ │ +
144 };
│ │ │ │ +
│ │ │ │
145
│ │ │ │ -
146 // now add the faces in ascending order of their indices
│ │ │ │ -
147 // (we are only talking about 1-4 faces here, so O(n^2) is ok!)
│ │ │ │ -
148 for (const auto& in : intersections(this->gv_, elmt))
│ │ │ │ -
149 {
│ │ │ │ -
150 // Stop only at selected boundary faces
│ │ │ │ -
151 if (!in.boundary() or !predicate(elmt, in.indexInInside()))
│ │ │ │ -
152 continue;
│ │ │ │ -
153
│ │ │ │ -
154 const auto& refElement = Dune::ReferenceElements<ctype, dim>::general(gt);
│ │ │ │ -
155 // get the corner count of this face
│ │ │ │ -
156 const int face_corners = refElement.size(in.indexInInside(), 1, dim);
│ │ │ │ -
157
│ │ │ │ -
158 // now we only have to care about the 3D case, i.e. a triangle face can be
│ │ │ │ -
159 // inserted directly whereas a quadrilateral face has to be divided into two triangles
│ │ │ │ -
160 switch (face_corners)
│ │ │ │ -
161 {
│ │ │ │ -
162 case 2 :
│ │ │ │ -
163 case 3:
│ │ │ │ -
164 {
│ │ │ │ -
165 // we have a simplex here
│ │ │ │ -
166
│ │ │ │ -
167 // register the additional face(s)
│ │ │ │ -
168 this->elmtInfo_.at(eindex).faces++;
│ │ │ │ -
169
│ │ │ │ -
170 // add a new face to the temporary collection
│ │ │ │ -
171 temp_faces.emplace_back(eindex, in.indexInInside(),
│ │ │ │ -
172#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ -
173 Dune::GeometryTypes::simplex(dim-codim)
│ │ │ │ -
174#else
│ │ │ │ -
175 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim)
│ │ │ │ -
176#endif
│ │ │ │ -
177 );
│ │ │ │ +
146
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
151 {
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
153 /*
│ │ │ │ +
154 * TODO: move default value of `geometryType_` to member declaration
│ │ │ │ +
155 * when removing support for older dune-geometry
│ │ │ │ +
156 */
│ │ │ │ +
157#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ +
158 : geometryType_(GeometryTypes::simplex(dim-codim))
│ │ │ │ +
159 {}
│ │ │ │ +
160#else
│ │ │ │ +
161 {
│ │ │ │ +
162 geometryType_.makeSimplex(dim-codim);
│ │ │ │ +
163 }
│ │ │ │ +
│ │ │ │ +
164#endif
│ │ │ │ +
165
│ │ │ │ +
│ │ │ │ +
166 SubEntityInfo(IndexType parent_, unsigned int num_in_parent_,
│ │ │ │ +
167 const Dune::GeometryType& geometryType)
│ │ │ │ +
168 : parent(parent_), num_in_parent(num_in_parent_), geometryType_(geometryType)
│ │ │ │ +
169 {}
│ │ │ │ +
│ │ │ │ +
170
│ │ │ │ +
│ │ │ │ +
171 unsigned int nCorners() const
│ │ │ │ +
172 {
│ │ │ │ +
173 return Dune::ReferenceElements<ctype, dim-codim>::general(geometryType_).size(dim-codim);
│ │ │ │ +
174 }
│ │ │ │ +
│ │ │ │ +
175
│ │ │ │ + │ │ │ │
178
│ │ │ │ -
179 std::vector<FieldVector<ctype,dimworld> > cornerCoords(face_corners);
│ │ │ │ -
180
│ │ │ │ -
181 // try for each of the faces vertices whether it is already inserted or not
│ │ │ │ -
182 for (int i = 0; i < face_corners; ++i)
│ │ │ │ -
183 {
│ │ │ │ -
184 // get the number of the vertex in the parent element
│ │ │ │ -
185 int vertex_number = refElement.subEntity(in.indexInInside(), 1, i, dim);
│ │ │ │ -
186
│ │ │ │ -
187 // get the vertex pointer and the index from the index set
│ │ │ │ -
188 const Vertex vertex = elmt.template subEntity<dim>(vertex_number);
│ │ │ │ -
189 cornerCoords[i] = vertex.geometry().corner(0);
│ │ │ │ -
190
│ │ │ │ -
191 IndexType vindex = this->gv_.indexSet().template index<dim>(vertex);
│ │ │ │ -
192
│ │ │ │ -
193 // remember the vertex' number in parent element's vertices
│ │ │ │ -
194 temp_faces.back().corners[i].num = vertex_number;
│ │ │ │ -
195
│ │ │ │ -
196 // if the vertex is not yet inserted in the vertex info map
│ │ │ │ -
197 // it is a new one -> it will be inserted now!
│ │ │ │ -
198 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex);
│ │ │ │ -
199 if (vimit == this->vtxInfo_.end())
│ │ │ │ -
200 {
│ │ │ │ -
201 // insert into the map
│ │ │ │ -
202 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex));
│ │ │ │ -
203 // remember the vertex as a corner of the current face in temp_faces
│ │ │ │ -
204 temp_faces.back().corners[i].idx = vertex_index;
│ │ │ │ -
205 // increase the current index
│ │ │ │ -
206 vertex_index++;
│ │ │ │ -
207 }
│ │ │ │ -
208 else
│ │ │ │ -
209 {
│ │ │ │ -
210 // only insert the index into the simplices array
│ │ │ │ -
211 temp_faces.back().corners[i].idx = vimit->second.idx;
│ │ │ │ -
212 }
│ │ │ │ -
213 }
│ │ │ │ -
214
│ │ │ │ -
215 // Now we have the correct vertices in the last entries of temp_faces, but they may
│ │ │ │ -
216 // have the wrong orientation. We want them to be oriented such that all boundary edges
│ │ │ │ -
217 // point in the counterclockwise direction. Therefore, we check the orientation of the
│ │ │ │ -
218 // new face and possibly switch the two vertices.
│ │ │ │ -
219 FieldVector<ctype,dimworld> realNormal = in.centerUnitOuterNormal();
│ │ │ │ -
220
│ │ │ │ -
221 // Compute segment normal
│ │ │ │ -
222 FieldVector<ctype,dimworld> reconstructedNormal;
│ │ │ │ -
223 if (dim==2) // boundary face is a line segment
│ │ │ │ -
224 {
│ │ │ │ -
225 reconstructedNormal[0] = cornerCoords[1][1] - cornerCoords[0][1];
│ │ │ │ -
226 reconstructedNormal[1] = cornerCoords[0][0] - cornerCoords[1][0];
│ │ │ │ -
227 } else { // boundary face is a triangle
│ │ │ │ -
228 FieldVector<ctype,dimworld> segment1 = cornerCoords[1] - cornerCoords[0];
│ │ │ │ -
229 FieldVector<ctype,dimworld> segment2 = cornerCoords[2] - cornerCoords[0];
│ │ │ │ -
230 reconstructedNormal = crossProduct(segment1, segment2);
│ │ │ │ -
231 }
│ │ │ │ -
232 reconstructedNormal /= reconstructedNormal.two_norm();
│ │ │ │ -
233
│ │ │ │ -
234 if (realNormal * reconstructedNormal < 0.0)
│ │ │ │ -
235 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]);
│ │ │ │ -
236
│ │ │ │ -
237 // now increase the current face index
│ │ │ │ -
238 simplex_index++;
│ │ │ │ -
239 break;
│ │ │ │ -
240 }
│ │ │ │ -
241 case 4 :
│ │ │ │ -
242 {
│ │ │ │ -
243 assert(dim == 3 && cube_corners == 4);
│ │ │ │ -
244 // we have a quadrilateral here
│ │ │ │ -
245 std::array<unsigned int, 4> vertex_indices;
│ │ │ │ -
246 std::array<unsigned int, 4> vertex_numbers;
│ │ │ │ -
247
│ │ │ │ -
248 // register the additional face(s) (2 simplices)
│ │ │ │ -
249 this->elmtInfo_.at(eindex).faces += 2;
│ │ │ │ -
250
│ │ │ │ -
251 std::array<FieldVector<ctype,dimworld>, 4> cornerCoords;
│ │ │ │ -
252
│ │ │ │ -
253 // get the vertex pointers for the quadrilateral's corner vertices
│ │ │ │ -
254 // and try for each of them whether it is already inserted or not
│ │ │ │ -
255 for (int i = 0; i < cube_corners; ++i)
│ │ │ │ -
256 {
│ │ │ │ -
257 // get the number of the vertex in the parent element
│ │ │ │ -
258 vertex_numbers[i] = refElement.subEntity(in.indexInInside(), 1, i, dim);
│ │ │ │ -
259
│ │ │ │ -
260 // get the vertex pointer and the index from the index set
│ │ │ │ -
261 const Vertex vertex = elmt.template subEntity<dim>(vertex_numbers[i]);
│ │ │ │ -
262 cornerCoords[i] = vertex.geometry().corner(0);
│ │ │ │ -
263
│ │ │ │ -
264 IndexType vindex = this->gv_.indexSet().template index<dim>(vertex);
│ │ │ │ -
265
│ │ │ │ -
266 // if the vertex is not yet inserted in the vertex info map
│ │ │ │ -
267 // it is a new one -> it will be inserted now!
│ │ │ │ -
268 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex);
│ │ │ │ -
269 if (vimit == this->vtxInfo_.end())
│ │ │ │ -
270 {
│ │ │ │ -
271 // insert into the map
│ │ │ │ -
272 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex));
│ │ │ │ -
273 // remember this vertex' index
│ │ │ │ -
274 vertex_indices[i] = vertex_index;
│ │ │ │ -
275 // increase the current index
│ │ │ │ -
276 vertex_index++;
│ │ │ │ -
277 }
│ │ │ │ -
278 else
│ │ │ │ -
279 {
│ │ │ │ -
280 // only remember the vertex' index
│ │ │ │ -
281 vertex_indices[i] = vimit->second.idx;
│ │ │ │ -
282 }
│ │ │ │ -
283 }
│ │ │ │ -
284
│ │ │ │ -
285 // now introduce the two triangles subdividing the quadrilateral
│ │ │ │ -
286 // ATTENTION: the order of vertices given by "orientedSubface" corresponds to the order
│ │ │ │ -
287 // of a Dune quadrilateral, i.e. the triangles are given by 0 1 2 and 3 2 1
│ │ │ │ -
288
│ │ │ │ -
289 // add a new face to the temporary collection for the first tri
│ │ │ │ -
290 temp_faces.emplace_back(eindex, in.indexInInside(),
│ │ │ │ -
291#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ -
292 Dune::GeometryTypes::simplex(dim-codim)
│ │ │ │ -
293#else
│ │ │ │ -
294 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim)
│ │ │ │ -
295#endif
│ │ │ │ -
296 );
│ │ │ │ -
297 temp_faces.back().corners[0].idx = vertex_indices[0];
│ │ │ │ -
298 temp_faces.back().corners[1].idx = vertex_indices[1];
│ │ │ │ -
299 temp_faces.back().corners[2].idx = vertex_indices[2];
│ │ │ │ -
300 // remember the vertices' numbers in parent element's vertices
│ │ │ │ -
301 temp_faces.back().corners[0].num = vertex_numbers[0];
│ │ │ │ -
302 temp_faces.back().corners[1].num = vertex_numbers[1];
│ │ │ │ -
303 temp_faces.back().corners[2].num = vertex_numbers[2];
│ │ │ │ -
304
│ │ │ │ -
305 // Now we have the correct vertices in the last entries of temp_faces, but they may
│ │ │ │ -
306 // have the wrong orientation. We want the triangle vertices on counterclockwise order,
│ │ │ │ -
307 // when viewed from the outside of the grid. Therefore, we check the orientation of the
│ │ │ │ -
308 // new face and possibly switch two vertices.
│ │ │ │ -
309 FieldVector<ctype,dimworld> realNormal = in.centerUnitOuterNormal();
│ │ │ │ -
310
│ │ │ │ -
311 // Compute segment normal
│ │ │ │ -
312 FieldVector<ctype,dimworld> reconstructedNormal = crossProduct(cornerCoords[1] - cornerCoords[0],
│ │ │ │ -
313 cornerCoords[2] - cornerCoords[0]);
│ │ │ │ -
314 reconstructedNormal /= reconstructedNormal.two_norm();
│ │ │ │ -
315
│ │ │ │ -
316 if (realNormal * reconstructedNormal < 0.0)
│ │ │ │ -
317 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]);
│ │ │ │ -
318
│ │ │ │ -
319
│ │ │ │ -
320 // add a new face to the temporary collection for the second tri
│ │ │ │ -
321 temp_faces.emplace_back(eindex, in.indexInInside(),
│ │ │ │ -
322#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ -
323 Dune::GeometryTypes::simplex(dim-codim)
│ │ │ │ -
324#else
│ │ │ │ -
325 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim)
│ │ │ │ -
326#endif
│ │ │ │ -
327 );
│ │ │ │ -
328 temp_faces.back().corners[0].idx = vertex_indices[3];
│ │ │ │ -
329 temp_faces.back().corners[1].idx = vertex_indices[2];
│ │ │ │ -
330 temp_faces.back().corners[2].idx = vertex_indices[1];
│ │ │ │ -
331 // remember the vertices' numbers in parent element's vertices
│ │ │ │ -
332 temp_faces.back().corners[0].num = vertex_numbers[3];
│ │ │ │ -
333 temp_faces.back().corners[1].num = vertex_numbers[2];
│ │ │ │ -
334 temp_faces.back().corners[2].num = vertex_numbers[1];
│ │ │ │ -
335
│ │ │ │ -
336 // Now we have the correct vertices in the last entries of temp_faces, but they may
│ │ │ │ -
337 // have the wrong orientation. We want the triangle vertices on counterclockwise order,
│ │ │ │ -
338 // when viewed from the outside of the grid. Therefore, we check the orientation of the
│ │ │ │ -
339 // new face and possibly switch two vertices.
│ │ │ │ -
340 // Compute segment normal
│ │ │ │ -
341 reconstructedNormal = crossProduct(cornerCoords[2] - cornerCoords[3],
│ │ │ │ -
342 cornerCoords[1] - cornerCoords[3]);
│ │ │ │ -
343 reconstructedNormal /= reconstructedNormal.two_norm();
│ │ │ │ -
344
│ │ │ │ -
345 if (realNormal * reconstructedNormal < 0.0)
│ │ │ │ -
346 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]);
│ │ │ │ -
347
│ │ │ │ -
348 simplex_index+=2;
│ │ │ │ -
349 break;
│ │ │ │ -
350 }
│ │ │ │ -
351 default :
│ │ │ │ -
352 DUNE_THROW(Dune::NotImplemented, "the extractor does only work for triangle and quadrilateral faces (" << face_corners << " corners)");
│ │ │ │ -
353 break;
│ │ │ │ -
354 }
│ │ │ │ -
355 } // end loop over found surface parts
│ │ │ │ -
356 }
│ │ │ │ -
357 } // end loop over elements
│ │ │ │ -
358
│ │ │ │ -
359 std::cout << "added " << simplex_index << " subfaces\n";
│ │ │ │ -
360
│ │ │ │ -
361 // allocate the array for the face specific information...
│ │ │ │ -
362 this->subEntities_.resize(simplex_index);
│ │ │ │ -
363 // ...and fill in the data from the temporary containers
│ │ │ │ -
364 copy(temp_faces.begin(), temp_faces.end(), this->subEntities_.begin());
│ │ │ │ -
365 }
│ │ │ │ -
366
│ │ │ │ +
180 unsigned int num_in_parent : 3;
│ │ │ │ +
181
│ │ │ │ +
183 Dune::GeometryType geometryType_;
│ │ │ │ +
184
│ │ │ │ +
191 CornerInfo corners[cube_corners]; // sim = numer of vertices in a simplex
│ │ │ │ +
192 };
│ │ │ │ +
│ │ │ │ +
193
│ │ │ │ +
194
│ │ │ │ +
195 typedef std::map<IndexType, ElementInfo> ElementInfoMap;
│ │ │ │ +
196 typedef std::map<IndexType, VertexInfo> VertexInfoMap;
│ │ │ │ +
197
│ │ │ │ +
198 /************************** MEMBER VARIABLES ************************/
│ │ │ │ +
199
│ │ │ │ + │ │ │ │ +
202
│ │ │ │ +
203 /* Geometrical and Topological Information */
│ │ │ │ +
204
│ │ │ │ +
206 std::vector<CoordinateInfo> coords_;
│ │ │ │ +
207
│ │ │ │ +
209 std::vector<SubEntityInfo> subEntities_;
│ │ │ │ +
210
│ │ │ │ + │ │ │ │ +
217
│ │ │ │ + │ │ │ │ +
224
│ │ │ │ + │ │ │ │ +
226
│ │ │ │ +
227public:
│ │ │ │ +
228
│ │ │ │ +
229 /* C O N S T R U C T O R S A N D D E S T R U C T O R S */
│ │ │ │ +
230
│ │ │ │ +
│ │ │ │ +
235 Extractor(const GV& gv)
│ │ │ │ +
236 : gv_(gv)
│ │ │ │ +
237#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6)
│ │ │ │ +
238 , cellMapper_(gv, mcmgElementLayout())
│ │ │ │ +
239#else
│ │ │ │ +
240 , cellMapper_(gv)
│ │ │ │ +
241#endif
│ │ │ │ +
242 {}
│ │ │ │ +
│ │ │ │ +
243
│ │ │ │ +
244 /* F U N C T I O N A L I T Y */
│ │ │ │ +
245
│ │ │ │ +
│ │ │ │ +
249 void clear()
│ │ │ │ +
250 {
│ │ │ │ +
251 // this is an inofficial way on how to free the memory allocated
│ │ │ │ +
252 // by a std::vector
│ │ │ │ +
253 {
│ │ │ │ +
254 std::vector<CoordinateInfo> dummy;
│ │ │ │ +
255 coords_.swap(dummy);
│ │ │ │ +
256 }
│ │ │ │ +
257 {
│ │ │ │ +
258 std::vector<SubEntityInfo> dummy;
│ │ │ │ +
259 subEntities_.swap(dummy);
│ │ │ │ +
260 }
│ │ │ │ +
261
│ │ │ │ +
262 // ...then clear the maps themselves, too
│ │ │ │ +
263 vtxInfo_.clear();
│ │ │ │ +
264 elmtInfo_.clear();
│ │ │ │ +
265 }
│ │ │ │ +
│ │ │ │ +
266
│ │ │ │ +
267
│ │ │ │ +
268 /* G E T T E R S */
│ │ │ │ +
269
│ │ │ │ +
│ │ │ │ +
275 void getCoords(std::vector<Dune::FieldVector<ctype, dimworld> >& coords) const
│ │ │ │ +
276 {
│ │ │ │ +
277 coords.resize(coords_.size());
│ │ │ │ +
278 for (unsigned int i = 0; i < coords_.size(); ++i)
│ │ │ │ +
279 coords[i] = coords_[i].coord;
│ │ │ │ +
280 }
│ │ │ │ +
│ │ │ │ +
281
│ │ │ │ +
282
│ │ │ │ +
│ │ │ │ +
287 unsigned int nCoords() const
│ │ │ │ +
288 {
│ │ │ │ +
289 return coords_.size();
│ │ │ │ +
290 }
│ │ │ │ +
│ │ │ │ +
291
│ │ │ │ +
│ │ │ │ +
293 void getGeometryTypes(std::vector<Dune::GeometryType>& geometryTypes) const
│ │ │ │ +
294 {
│ │ │ │ +
295 geometryTypes.resize(subEntities_.size());
│ │ │ │ +
296 for (size_t i=0; i<subEntities_.size(); i++)
│ │ │ │ +
297 geometryTypes[i] = subEntities_[i].geometryType_;
│ │ │ │ +
298 }
│ │ │ │ +
│ │ │ │ +
299
│ │ │ │ +
300
│ │ │ │ +
│ │ │ │ +
304 void getFaces(std::vector<VertexVector>& faces) const
│ │ │ │ +
305 {
│ │ │ │ +
306 faces.resize(subEntities_.size());
│ │ │ │ +
307 for (unsigned int i = 0; i < subEntities_.size(); ++i) {
│ │ │ │ +
308 faces[i].resize(subEntities_[i].nCorners());
│ │ │ │ +
309 for (unsigned int j = 0; j < subEntities_[i].nCorners(); ++j)
│ │ │ │ +
310 faces[i][j] = subEntities_[i].corners[j].idx;
│ │ │ │ +
311 }
│ │ │ │ +
312 }
│ │ │ │ +
│ │ │ │ +
313
│ │ │ │ +
314
│ │ │ │ +
│ │ │ │ +
323 bool faceIndices(const Element& e, int& first, int& count) const
│ │ │ │ +
324 {
│ │ │ │ +
325 typename ElementInfoMap::const_iterator it =
│ │ │ │ +
326 elmtInfo_.find(cellMapper_.map(e));
│ │ │ │ +
327 if (it == elmtInfo_.end())
│ │ │ │ +
328 {
│ │ │ │ +
329 first = -1;
│ │ │ │ +
330 count = 0;
│ │ │ │ +
331 return false;
│ │ │ │ +
332 }
│ │ │ │ +
333 // the iterator is valid, fill the out params
│ │ │ │ +
334 first = it->second.idx;
│ │ │ │ +
335 count = it->second.faces;
│ │ │ │ +
336 return true;
│ │ │ │ +
337 }
│ │ │ │ +
│ │ │ │ +
338
│ │ │ │ +
339
│ │ │ │ +
│ │ │ │ +
345 int indexInInside(unsigned int index) const
│ │ │ │ +
346 {
│ │ │ │ +
347 return index < subEntities_.size() ? subEntities_[index].num_in_parent : -1;
│ │ │ │ +
348 }
│ │ │ │ +
│ │ │ │ +
349
│ │ │ │ +
350 // /**
│ │ │ │ +
351 // * @brief tests that a given entry in the extraction set does have local couplings
│ │ │ │ +
352 // * @todo parallel interface
│ │ │ │ +
353 // */
│ │ │ │ +
354 // bool contains (unsigned int global, unsigned int & local) const
│ │ │ │ +
355 // {
│ │ │ │ +
356 // local = global;
│ │ │ │ +
357 // return true;
│ │ │ │ +
358 // }
│ │ │ │ +
359
│ │ │ │ +
│ │ │ │ +
363 const GridView & gridView() const
│ │ │ │ +
364 {
│ │ │ │ +
365 return gv_;
│ │ │ │ +
366 }
│ │ │ │ +
│ │ │ │
367
│ │ │ │ -
368 // now first write the array with the coordinates...
│ │ │ │ -
369 this->coords_.resize(this->vtxInfo_.size());
│ │ │ │ -
370 for (const auto& vinfo : this->vtxInfo_)
│ │ │ │ -
371 {
│ │ │ │ -
372 // get a pointer to the associated info object
│ │ │ │ -
373 CoordinateInfo* current = &this->coords_[vinfo.second.idx];
│ │ │ │ -
374 // store this coordinates index // NEEDED?
│ │ │ │ -
375 current->index = vinfo.second.idx;
│ │ │ │ -
376 // store the vertex' index for the index2vertex mapping
│ │ │ │ -
377 current->vtxindex = vinfo.first;
│ │ │ │ -
378 // store the vertex' coordinates under the associated index
│ │ │ │ -
379 // in the coordinates array
│ │ │ │ -
380 const auto vtx = this->grid().entity(vinfo.second.p);
│ │ │ │ -
381 current->coord = vtx.geometry().corner(0);
│ │ │ │ -
382 }
│ │ │ │ -
383
│ │ │ │ -
384}
│ │ │ │ -
385
│ │ │ │ -
386} // namespace GridGlue
│ │ │ │ +
│ │ │ │ +
368 const Grid& grid() const
│ │ │ │ +
369 {
│ │ │ │ +
370 return gv_.grid();
│ │ │ │ +
371 }
│ │ │ │ +
│ │ │ │ +
372
│ │ │ │ +
379 Element
│ │ │ │ +
│ │ │ │ +
380 element(unsigned int index) const
│ │ │ │ +
381 {
│ │ │ │ +
382 if (index >= subEntities_.size())
│ │ │ │ +
383 DUNE_THROW(Dune::GridError, "invalid face index");
│ │ │ │ +
384 const ElementSeed seed = elmtInfo_.at(subEntities_[index].parent).p;
│ │ │ │ +
385 return grid().entity(seed);
│ │ │ │ +
386 }
│ │ │ │ +
│ │ │ │
387
│ │ │ │ -
388} // namespace Dune
│ │ │ │ -
389
│ │ │ │ -
390#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
│ │ │ │ - │ │ │ │ -
extractor base class
│ │ │ │ +
388#if 1
│ │ │ │ +
395 Vertex
│ │ │ │ +
│ │ │ │ +
396 vertex(unsigned int index) const
│ │ │ │ +
397 {
│ │ │ │ +
398 if (index >= coords_.size())
│ │ │ │ +
399 DUNE_THROW(Dune::GridError, "invalid coordinate index");
│ │ │ │ +
400 const VertexSeed seed = vtxInfo_.at(coords_[index].vtxindex).p;
│ │ │ │ +
401 return grid().entity(seed);
│ │ │ │ +
402 }
│ │ │ │ +
│ │ │ │ +
403#endif
│ │ │ │ +
404
│ │ │ │ +
│ │ │ │ +
406 Geometry geometry(unsigned int index) const;
│ │ │ │ +
407
│ │ │ │ +
│ │ │ │ +
409 LocalGeometry geometryLocal(unsigned int index) const;
│ │ │ │ +
410
│ │ │ │ +
411};
│ │ │ │ +
412
│ │ │ │ +
413
│ │ │ │ +
415template<typename GV, int cd>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
417{
│ │ │ │ +
418 std::vector<Coords> corners(subEntities_[index].nCorners());
│ │ │ │ +
419 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i)
│ │ │ │ +
420 corners[i] = coords_[subEntities_[index].corners[i].idx].coord;
│ │ │ │ +
421
│ │ │ │ +
422 return Geometry(subEntities_[index].geometryType_, corners);
│ │ │ │ +
423}
│ │ │ │ +
│ │ │ │ +
424
│ │ │ │ +
425
│ │ │ │ +
427template<typename GV, int cd>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
429{
│ │ │ │ +
430 std::vector<LocalCoords> corners(subEntities_[index].nCorners());
│ │ │ │ +
431
│ │ │ │ +
432 // get face info
│ │ │ │ +
433 const SubEntityInfo & face = subEntities_[index];
│ │ │ │ +
434 Dune::GeometryType facetype = subEntities_[index].geometryType_;
│ │ │ │ +
435
│ │ │ │ +
436 // get reference element
│ │ │ │ +
437 const auto elmtseed = elmtInfo_.at(face.parent).p;
│ │ │ │ +
438 const auto elmt = grid().entity(elmtseed);
│ │ │ │ +
439 const Dune::GeometryType celltype = elmt.type();
│ │ │ │ +
440 const auto& re = Dune::ReferenceElements<ctype, dim>::general(celltype);
│ │ │ │ +
441 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i)
│ │ │ │ +
442 corners[i] = re.position(face.corners[i].num,dim);
│ │ │ │ +
443
│ │ │ │ +
444 return LocalGeometry(facetype, corners);
│ │ │ │ +
445}
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
446
│ │ │ │ +
447} // namespace GridGlue
│ │ │ │ +
448
│ │ │ │ +
449} // namespace Dune
│ │ │ │ +
450
│ │ │ │ +
451#endif // DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH
│ │ │ │ +
│ │ │ │ +
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ -
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
│ │ │ │ -
Definition codim1extractor.hh:42
│ │ │ │ -
Extractor< GV, 1 >::IndexType IndexType
Definition codim1extractor.hh:51
│ │ │ │ -
GV GridView
Definition codim1extractor.hh:56
│ │ │ │ -
GV::Traits::template Codim< 0 >::Entity Element
Definition codim1extractor.hh:62
│ │ │ │ -
Dune::FieldVector< ctype, dimworld > Coords
Definition codim1extractor.hh:59
│ │ │ │ -
GV::Grid::ctype ctype
Definition codim1extractor.hh:58
│ │ │ │ -
Codim1Extractor(const GV &gv, const Predicate &predicate)
Constructor.
Definition codim1extractor.hh:81
│ │ │ │ -
static constexpr int simplex_corners
compile time number of corners of surface simplices
Definition codim1extractor.hh:54
│ │ │ │ -
Extractor< GV, 1 >::VertexInfo VertexInfo
Definition codim1extractor.hh:68
│ │ │ │ -
Extractor< GV, 1 >::CoordinateInfo CoordinateInfo
Definition codim1extractor.hh:69
│ │ │ │ -
Extractor< GV, 1 >::ElementInfo ElementInfo
Definition codim1extractor.hh:67
│ │ │ │ -
Extractor< GV, 1 >::SubEntityInfo SubEntityInfo
Definition codim1extractor.hh:66
│ │ │ │ -
Extractor< GV, 1 >::VertexInfoMap VertexInfoMap
Definition codim1extractor.hh:70
│ │ │ │ -
std::function< bool(const Element &, unsigned int subentity)> Predicate
Definition codim1extractor.hh:63
│ │ │ │ -
GV::Traits::template Codim< dim >::Entity Vertex
Definition codim1extractor.hh:61
│ │ │ │
Provides codimension-independent methods for grid extraction.
Definition extractor.hh:46
│ │ │ │ -
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ +
GV::Traits::template Codim< dim >::Entity Vertex
Definition extractor.hh:63
│ │ │ │ +
VertexInfoMap vtxInfo_
a map enabling faster access to vertices and coordinates
Definition extractor.hh:216
│ │ │ │ +
const Grid & grid() const
Definition extractor.hh:368
│ │ │ │ +
MultipleCodimMultipleGeomTypeMapper< GridView, MCMGElementLayout > CellMapper
Definition extractor.hh:74
│ │ │ │ +
Element element(unsigned int index) const
gets the parent element for a given face index, throws an exception if index not valid
Definition extractor.hh:380
│ │ │ │ +
int indexInInside(unsigned int index) const
gets the number face in the parent element
Definition extractor.hh:345
│ │ │ │ +
Dune::FieldVector< ctype, dim > LocalCoords
Definition extractor.hh:61
│ │ │ │ +
LocalGeometry geometryLocal(unsigned int index) const
Get geometry of the extracted face in element coordinates.
Definition extractor.hh:428
│ │ │ │ +
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ +
Dune::MultiLinearGeometry< ctype, dim-codim, dimworld > Geometry
Definition extractor.hh:81
│ │ │ │
int IndexType
Definition extractor.hh:77
│ │ │ │ -
static constexpr int cube_corners
Definition extractor.hh:54
│ │ │ │ -
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │ +
std::vector< CoordinateInfo > coords_
all information about the corner vertices of the extracted
Definition extractor.hh:206
│ │ │ │ +
GV::Traits::template Codim< 0 >::Entity Element
Definition extractor.hh:66
│ │ │ │ +
const GridView & gridView() const
give access to the Dune::GridView where this Patch belongs to
Definition extractor.hh:363
│ │ │ │ +
void getFaces(std::vector< VertexVector > &faces) const
Get the corners of the extracted subentities.
Definition extractor.hh:304
│ │ │ │ +
std::vector< unsigned int > VertexVector
Definition extractor.hh:69
│ │ │ │ +
const GridView gv_
the grid object to extract the surface from
Definition extractor.hh:201
│ │ │ │ +
std::vector< SubEntityInfo > subEntities_
all information about the extracted subEntities
Definition extractor.hh:209
│ │ │ │ +
static constexpr int cube_corners
Definition extractor.hh:54
│ │ │ │ +
Vertex vertex(unsigned int index) const
gets the vertex for a given coordinate index throws an exception if index not valid
Definition extractor.hh:396
│ │ │ │ +
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │ +
Dune::FieldVector< ctype, dimworld > Coords
Definition extractor.hh:60
│ │ │ │ +
void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const
Get the list of geometry types.
Definition extractor.hh:293
│ │ │ │
std::map< IndexType, VertexInfo > VertexInfoMap
Definition extractor.hh:196
│ │ │ │ -
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │ +
GridView::Grid Grid
Definition extractor.hh:57
│ │ │ │ +
bool faceIndices(const Element &e, int &first, int &count) const
gets index of first subentity as well as the total number of subentities that were extracted from thi...
Definition extractor.hh:323
│ │ │ │ +
Geometry geometry(unsigned int index) const
Get world geometry of the extracted face.
Definition extractor.hh:416
│ │ │ │ +
GV GridView
Definition extractor.hh:56
│ │ │ │ +
unsigned int nCoords() const
getter for the count of coordinates
Definition extractor.hh:287
│ │ │ │ +
GV::Grid::ctype ctype
Definition extractor.hh:59
│ │ │ │ +
std::map< IndexType, ElementInfo > ElementInfoMap
Definition extractor.hh:195
│ │ │ │ +
Extractor(const GV &gv)
Constructor.
Definition extractor.hh:235
│ │ │ │ +
void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) const
getter for the coordinates array
Definition extractor.hh:275
│ │ │ │ +
CellMapper cellMapper_
Definition extractor.hh:225
│ │ │ │ +
Element::EntitySeed ElementSeed
Definition extractor.hh:67
│ │ │ │ +
Vertex::EntitySeed VertexSeed
Definition extractor.hh:64
│ │ │ │ +
ElementInfoMap elmtInfo_
a map enabling faster access to elements and faces
Definition extractor.hh:223
│ │ │ │ +
void clear()
delete everything build up so far and free the memory
Definition extractor.hh:249
│ │ │ │ +
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │ +
Dune::MultiLinearGeometry< ctype, dim-codim, dim > LocalGeometry
Definition extractor.hh:82
│ │ │ │ +
Helpful struct holding one index for the coordinate (vertex) to which it is associated and the elemen...
Definition extractor.hh:92
│ │ │ │ +
unsigned int idx
index of the vertex
Definition extractor.hh:93
│ │ │ │ +
unsigned int num
element corner
Definition extractor.hh:94
│ │ │ │ │ │ │ │ +
CoordinateInfo(unsigned int index_, IndexType vtxindex_)
Definition extractor.hh:102
│ │ │ │ +
unsigned int index
the index of this coordinate (in internal storage scheme) // NEEDED??
Definition extractor.hh:113
│ │ │ │ +
CoordinateInfo()
Definition extractor.hh:99
│ │ │ │ +
Coords coord
the coordinate
Definition extractor.hh:110
│ │ │ │ +
IndexType vtxindex
the index of the parent element (from index set)
Definition extractor.hh:107
│ │ │ │
simple struct holding a vertex pointer and an index
Definition extractor.hh:120
│ │ │ │ +
unsigned int idx
Definition extractor.hh:123
│ │ │ │ +
VertexInfo(unsigned int idx_, const Vertex &p_)
Definition extractor.hh:121
│ │ │ │ +
VertexSeed p
Definition extractor.hh:124
│ │ │ │
simple struct holding an element seed and an index
Definition extractor.hh:132
│ │ │ │ +
unsigned int idx
the index of this element's first face in the internal list of extracted faces
Definition extractor.hh:137
│ │ │ │ +
unsigned int faces
the number of extracted faces for this element
Definition extractor.hh:140
│ │ │ │ +
ElementInfo(unsigned int idx_, const Element &p_, unsigned int f_)
Definition extractor.hh:133
│ │ │ │ +
ElementSeed p
the entity seed for the element
Definition extractor.hh:143
│ │ │ │
Holds some information about an element's subentity involved in a coupling.
Definition extractor.hh:151
│ │ │ │ +
unsigned int nCorners() const
Definition extractor.hh:171
│ │ │ │ +
CornerInfo corners[cube_corners]
the corner indices plus the numbers of the vertices in the parent element
Definition extractor.hh:191
│ │ │ │ +
IndexType parent
the index of the parent element (from index set)
Definition extractor.hh:177
│ │ │ │ +
SubEntityInfo(IndexType parent_, unsigned int num_in_parent_, const Dune::GeometryType &geometryType)
Definition extractor.hh:166
│ │ │ │ +
unsigned int num_in_parent
the number of the face in the parent element
Definition extractor.hh:180
│ │ │ │ +
Dune::GeometryType geometryType_
The GeometryType of the subentity.
Definition extractor.hh:183
│ │ │ │ +
SubEntityInfo()
Definition extractor.hh:152
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,485 +1,607 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _e_x_t_r_a_c_t_o_r_s │ │ │ │ │ -codim1extractor.hh │ │ │ │ │ +extractor.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ 5/* │ │ │ │ │ -6 * Filename: codim1extractor.hh │ │ │ │ │ +6 * Filename: extractor.hh │ │ │ │ │ 7 * Version: 1.0 │ │ │ │ │ -8 * Created on: Jun 23, 2009 │ │ │ │ │ -9 * Author: Oliver Sander, Christian Engwer │ │ │ │ │ +8 * Created on: Oct 05, 2009 │ │ │ │ │ +9 * Author: Christian Engwer │ │ │ │ │ 10 * --------------------------------- │ │ │ │ │ 11 * Project: dune-grid-glue │ │ │ │ │ -12 * Description: class for grid extractors extracting surface grids │ │ │ │ │ +12 * Description: base class for all grid extractors │ │ │ │ │ 13 * │ │ │ │ │ 14 */ │ │ │ │ │ -20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH │ │ │ │ │ -21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH │ │ │ │ │ +20#ifndef DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH │ │ │ │ │ +21#define DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH │ │ │ │ │ 22 │ │ │ │ │ -23#include "_e_x_t_r_a_c_t_o_r_._h_h" │ │ │ │ │ -24 │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27#include │ │ │ │ │ -28 │ │ │ │ │ -29#include │ │ │ │ │ -30#include │ │ │ │ │ -31#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_c_o_m_m_o_n_/_c_r_o_s_s_p_r_o_d_u_c_t_._h_h> │ │ │ │ │ -32 │ │ │ │ │ -33namespace _D_u_n_e { │ │ │ │ │ -34 │ │ │ │ │ -35 namespace GridGlue { │ │ │ │ │ -36 │ │ │ │ │ -40template │ │ │ │ │ -_4_1class _C_o_d_i_m_1_E_x_t_r_a_c_t_o_r : public _E_x_t_r_a_c_t_o_r │ │ │ │ │ -42{ │ │ │ │ │ -43public: │ │ │ │ │ -44 │ │ │ │ │ -45 /* 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 */ │ │ │ │ │ -46 │ │ │ │ │ -47 using _E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d; │ │ │ │ │ -48 using _E_x_t_r_a_c_t_o_r_:_:_d_i_m; │ │ │ │ │ -49 using _E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m; │ │ │ │ │ -50 using _E_x_t_r_a_c_t_o_r_:_:_c_u_b_e___c_o_r_n_e_r_s; │ │ │ │ │ -_5_1 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_1_>_:_:_I_n_d_e_x_T_y_p_e _I_n_d_e_x_T_y_p_e; │ │ │ │ │ -52 │ │ │ │ │ -_5_4 static constexpr int _s_i_m_p_l_e_x___c_o_r_n_e_r_s = _d_i_m; │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26#include │ │ │ │ │ +27#include │ │ │ │ │ +28#include │ │ │ │ │ +29#include │ │ │ │ │ +30#include │ │ │ │ │ +31#include │ │ │ │ │ +32#include │ │ │ │ │ +33 │ │ │ │ │ +34namespace _D_u_n_e { │ │ │ │ │ +35 │ │ │ │ │ +36 namespace GridGlue { │ │ │ │ │ +37 │ │ │ │ │ +44template │ │ │ │ │ +_4_5class _E_x_t_r_a_c_t_o_r │ │ │ │ │ +46{ │ │ │ │ │ +47 │ │ │ │ │ +48public: │ │ │ │ │ +49 │ │ │ │ │ +_5_0 static constexpr auto _d_i_m_w_o_r_l_d = GV::dimensionworld; │ │ │ │ │ +_5_1 static constexpr auto _d_i_m = GV::dimension; │ │ │ │ │ +_5_2 static constexpr auto _c_o_d_i_m = cd; │ │ │ │ │ +53 │ │ │ │ │ +_5_4 static constexpr int _c_u_b_e___c_o_r_n_e_r_s = 1 << (_d_i_m-_c_o_d_i_m); │ │ │ │ │ 55 │ │ │ │ │ _5_6 typedef GV _G_r_i_d_V_i_e_w; │ │ │ │ │ -57 │ │ │ │ │ -_5_8 typedef typename GV::Grid::ctype _c_t_y_p_e; │ │ │ │ │ -_5_9 typedef Dune::FieldVector _C_o_o_r_d_s; │ │ │ │ │ -60 │ │ │ │ │ -_6_1 typedef typename GV::Traits::template Codim::Entity _V_e_r_t_e_x; │ │ │ │ │ -_6_2 typedef typename GV::Traits::template Codim<0>::Entity _E_l_e_m_e_n_t; │ │ │ │ │ -_6_3 typedef std::function │ │ │ │ │ -_P_r_e_d_i_c_a_t_e; │ │ │ │ │ -64 │ │ │ │ │ -65 // import typedefs from base class │ │ │ │ │ -_6_6 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_1_>_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o _S_u_b_E_n_t_i_t_y_I_n_f_o; │ │ │ │ │ -_6_7 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_1_>_:_:_E_l_e_m_e_n_t_I_n_f_o _E_l_e_m_e_n_t_I_n_f_o; │ │ │ │ │ -_6_8 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_1_>_:_:_V_e_r_t_e_x_I_n_f_o _V_e_r_t_e_x_I_n_f_o; │ │ │ │ │ -_6_9 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_1_>_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o _C_o_o_r_d_i_n_a_t_e_I_n_f_o; │ │ │ │ │ -_7_0 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_1_>_:_:_V_e_r_t_e_x_I_n_f_o_M_a_p _V_e_r_t_e_x_I_n_f_o_M_a_p; │ │ │ │ │ -71 │ │ │ │ │ -72public: │ │ │ │ │ -73 │ │ │ │ │ -74 /* C O N S T R U C T O R S A N D D E S T R U C T O R S */ │ │ │ │ │ -75 │ │ │ │ │ -_8_1 _C_o_d_i_m_1_E_x_t_r_a_c_t_o_r(const GV& gv, const _P_r_e_d_i_c_a_t_e& predicate) │ │ │ │ │ -82 : _E_x_t_r_a_c_t_o_r(gv) │ │ │ │ │ -83 { │ │ │ │ │ -84 std::cout << "This is Codim1Extractor on a <" << _d_i_m │ │ │ │ │ -85 << "," << _d_i_m_w_o_r_l_d << "> grid!" │ │ │ │ │ -86 << std::endl; │ │ │ │ │ -87 update(predicate); │ │ │ │ │ -88 } │ │ │ │ │ -89 │ │ │ │ │ -90private: │ │ │ │ │ -91 │ │ │ │ │ -105 void update(const _P_r_e_d_i_c_a_t_e& predicate); │ │ │ │ │ -106 │ │ │ │ │ -107}; │ │ │ │ │ +_5_7 typedef typename GridView::Grid _G_r_i_d; │ │ │ │ │ +58 │ │ │ │ │ +_5_9 typedef typename GV::Grid::ctype _c_t_y_p_e; │ │ │ │ │ +_6_0 typedef Dune::FieldVector _C_o_o_r_d_s; │ │ │ │ │ +_6_1 typedef Dune::FieldVector _L_o_c_a_l_C_o_o_r_d_s; │ │ │ │ │ +62 │ │ │ │ │ +_6_3 typedef typename GV::Traits::template Codim::Entity _V_e_r_t_e_x; │ │ │ │ │ +_6_4 typedef typename Vertex::EntitySeed _V_e_r_t_e_x_S_e_e_d; │ │ │ │ │ +65 │ │ │ │ │ +_6_6 typedef typename GV::Traits::template Codim<0>::Entity _E_l_e_m_e_n_t; │ │ │ │ │ +_6_7 typedef typename Element::EntitySeed _E_l_e_m_e_n_t_S_e_e_d; │ │ │ │ │ +68 │ │ │ │ │ +_6_9 typedef std::vector _V_e_r_t_e_x_V_e_c_t_o_r; │ │ │ │ │ +70 │ │ │ │ │ +71#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6) │ │ │ │ │ +72 using _C_e_l_l_M_a_p_p_e_r = MultipleCodimMultipleGeomTypeMapper; │ │ │ │ │ +73#else │ │ │ │ │ +_7_4 using _C_e_l_l_M_a_p_p_e_r = MultipleCodimMultipleGeomTypeMapper; │ │ │ │ │ +75#endif │ │ │ │ │ +76 // typedef typename CellMapper::IndexType IndexType; │ │ │ │ │ +_7_7 typedef int _I_n_d_e_x_T_y_p_e; │ │ │ │ │ +78public: │ │ │ │ │ +79 │ │ │ │ │ +80 // transformations │ │ │ │ │ +_8_1 typedef Dune::MultiLinearGeometry<_c_t_y_p_e, _d_i_m-_c_o_d_i_m, _d_i_m_w_o_r_l_d> _G_e_o_m_e_t_r_y; │ │ │ │ │ +_8_2 typedef Dune::MultiLinearGeometry<_c_t_y_p_e, _d_i_m-_c_o_d_i_m, _d_i_m> _L_o_c_a_l_G_e_o_m_e_t_r_y; │ │ │ │ │ +83 │ │ │ │ │ +84protected: │ │ │ │ │ +85 /************************** PRIVATE SUBCLASSES **********************/ │ │ │ │ │ +86 │ │ │ │ │ +_9_1 struct _C_o_r_n_e_r_I_n_f_o │ │ │ │ │ +92 { │ │ │ │ │ +_9_3 unsigned int _i_d_x : 28; │ │ │ │ │ +_9_4 unsigned int _n_u_m : 4; │ │ │ │ │ +95 }; │ │ │ │ │ +96 │ │ │ │ │ +_9_7 struct _C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ +98 { │ │ │ │ │ +_9_9 _C_o_o_r_d_i_n_a_t_e_I_n_f_o() │ │ │ │ │ +100 {} │ │ │ │ │ +101 │ │ │ │ │ +_1_0_2 _C_o_o_r_d_i_n_a_t_e_I_n_f_o(unsigned int index_, _I_n_d_e_x_T_y_p_e vtxindex_) │ │ │ │ │ +103 : _v_t_x_i_n_d_e_x(vtxindex_), _i_n_d_e_x(index_) │ │ │ │ │ +104 {} │ │ │ │ │ +105 │ │ │ │ │ +_1_0_7 _I_n_d_e_x_T_y_p_e _v_t_x_i_n_d_e_x; │ │ │ │ │ 108 │ │ │ │ │ -109 │ │ │ │ │ -110template │ │ │ │ │ -111void Codim1Extractor::update(const Predicate& predicate) │ │ │ │ │ -112{ │ │ │ │ │ -113 // free everything there is in this object │ │ │ │ │ -114 this->clear(); │ │ │ │ │ +_1_1_0 _C_o_o_r_d_s _c_o_o_r_d; │ │ │ │ │ +111 │ │ │ │ │ +_1_1_3 unsigned int _i_n_d_e_x; │ │ │ │ │ +114 }; │ │ │ │ │ 115 │ │ │ │ │ -116 // In this first pass iterate over all entities of codim 0. │ │ │ │ │ -117 // For each codim 1 intersection check if it is part of the boundary and if │ │ │ │ │ -so, │ │ │ │ │ -118 // get its corner vertices, find resp. store them together with their │ │ │ │ │ -associated index, │ │ │ │ │ -119 // and remember the indices of the boundary faces' corners. │ │ │ │ │ +_1_1_9 struct _V_e_r_t_e_x_I_n_f_o │ │ │ │ │ 120 { │ │ │ │ │ -121 // several counter for consecutive indexing are needed │ │ │ │ │ -122 int simplex_index = 0; │ │ │ │ │ -123 int vertex_index = 0; │ │ │ │ │ -124 IndexType eindex = 0; // supress warning │ │ │ │ │ -125 │ │ │ │ │ -126 // needed later for insertion into a std::set which only │ │ │ │ │ -127 // works with const references │ │ │ │ │ -128 │ │ │ │ │ -129 // a temporary container where newly acquired face │ │ │ │ │ -130 // information can be stored at first │ │ │ │ │ -131 std::deque temp_faces; │ │ │ │ │ -132 │ │ │ │ │ -133 // iterate over interior codim 0 elements on the grid │ │ │ │ │ -134 for (const auto& elmt : elements(this->gv_, Partitions::interior)) │ │ │ │ │ -135 { │ │ │ │ │ -136 Dune::GeometryType gt = elmt.type(); │ │ │ │ │ -137 │ │ │ │ │ -138 // if some face is part of the surface add it! │ │ │ │ │ -139 if (elmt.hasBoundaryIntersections()) │ │ │ │ │ -140 { │ │ │ │ │ -141 // add an entry to the element info map, the index will be set properly │ │ │ │ │ -later, │ │ │ │ │ -142 // whereas the number of faces is already known │ │ │ │ │ -143 eindex = this->cellMapper_.index(elmt); │ │ │ │ │ -144 this->elmtInfo_.emplace(eindex, ElementInfo(simplex_index, elmt, 0)); │ │ │ │ │ +_1_2_1 _V_e_r_t_e_x_I_n_f_o(unsigned int idx_, const _V_e_r_t_e_x& p_) : _i_d_x(idx_), _p(p_.seed()) │ │ │ │ │ +122 {} │ │ │ │ │ +_1_2_3 unsigned int _i_d_x; │ │ │ │ │ +_1_2_4 _V_e_r_t_e_x_S_e_e_d _p; │ │ │ │ │ +125 }; │ │ │ │ │ +126 │ │ │ │ │ +127 │ │ │ │ │ +_1_3_1 struct _E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ +132 { │ │ │ │ │ +_1_3_3 _E_l_e_m_e_n_t_I_n_f_o(unsigned int idx_, const _E_l_e_m_e_n_t& p_, unsigned int f_) : _i_d_x │ │ │ │ │ +(idx_), _f_a_c_e_s(f_), _p(p_.seed()) │ │ │ │ │ +134 {} │ │ │ │ │ +135 │ │ │ │ │ +_1_3_7 unsigned int _i_d_x : 28; │ │ │ │ │ +138 │ │ │ │ │ +_1_4_0 unsigned int _f_a_c_e_s : 4; │ │ │ │ │ +141 │ │ │ │ │ +_1_4_3 _E_l_e_m_e_n_t_S_e_e_d _p; │ │ │ │ │ +144 }; │ │ │ │ │ 145 │ │ │ │ │ -146 // now add the faces in ascending order of their indices │ │ │ │ │ -147 // (we are only talking about 1-4 faces here, so O(n^2) is ok!) │ │ │ │ │ -148 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(this->gv_, elmt)) │ │ │ │ │ -149 { │ │ │ │ │ -150 // Stop only at selected boundary faces │ │ │ │ │ -151 if (!in.boundary() or !predicate(elmt, in.indexInInside())) │ │ │ │ │ -152 continue; │ │ │ │ │ -153 │ │ │ │ │ -154 const auto& refElement = Dune::ReferenceElements::general(gt); │ │ │ │ │ -155 // get the corner count of this face │ │ │ │ │ -156 const int face_corners = refElement.size(in.indexInInside(), 1, dim); │ │ │ │ │ -157 │ │ │ │ │ -158 // now we only have to care about the 3D case, i.e. a triangle face can be │ │ │ │ │ -159 // inserted directly whereas a quadrilateral face has to be divided into │ │ │ │ │ -two triangles │ │ │ │ │ -160 switch (face_corners) │ │ │ │ │ +146 │ │ │ │ │ +_1_5_0 struct _S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ +151 { │ │ │ │ │ +_1_5_2 _S_u_b_E_n_t_i_t_y_I_n_f_o() │ │ │ │ │ +153 /* │ │ │ │ │ +154 * TODO: move default value of `geometryType_` to member declaration │ │ │ │ │ +155 * when removing support for older dune-geometry │ │ │ │ │ +156 */ │ │ │ │ │ +157#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6) │ │ │ │ │ +158 : _g_e_o_m_e_t_r_y_T_y_p_e__(GeometryTypes::simplex(_d_i_m-_c_o_d_i_m)) │ │ │ │ │ +159 {} │ │ │ │ │ +160#else │ │ │ │ │ 161 { │ │ │ │ │ -162 case 2 : │ │ │ │ │ -163 case 3: │ │ │ │ │ -164 { │ │ │ │ │ -165 // we have a simplex here │ │ │ │ │ -166 │ │ │ │ │ -167 // register the additional face(s) │ │ │ │ │ -168 this->elmtInfo_.at(eindex).faces++; │ │ │ │ │ -169 │ │ │ │ │ -170 // add a new face to the temporary collection │ │ │ │ │ -171 temp_faces.emplace_back(eindex, in.indexInInside(), │ │ │ │ │ -172#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6) │ │ │ │ │ -173 Dune::GeometryTypes::simplex(dim-codim) │ │ │ │ │ -174#else │ │ │ │ │ -175 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim) │ │ │ │ │ -176#endif │ │ │ │ │ -177 ); │ │ │ │ │ +162 _g_e_o_m_e_t_r_y_T_y_p_e__.makeSimplex(_d_i_m-_c_o_d_i_m); │ │ │ │ │ +163 } │ │ │ │ │ +164#endif │ │ │ │ │ +165 │ │ │ │ │ +_1_6_6 _S_u_b_E_n_t_i_t_y_I_n_f_o(_I_n_d_e_x_T_y_p_e parent_, unsigned int num_in_parent_, │ │ │ │ │ +167 const Dune::GeometryType& geometryType) │ │ │ │ │ +168 : _p_a_r_e_n_t(parent_), _n_u_m___i_n___p_a_r_e_n_t(num_in_parent_), _g_e_o_m_e_t_r_y_T_y_p_e__ │ │ │ │ │ +(geometryType) │ │ │ │ │ +169 {} │ │ │ │ │ +170 │ │ │ │ │ +_1_7_1 unsigned int _n_C_o_r_n_e_r_s() const │ │ │ │ │ +172 { │ │ │ │ │ +173 return Dune::ReferenceElements::general │ │ │ │ │ +(_g_e_o_m_e_t_r_y_T_y_p_e__).size(_d_i_m-_c_o_d_i_m); │ │ │ │ │ +174 } │ │ │ │ │ +175 │ │ │ │ │ +_1_7_7 _I_n_d_e_x_T_y_p_e _p_a_r_e_n_t; │ │ │ │ │ 178 │ │ │ │ │ -179 std::vector > cornerCoords(face_corners); │ │ │ │ │ -180 │ │ │ │ │ -181 // try for each of the faces vertices whether it is already inserted or not │ │ │ │ │ -182 for (int i = 0; i < face_corners; ++i) │ │ │ │ │ -183 { │ │ │ │ │ -184 // get the number of the vertex in the parent element │ │ │ │ │ -185 int vertex_number = refElement.subEntity(in.indexInInside(), 1, i, dim); │ │ │ │ │ -186 │ │ │ │ │ -187 // get the vertex pointer and the index from the index set │ │ │ │ │ -188 const Vertex vertex = elmt.template subEntity(vertex_number); │ │ │ │ │ -189 cornerCoords[i] = vertex.geometry().corner(0); │ │ │ │ │ -190 │ │ │ │ │ -191 IndexType vindex = this->gv_.indexSet().template index(vertex); │ │ │ │ │ -192 │ │ │ │ │ -193 // remember the vertex' number in parent element's vertices │ │ │ │ │ -194 temp_faces.back().corners[i].num = vertex_number; │ │ │ │ │ -195 │ │ │ │ │ -196 // if the vertex is not yet inserted in the vertex info map │ │ │ │ │ -197 // it is a new one -> it will be inserted now! │ │ │ │ │ -198 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex); │ │ │ │ │ -199 if (vimit == this->vtxInfo_.end()) │ │ │ │ │ -200 { │ │ │ │ │ -201 // insert into the map │ │ │ │ │ -202 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex)); │ │ │ │ │ -203 // remember the vertex as a corner of the current face in temp_faces │ │ │ │ │ -204 temp_faces.back().corners[i].idx = vertex_index; │ │ │ │ │ -205 // increase the current index │ │ │ │ │ -206 vertex_index++; │ │ │ │ │ -207 } │ │ │ │ │ -208 else │ │ │ │ │ -209 { │ │ │ │ │ -210 // only insert the index into the simplices array │ │ │ │ │ -211 temp_faces.back().corners[i].idx = vimit->second.idx; │ │ │ │ │ -212 } │ │ │ │ │ -213 } │ │ │ │ │ -214 │ │ │ │ │ -215 // Now we have the correct vertices in the last entries of temp_faces, but │ │ │ │ │ -they may │ │ │ │ │ -216 // have the wrong orientation. We want them to be oriented such that all │ │ │ │ │ -boundary edges │ │ │ │ │ -217 // point in the counterclockwise direction. Therefore, we check the │ │ │ │ │ -orientation of the │ │ │ │ │ -218 // new face and possibly switch the two vertices. │ │ │ │ │ -219 FieldVector realNormal = in.centerUnitOuterNormal(); │ │ │ │ │ -220 │ │ │ │ │ -221 // Compute segment normal │ │ │ │ │ -222 FieldVector reconstructedNormal; │ │ │ │ │ -223 if (dim==2) // boundary face is a line segment │ │ │ │ │ -224 { │ │ │ │ │ -225 reconstructedNormal[0] = cornerCoords[1][1] - cornerCoords[0][1]; │ │ │ │ │ -226 reconstructedNormal[1] = cornerCoords[0][0] - cornerCoords[1][0]; │ │ │ │ │ -227 } else { // boundary face is a triangle │ │ │ │ │ -228 FieldVector segment1 = cornerCoords[1] - cornerCoords[0]; │ │ │ │ │ -229 FieldVector segment2 = cornerCoords[2] - cornerCoords[0]; │ │ │ │ │ -230 reconstructedNormal = _c_r_o_s_s_P_r_o_d_u_c_t(segment1, segment2); │ │ │ │ │ -231 } │ │ │ │ │ -232 reconstructedNormal /= reconstructedNormal.two_norm(); │ │ │ │ │ -233 │ │ │ │ │ -234 if (realNormal * reconstructedNormal < 0.0) │ │ │ │ │ -235 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]); │ │ │ │ │ -236 │ │ │ │ │ -237 // now increase the current face index │ │ │ │ │ -238 simplex_index++; │ │ │ │ │ -239 break; │ │ │ │ │ -240 } │ │ │ │ │ -241 case 4 : │ │ │ │ │ -242 { │ │ │ │ │ -243 assert(dim == 3 && cube_corners == 4); │ │ │ │ │ -244 // we have a quadrilateral here │ │ │ │ │ -245 std::array vertex_indices; │ │ │ │ │ -246 std::array vertex_numbers; │ │ │ │ │ -247 │ │ │ │ │ -248 // register the additional face(s) (2 simplices) │ │ │ │ │ -249 this->elmtInfo_.at(eindex).faces += 2; │ │ │ │ │ -250 │ │ │ │ │ -251 std::array, 4> cornerCoords; │ │ │ │ │ -252 │ │ │ │ │ -253 // get the vertex pointers for the quadrilateral's corner vertices │ │ │ │ │ -254 // and try for each of them whether it is already inserted or not │ │ │ │ │ -255 for (int i = 0; i < cube_corners; ++i) │ │ │ │ │ -256 { │ │ │ │ │ -257 // get the number of the vertex in the parent element │ │ │ │ │ -258 vertex_numbers[i] = refElement.subEntity(in.indexInInside(), 1, i, dim); │ │ │ │ │ -259 │ │ │ │ │ -260 // get the vertex pointer and the index from the index set │ │ │ │ │ -261 const Vertex vertex = elmt.template subEntity(vertex_numbers[i]); │ │ │ │ │ -262 cornerCoords[i] = vertex.geometry().corner(0); │ │ │ │ │ -263 │ │ │ │ │ -264 IndexType vindex = this->gv_.indexSet().template index(vertex); │ │ │ │ │ -265 │ │ │ │ │ -266 // if the vertex is not yet inserted in the vertex info map │ │ │ │ │ -267 // it is a new one -> it will be inserted now! │ │ │ │ │ -268 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex); │ │ │ │ │ -269 if (vimit == this->vtxInfo_.end()) │ │ │ │ │ -270 { │ │ │ │ │ -271 // insert into the map │ │ │ │ │ -272 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex)); │ │ │ │ │ -273 // remember this vertex' index │ │ │ │ │ -274 vertex_indices[i] = vertex_index; │ │ │ │ │ -275 // increase the current index │ │ │ │ │ -276 vertex_index++; │ │ │ │ │ -277 } │ │ │ │ │ -278 else │ │ │ │ │ -279 { │ │ │ │ │ -280 // only remember the vertex' index │ │ │ │ │ -281 vertex_indices[i] = vimit->second.idx; │ │ │ │ │ -282 } │ │ │ │ │ -283 } │ │ │ │ │ -284 │ │ │ │ │ -285 // now introduce the two triangles subdividing the quadrilateral │ │ │ │ │ -286 // ATTENTION: the order of vertices given by "orientedSubface" corresponds │ │ │ │ │ -to the order │ │ │ │ │ -287 // of a Dune quadrilateral, i.e. the triangles are given by 0 1 2 and 3 2 1 │ │ │ │ │ -288 │ │ │ │ │ -289 // add a new face to the temporary collection for the first tri │ │ │ │ │ -290 temp_faces.emplace_back(eindex, in.indexInInside(), │ │ │ │ │ -291#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6) │ │ │ │ │ -292 Dune::GeometryTypes::simplex(dim-codim) │ │ │ │ │ -293#else │ │ │ │ │ -294 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim) │ │ │ │ │ -295#endif │ │ │ │ │ -296 ); │ │ │ │ │ -297 temp_faces.back().corners[0].idx = vertex_indices[0]; │ │ │ │ │ -298 temp_faces.back().corners[1].idx = vertex_indices[1]; │ │ │ │ │ -299 temp_faces.back().corners[2].idx = vertex_indices[2]; │ │ │ │ │ -300 // remember the vertices' numbers in parent element's vertices │ │ │ │ │ -301 temp_faces.back().corners[0].num = vertex_numbers[0]; │ │ │ │ │ -302 temp_faces.back().corners[1].num = vertex_numbers[1]; │ │ │ │ │ -303 temp_faces.back().corners[2].num = vertex_numbers[2]; │ │ │ │ │ -304 │ │ │ │ │ -305 // Now we have the correct vertices in the last entries of temp_faces, but │ │ │ │ │ -they may │ │ │ │ │ -306 // have the wrong orientation. We want the triangle vertices on │ │ │ │ │ -counterclockwise order, │ │ │ │ │ -307 // when viewed from the outside of the grid. Therefore, we check the │ │ │ │ │ -orientation of the │ │ │ │ │ -308 // new face and possibly switch two vertices. │ │ │ │ │ -309 FieldVector realNormal = in.centerUnitOuterNormal(); │ │ │ │ │ -310 │ │ │ │ │ -311 // Compute segment normal │ │ │ │ │ -312 FieldVector reconstructedNormal = _c_r_o_s_s_P_r_o_d_u_c_t(cornerCoords │ │ │ │ │ -[1] - cornerCoords[0], │ │ │ │ │ -313 cornerCoords[2] - cornerCoords[0]); │ │ │ │ │ -314 reconstructedNormal /= reconstructedNormal.two_norm(); │ │ │ │ │ -315 │ │ │ │ │ -316 if (realNormal * reconstructedNormal < 0.0) │ │ │ │ │ -317 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]); │ │ │ │ │ -318 │ │ │ │ │ -319 │ │ │ │ │ -320 // add a new face to the temporary collection for the second tri │ │ │ │ │ -321 temp_faces.emplace_back(eindex, in.indexInInside(), │ │ │ │ │ -322#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6) │ │ │ │ │ -323 Dune::GeometryTypes::simplex(dim-codim) │ │ │ │ │ -324#else │ │ │ │ │ -325 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim) │ │ │ │ │ -326#endif │ │ │ │ │ -327 ); │ │ │ │ │ -328 temp_faces.back().corners[0].idx = vertex_indices[3]; │ │ │ │ │ -329 temp_faces.back().corners[1].idx = vertex_indices[2]; │ │ │ │ │ -330 temp_faces.back().corners[2].idx = vertex_indices[1]; │ │ │ │ │ -331 // remember the vertices' numbers in parent element's vertices │ │ │ │ │ -332 temp_faces.back().corners[0].num = vertex_numbers[3]; │ │ │ │ │ -333 temp_faces.back().corners[1].num = vertex_numbers[2]; │ │ │ │ │ -334 temp_faces.back().corners[2].num = vertex_numbers[1]; │ │ │ │ │ -335 │ │ │ │ │ -336 // Now we have the correct vertices in the last entries of temp_faces, but │ │ │ │ │ -they may │ │ │ │ │ -337 // have the wrong orientation. We want the triangle vertices on │ │ │ │ │ -counterclockwise order, │ │ │ │ │ -338 // when viewed from the outside of the grid. Therefore, we check the │ │ │ │ │ -orientation of the │ │ │ │ │ -339 // new face and possibly switch two vertices. │ │ │ │ │ -340 // Compute segment normal │ │ │ │ │ -341 reconstructedNormal = _c_r_o_s_s_P_r_o_d_u_c_t(cornerCoords[2] - cornerCoords[3], │ │ │ │ │ -342 cornerCoords[1] - cornerCoords[3]); │ │ │ │ │ -343 reconstructedNormal /= reconstructedNormal.two_norm(); │ │ │ │ │ -344 │ │ │ │ │ -345 if (realNormal * reconstructedNormal < 0.0) │ │ │ │ │ -346 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]); │ │ │ │ │ -347 │ │ │ │ │ -348 simplex_index+=2; │ │ │ │ │ -349 break; │ │ │ │ │ -350 } │ │ │ │ │ -351 default : │ │ │ │ │ -352 DUNE_THROW(Dune::NotImplemented, "the extractor does only work for triangle │ │ │ │ │ -and quadrilateral faces (" << face_corners << " corners)"); │ │ │ │ │ -353 break; │ │ │ │ │ -354 } │ │ │ │ │ -355 } // end loop over found surface parts │ │ │ │ │ -356 } │ │ │ │ │ -357 } // end loop over elements │ │ │ │ │ -358 │ │ │ │ │ -359 std::cout << "added " << simplex_index << " subfaces\n"; │ │ │ │ │ -360 │ │ │ │ │ -361 // allocate the array for the face specific information... │ │ │ │ │ -362 this->subEntities_.resize(simplex_index); │ │ │ │ │ -363 // ...and fill in the data from the temporary containers │ │ │ │ │ -364 copy(temp_faces.begin(), temp_faces.end(), this->subEntities_.begin()); │ │ │ │ │ -365 } │ │ │ │ │ -366 │ │ │ │ │ +_1_8_0 unsigned int _n_u_m___i_n___p_a_r_e_n_t : 3; │ │ │ │ │ +181 │ │ │ │ │ +_1_8_3 Dune::GeometryType _g_e_o_m_e_t_r_y_T_y_p_e__; │ │ │ │ │ +184 │ │ │ │ │ +_1_9_1 _C_o_r_n_e_r_I_n_f_o _c_o_r_n_e_r_s[_c_u_b_e___c_o_r_n_e_r_s]; // sim = numer of vertices in a simplex │ │ │ │ │ +192 }; │ │ │ │ │ +193 │ │ │ │ │ +194 │ │ │ │ │ +_1_9_5 typedef std::map _E_l_e_m_e_n_t_I_n_f_o_M_a_p; │ │ │ │ │ +_1_9_6 typedef std::map _V_e_r_t_e_x_I_n_f_o_M_a_p; │ │ │ │ │ +197 │ │ │ │ │ +198 /************************** MEMBER VARIABLES ************************/ │ │ │ │ │ +199 │ │ │ │ │ +_2_0_1 const _G_r_i_d_V_i_e_w _g_v__; │ │ │ │ │ +202 │ │ │ │ │ +203 /* Geometrical and Topological Information */ │ │ │ │ │ +204 │ │ │ │ │ +_2_0_6 std::vector _c_o_o_r_d_s__; │ │ │ │ │ +207 │ │ │ │ │ +_2_0_9 std::vector _s_u_b_E_n_t_i_t_i_e_s__; │ │ │ │ │ +210 │ │ │ │ │ +_2_1_6 _V_e_r_t_e_x_I_n_f_o_M_a_p _v_t_x_I_n_f_o__; │ │ │ │ │ +217 │ │ │ │ │ +_2_2_3 _E_l_e_m_e_n_t_I_n_f_o_M_a_p _e_l_m_t_I_n_f_o__; │ │ │ │ │ +224 │ │ │ │ │ +_2_2_5 _C_e_l_l_M_a_p_p_e_r _c_e_l_l_M_a_p_p_e_r__; │ │ │ │ │ +226 │ │ │ │ │ +227public: │ │ │ │ │ +228 │ │ │ │ │ +229 /* C O N S T R U C T O R S A N D D E S T R U C T O R S */ │ │ │ │ │ +230 │ │ │ │ │ +_2_3_5 _E_x_t_r_a_c_t_o_r(const GV& gv) │ │ │ │ │ +236 : _g_v__(gv) │ │ │ │ │ +237#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6) │ │ │ │ │ +238 , _c_e_l_l_M_a_p_p_e_r__(gv, mcmgElementLayout()) │ │ │ │ │ +239#else │ │ │ │ │ +240 , _c_e_l_l_M_a_p_p_e_r__(gv) │ │ │ │ │ +241#endif │ │ │ │ │ +242 {} │ │ │ │ │ +243 │ │ │ │ │ +244 /* F U N C T I O N A L I T Y */ │ │ │ │ │ +245 │ │ │ │ │ +_2_4_9 void _c_l_e_a_r() │ │ │ │ │ +250 { │ │ │ │ │ +251 // this is an inofficial way on how to free the memory allocated │ │ │ │ │ +252 // by a std::vector │ │ │ │ │ +253 { │ │ │ │ │ +254 std::vector dummy; │ │ │ │ │ +255 _c_o_o_r_d_s__.swap(dummy); │ │ │ │ │ +256 } │ │ │ │ │ +257 { │ │ │ │ │ +258 std::vector dummy; │ │ │ │ │ +259 _s_u_b_E_n_t_i_t_i_e_s__.swap(dummy); │ │ │ │ │ +260 } │ │ │ │ │ +261 │ │ │ │ │ +262 // ...then clear the maps themselves, too │ │ │ │ │ +263 _v_t_x_I_n_f_o__.clear(); │ │ │ │ │ +264 _e_l_m_t_I_n_f_o__.clear(); │ │ │ │ │ +265 } │ │ │ │ │ +266 │ │ │ │ │ +267 │ │ │ │ │ +268 /* G E T T E R S */ │ │ │ │ │ +269 │ │ │ │ │ +_2_7_5 void _g_e_t_C_o_o_r_d_s(std::vector >& coords) │ │ │ │ │ +const │ │ │ │ │ +276 { │ │ │ │ │ +277 coords.resize(_c_o_o_r_d_s__.size()); │ │ │ │ │ +278 for (unsigned int i = 0; i < _c_o_o_r_d_s__.size(); ++i) │ │ │ │ │ +279 coords[i] = _c_o_o_r_d_s__[i].coord; │ │ │ │ │ +280 } │ │ │ │ │ +281 │ │ │ │ │ +282 │ │ │ │ │ +_2_8_7 unsigned int _n_C_o_o_r_d_s() const │ │ │ │ │ +288 { │ │ │ │ │ +289 return _c_o_o_r_d_s__.size(); │ │ │ │ │ +290 } │ │ │ │ │ +291 │ │ │ │ │ +_2_9_3 void _g_e_t_G_e_o_m_e_t_r_y_T_y_p_e_s(std::vector& geometryTypes) const │ │ │ │ │ +294 { │ │ │ │ │ +295 geometryTypes.resize(_s_u_b_E_n_t_i_t_i_e_s__.size()); │ │ │ │ │ +296 for (size_t i=0; i<_s_u_b_E_n_t_i_t_i_e_s__.size(); i++) │ │ │ │ │ +297 geometryTypes[i] = _s_u_b_E_n_t_i_t_i_e_s__[i].geometryType_; │ │ │ │ │ +298 } │ │ │ │ │ +299 │ │ │ │ │ +300 │ │ │ │ │ +_3_0_4 void _g_e_t_F_a_c_e_s(std::vector& faces) const │ │ │ │ │ +305 { │ │ │ │ │ +306 faces.resize(_s_u_b_E_n_t_i_t_i_e_s__.size()); │ │ │ │ │ +307 for (unsigned int i = 0; i < _s_u_b_E_n_t_i_t_i_e_s__.size(); ++i) { │ │ │ │ │ +308 faces[i].resize(_s_u_b_E_n_t_i_t_i_e_s__[i].nCorners()); │ │ │ │ │ +309 for (unsigned int j = 0; j < _s_u_b_E_n_t_i_t_i_e_s__[i].nCorners(); ++j) │ │ │ │ │ +310 faces[i][j] = _s_u_b_E_n_t_i_t_i_e_s__[i].corners[j].idx; │ │ │ │ │ +311 } │ │ │ │ │ +312 } │ │ │ │ │ +313 │ │ │ │ │ +314 │ │ │ │ │ +_3_2_3 bool _f_a_c_e_I_n_d_i_c_e_s(const _E_l_e_m_e_n_t& e, int& first, int& count) const │ │ │ │ │ +324 { │ │ │ │ │ +325 typename ElementInfoMap::const_iterator it = │ │ │ │ │ +326 _e_l_m_t_I_n_f_o__.find(_c_e_l_l_M_a_p_p_e_r__.map(e)); │ │ │ │ │ +327 if (it == _e_l_m_t_I_n_f_o__.end()) │ │ │ │ │ +328 { │ │ │ │ │ +329 first = -1; │ │ │ │ │ +330 count = 0; │ │ │ │ │ +331 return false; │ │ │ │ │ +332 } │ │ │ │ │ +333 // the iterator is valid, fill the out params │ │ │ │ │ +334 first = it->second.idx; │ │ │ │ │ +335 count = it->second.faces; │ │ │ │ │ +336 return true; │ │ │ │ │ +337 } │ │ │ │ │ +338 │ │ │ │ │ +339 │ │ │ │ │ +_3_4_5 int _i_n_d_e_x_I_n_I_n_s_i_d_e(unsigned int index) const │ │ │ │ │ +346 { │ │ │ │ │ +347 return index < _s_u_b_E_n_t_i_t_i_e_s__.size() ? _s_u_b_E_n_t_i_t_i_e_s__[index].num_in_parent : - │ │ │ │ │ +1; │ │ │ │ │ +348 } │ │ │ │ │ +349 │ │ │ │ │ +350 // /** │ │ │ │ │ +351 // * @brief tests that a given entry in the extraction set does have local │ │ │ │ │ +couplings │ │ │ │ │ +352 // * @todo parallel interface │ │ │ │ │ +353 // */ │ │ │ │ │ +354 // bool contains (unsigned int global, unsigned int & local) const │ │ │ │ │ +355 // { │ │ │ │ │ +356 // local = global; │ │ │ │ │ +357 // return true; │ │ │ │ │ +358 // } │ │ │ │ │ +359 │ │ │ │ │ +_3_6_3 const _G_r_i_d_V_i_e_w & _g_r_i_d_V_i_e_w() const │ │ │ │ │ +364 { │ │ │ │ │ +365 return _g_v__; │ │ │ │ │ +366 } │ │ │ │ │ 367 │ │ │ │ │ -368 // now first write the array with the coordinates... │ │ │ │ │ -369 this->coords_.resize(this->vtxInfo_.size()); │ │ │ │ │ -370 for (const auto& vinfo : this->vtxInfo_) │ │ │ │ │ -371 { │ │ │ │ │ -372 // get a pointer to the associated info object │ │ │ │ │ -373 CoordinateInfo* current = &this->coords_[vinfo.second.idx]; │ │ │ │ │ -374 // store this coordinates index // NEEDED? │ │ │ │ │ -375 current->index = vinfo.second.idx; │ │ │ │ │ -376 // store the vertex' index for the index2vertex mapping │ │ │ │ │ -377 current->vtxindex = vinfo.first; │ │ │ │ │ -378 // store the vertex' coordinates under the associated index │ │ │ │ │ -379 // in the coordinates array │ │ │ │ │ -380 const auto vtx = this->grid().entity(vinfo.second.p); │ │ │ │ │ -381 current->coord = vtx.geometry().corner(0); │ │ │ │ │ -382 } │ │ │ │ │ -383 │ │ │ │ │ -384} │ │ │ │ │ -385 │ │ │ │ │ -386} // namespace GridGlue │ │ │ │ │ +_3_6_8 const _G_r_i_d& _g_r_i_d() const │ │ │ │ │ +369 { │ │ │ │ │ +370 return _g_v__.grid(); │ │ │ │ │ +371 } │ │ │ │ │ +372 │ │ │ │ │ +379 _E_l_e_m_e_n_t │ │ │ │ │ +_3_8_0 _e_l_e_m_e_n_t(unsigned int index) const │ │ │ │ │ +381 { │ │ │ │ │ +382 if (index >= _s_u_b_E_n_t_i_t_i_e_s__.size()) │ │ │ │ │ +383 DUNE_THROW(Dune::GridError, "invalid face index"); │ │ │ │ │ +384 const _E_l_e_m_e_n_t_S_e_e_d seed = _e_l_m_t_I_n_f_o__.at(_s_u_b_E_n_t_i_t_i_e_s__[index].parent).p; │ │ │ │ │ +385 return _g_r_i_d().entity(seed); │ │ │ │ │ +386 } │ │ │ │ │ 387 │ │ │ │ │ -388} // namespace Dune │ │ │ │ │ -389 │ │ │ │ │ -390#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH │ │ │ │ │ -_c_r_o_s_s_p_r_o_d_u_c_t_._h_h │ │ │ │ │ -_e_x_t_r_a_c_t_o_r_._h_h │ │ │ │ │ -extractor base class │ │ │ │ │ +388#if 1 │ │ │ │ │ +395 _V_e_r_t_e_x │ │ │ │ │ +_3_9_6 _v_e_r_t_e_x(unsigned int index) const │ │ │ │ │ +397 { │ │ │ │ │ +398 if (index >= _c_o_o_r_d_s__.size()) │ │ │ │ │ +399 DUNE_THROW(Dune::GridError, "invalid coordinate index"); │ │ │ │ │ +400 const _V_e_r_t_e_x_S_e_e_d seed = _v_t_x_I_n_f_o__.at(_c_o_o_r_d_s__[index].vtxindex).p; │ │ │ │ │ +401 return _g_r_i_d().entity(seed); │ │ │ │ │ +402 } │ │ │ │ │ +403#endif │ │ │ │ │ +404 │ │ │ │ │ +_4_0_6 _G_e_o_m_e_t_r_y _g_e_o_m_e_t_r_y(unsigned int index) const; │ │ │ │ │ +407 │ │ │ │ │ +_4_0_9 _L_o_c_a_l_G_e_o_m_e_t_r_y _g_e_o_m_e_t_r_y_L_o_c_a_l(unsigned int index) const; │ │ │ │ │ +410 │ │ │ │ │ +411}; │ │ │ │ │ +412 │ │ │ │ │ +413 │ │ │ │ │ +415template │ │ │ │ │ +_4_1_6typename _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_G_e_o_m_e_t_r_y _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_g_e_o_m_e_t_r_y(unsigned int │ │ │ │ │ +index) const │ │ │ │ │ +417{ │ │ │ │ │ +418 std::vector corners(subEntities_[index].nCorners()); │ │ │ │ │ +419 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i) │ │ │ │ │ +420 corners[i] = coords_[subEntities_[index].corners[i].idx].coord; │ │ │ │ │ +421 │ │ │ │ │ +422 return _G_e_o_m_e_t_r_y(subEntities_[index].geometryType_, corners); │ │ │ │ │ +423} │ │ │ │ │ +424 │ │ │ │ │ +425 │ │ │ │ │ +427template │ │ │ │ │ +_4_2_8typename _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_L_o_c_a_l_G_e_o_m_e_t_r_y _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_g_e_o_m_e_t_r_y_L_o_c_a_l │ │ │ │ │ +(unsigned int index) const │ │ │ │ │ +429{ │ │ │ │ │ +430 std::vector corners(subEntities_[index].nCorners()); │ │ │ │ │ +431 │ │ │ │ │ +432 // get face info │ │ │ │ │ +433 const _S_u_b_E_n_t_i_t_y_I_n_f_o & face = subEntities_[index]; │ │ │ │ │ +434 Dune::GeometryType facetype = subEntities_[index]._g_e_o_m_e_t_r_y_T_y_p_e__; │ │ │ │ │ +435 │ │ │ │ │ +436 // get reference element │ │ │ │ │ +437 const auto elmtseed = elmtInfo_.at(face._p_a_r_e_n_t).p; │ │ │ │ │ +438 const auto elmt = grid().entity(elmtseed); │ │ │ │ │ +439 const Dune::GeometryType celltype = elmt.type(); │ │ │ │ │ +440 const auto& re = Dune::ReferenceElements::general(celltype); │ │ │ │ │ +441 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i) │ │ │ │ │ +442 corners[i] = re.position(face._c_o_r_n_e_r_s[i]._n_u_m,dim); │ │ │ │ │ +443 │ │ │ │ │ +444 return _L_o_c_a_l_G_e_o_m_e_t_r_y(facetype, corners); │ │ │ │ │ +445} │ │ │ │ │ +446 │ │ │ │ │ +447} // namespace GridGlue │ │ │ │ │ +448 │ │ │ │ │ +449} // namespace Dune │ │ │ │ │ +450 │ │ │ │ │ +451#endif // DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ -IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ -> &reverse=!reversed) │ │ │ │ │ -Iterate over all intersections of a GridGlue. │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_c_r_o_s_s_P_r_o_d_u_c_t │ │ │ │ │ -static Dune::FieldVector< T, dim > crossProduct(const Dune::FieldVector< T, dim │ │ │ │ │ -> &a, const Dune::FieldVector< T, dim > &b) │ │ │ │ │ -compute cross product │ │ │ │ │ -DDeeffiinniittiioonn crossproduct.hh:15 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:42 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ -Extractor< GV, 1 >::IndexType IndexType │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_G_r_i_d_V_i_e_w │ │ │ │ │ -GV GridView │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t │ │ │ │ │ -GV::Traits::template Codim< 0 >::Entity Element │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:62 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< ctype, dimworld > Coords │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_c_t_y_p_e │ │ │ │ │ -GV::Grid::ctype ctype │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r │ │ │ │ │ -Codim1Extractor(const GV &gv, const Predicate &predicate) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:81 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_s_i_m_p_l_e_x___c_o_r_n_e_r_s │ │ │ │ │ -static constexpr int simplex_corners │ │ │ │ │ -compile time number of corners of surface simplices │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ -Extractor< GV, 1 >::VertexInfo VertexInfo │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:68 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ -Extractor< GV, 1 >::CoordinateInfo CoordinateInfo │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ -Extractor< GV, 1 >::ElementInfo ElementInfo │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ -Extractor< GV, 1 >::SubEntityInfo SubEntityInfo │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_M_a_p │ │ │ │ │ -Extractor< GV, 1 >::VertexInfoMap VertexInfoMap │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:70 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_P_r_e_d_i_c_a_t_e │ │ │ │ │ -std::function< bool(const Element &, unsigned int subentity)> Predicate │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ │ -GV::Traits::template Codim< dim >::Entity Vertex │ │ │ │ │ -DDeeffiinniittiioonn codim1extractor.hh:61 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ Provides codimension-independent methods for grid extraction. │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _1_ _>_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ │ +GV::Traits::template Codim< dim >::Entity Vertex │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:63 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_v_t_x_I_n_f_o__ │ │ │ │ │ +VertexInfoMap vtxInfo_ │ │ │ │ │ +a map enabling faster access to vertices and coordinates │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:216 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_r_i_d │ │ │ │ │ +const Grid & grid() const │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:368 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_e_l_l_M_a_p_p_e_r │ │ │ │ │ +MultipleCodimMultipleGeomTypeMapper< GridView, MCMGElementLayout > CellMapper │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:74 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_e_l_e_m_e_n_t │ │ │ │ │ +Element element(unsigned int index) const │ │ │ │ │ +gets the parent element for a given face index, throws an exception if index │ │ │ │ │ +not valid │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:380 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_i_n_d_e_x_I_n_I_n_s_i_d_e │ │ │ │ │ +int indexInInside(unsigned int index) const │ │ │ │ │ +gets the number face in the parent element │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:345 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_L_o_c_a_l_C_o_o_r_d_s │ │ │ │ │ +Dune::FieldVector< ctype, dim > LocalCoords │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:61 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_o_m_e_t_r_y_L_o_c_a_l │ │ │ │ │ +LocalGeometry geometryLocal(unsigned int index) const │ │ │ │ │ +Get geometry of the extracted face in element coordinates. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:428 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ static constexpr auto dimworld │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:50 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_G_e_o_m_e_t_r_y │ │ │ │ │ +Dune::MultiLinearGeometry< ctype, dim-codim, dimworld > Geometry │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:81 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ int IndexType │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _1_ _>_:_:_c_u_b_e___c_o_r_n_e_r_s │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_o_o_r_d_s__ │ │ │ │ │ +std::vector< CoordinateInfo > coords_ │ │ │ │ │ +all information about the corner vertices of the extracted │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:206 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t │ │ │ │ │ +GV::Traits::template Codim< 0 >::Entity Element │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:66 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_r_i_d_V_i_e_w │ │ │ │ │ +const GridView & gridView() const │ │ │ │ │ +give access to the Dune::GridView where this Patch belongs to │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:363 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_F_a_c_e_s │ │ │ │ │ +void getFaces(std::vector< VertexVector > &faces) const │ │ │ │ │ +Get the corners of the extracted subentities. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:304 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_V_e_c_t_o_r │ │ │ │ │ +std::vector< unsigned int > VertexVector │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:69 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_v__ │ │ │ │ │ +const GridView gv_ │ │ │ │ │ +the grid object to extract the surface from │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:201 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_s_u_b_E_n_t_i_t_i_e_s__ │ │ │ │ │ +std::vector< SubEntityInfo > subEntities_ │ │ │ │ │ +all information about the extracted subEntities │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:209 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_u_b_e___c_o_r_n_e_r_s │ │ │ │ │ static constexpr int cube_corners │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _1_ _>_:_:_c_o_d_i_m │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_v_e_r_t_e_x │ │ │ │ │ +Vertex vertex(unsigned int index) const │ │ │ │ │ +gets the vertex for a given coordinate index throws an exception if index not │ │ │ │ │ +valid │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:396 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m │ │ │ │ │ static constexpr auto codim │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_s │ │ │ │ │ +Dune::FieldVector< ctype, dimworld > Coords │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_G_e_o_m_e_t_r_y_T_y_p_e_s │ │ │ │ │ +void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const │ │ │ │ │ +Get the list of geometry types. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:293 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_M_a_p │ │ │ │ │ std::map< IndexType, VertexInfo > VertexInfoMap │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:196 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _1_ _>_:_:_d_i_m │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_G_r_i_d │ │ │ │ │ +GridView::Grid Grid │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:57 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_f_a_c_e_I_n_d_i_c_e_s │ │ │ │ │ +bool faceIndices(const Element &e, int &first, int &count) const │ │ │ │ │ +gets index of first subentity as well as the total number of subentities that │ │ │ │ │ +were extracted from thi... │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:323 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_o_m_e_t_r_y │ │ │ │ │ +Geometry geometry(unsigned int index) const │ │ │ │ │ +Get world geometry of the extracted face. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:416 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_G_r_i_d_V_i_e_w │ │ │ │ │ +GV GridView │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:56 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_n_C_o_o_r_d_s │ │ │ │ │ +unsigned int nCoords() const │ │ │ │ │ +getter for the count of coordinates │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:287 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_t_y_p_e │ │ │ │ │ +GV::Grid::ctype ctype │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_M_a_p │ │ │ │ │ +std::map< IndexType, ElementInfo > ElementInfoMap │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:195 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ +Extractor(const GV &gv) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:235 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_C_o_o_r_d_s │ │ │ │ │ +void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) │ │ │ │ │ +const │ │ │ │ │ +getter for the coordinates array │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:275 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_e_l_l_M_a_p_p_e_r__ │ │ │ │ │ +CellMapper cellMapper_ │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:225 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_S_e_e_d │ │ │ │ │ +Element::EntitySeed ElementSeed │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_S_e_e_d │ │ │ │ │ +Vertex::EntitySeed VertexSeed │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:64 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_e_l_m_t_I_n_f_o__ │ │ │ │ │ +ElementInfoMap elmtInfo_ │ │ │ │ │ +a map enabling faster access to elements and faces │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:223 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_l_e_a_r │ │ │ │ │ +void clear() │ │ │ │ │ +delete everything build up so far and free the memory │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:249 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m │ │ │ │ │ static constexpr auto dim │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ +Dune::MultiLinearGeometry< ctype, dim-codim, dim > LocalGeometry │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:82 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_r_n_e_r_I_n_f_o │ │ │ │ │ +Helpful struct holding one index for the coordinate (vertex) to which it is │ │ │ │ │ +associated and the elemen... │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:92 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_r_n_e_r_I_n_f_o_:_:_i_d_x │ │ │ │ │ +unsigned int idx │ │ │ │ │ +index of the vertex │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:93 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_r_n_e_r_I_n_f_o_:_:_n_u_m │ │ │ │ │ +unsigned int num │ │ │ │ │ +element corner │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:94 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:98 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ +CoordinateInfo(unsigned int index_, IndexType vtxindex_) │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:102 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_i_n_d_e_x │ │ │ │ │ +unsigned int index │ │ │ │ │ +the index of this coordinate (in internal storage scheme) // NEEDED?? │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:113 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ +CoordinateInfo() │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:99 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_c_o_o_r_d │ │ │ │ │ +Coords coord │ │ │ │ │ +the coordinate │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:110 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_v_t_x_i_n_d_e_x │ │ │ │ │ +IndexType vtxindex │ │ │ │ │ +the index of the parent element (from index set) │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:107 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ simple struct holding a vertex pointer and an index │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:120 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_:_:_i_d_x │ │ │ │ │ +unsigned int idx │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:123 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ +VertexInfo(unsigned int idx_, const Vertex &p_) │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:121 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_:_:_p │ │ │ │ │ +VertexSeed p │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:124 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ simple struct holding an element seed and an index │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:132 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_i_d_x │ │ │ │ │ +unsigned int idx │ │ │ │ │ +the index of this element's first face in the internal list of extracted faces │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:137 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_f_a_c_e_s │ │ │ │ │ +unsigned int faces │ │ │ │ │ +the number of extracted faces for this element │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:140 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ +ElementInfo(unsigned int idx_, const Element &p_, unsigned int f_) │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:133 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_p │ │ │ │ │ +ElementSeed p │ │ │ │ │ +the entity seed for the element │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:143 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ Holds some information about an element's subentity involved in a coupling. │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:151 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_n_C_o_r_n_e_r_s │ │ │ │ │ +unsigned int nCorners() const │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:171 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_c_o_r_n_e_r_s │ │ │ │ │ +CornerInfo corners[cube_corners] │ │ │ │ │ +the corner indices plus the numbers of the vertices in the parent element │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:191 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_p_a_r_e_n_t │ │ │ │ │ +IndexType parent │ │ │ │ │ +the index of the parent element (from index set) │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:177 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ +SubEntityInfo(IndexType parent_, unsigned int num_in_parent_, const Dune:: │ │ │ │ │ +GeometryType &geometryType) │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:166 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_n_u_m___i_n___p_a_r_e_n_t │ │ │ │ │ +unsigned int num_in_parent │ │ │ │ │ +the number of the face in the parent element │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:180 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_g_e_o_m_e_t_r_y_T_y_p_e__ │ │ │ │ │ +Dune::GeometryType geometryType_ │ │ │ │ │ +The GeometryType of the subentity. │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:183 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ +SubEntityInfo() │ │ │ │ │ +DDeeffiinniittiioonn extractor.hh:152 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: codim0extractor.hh File Reference │ │ │ │ +dune-grid-glue: codim1extractor.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,42 +72,44 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
codim0extractor.hh File Reference
│ │ │ │ +
codim1extractor.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Mesh grid extractor base class. │ │ │ │ +

Grid extractor class for codim 1 subgrids. │ │ │ │ More...

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

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GridGlue::Codim0Extractor< GV >
class  Dune::GridGlue::Codim1Extractor< GV >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

Mesh grid extractor base class.

│ │ │ │ +

Grid extractor class for codim 1 subgrids.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,27 +2,29 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _e_x_t_r_a_c_t_o_r_s │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -codim0extractor.hh File Reference │ │ │ │ │ -Mesh grid extractor base class. _M_o_r_e_._._. │ │ │ │ │ +codim1extractor.hh File Reference │ │ │ │ │ +Grid extractor class for codim 1 subgrids. _M_o_r_e_._._. │ │ │ │ │ +#include "_e_x_t_r_a_c_t_o_r_._h_h" │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include "_e_x_t_r_a_c_t_o_r_._h_h" │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_c_o_m_m_o_n_/_c_r_o_s_s_p_r_o_d_u_c_t_._h_h> │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_<_ _G_V_ _> │ │ │ │ │ +class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_1_E_x_t_r_a_c_t_o_r_<_ _G_V_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Mesh grid extractor base class. │ │ │ │ │ +Grid extractor class for codim 1 subgrids. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: codim0extractor.hh Source File │ │ │ │ +dune-grid-glue: codim1extractor.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,272 +74,411 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
codim0extractor.hh
│ │ │ │ +
codim1extractor.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │
5/*
│ │ │ │ -
6 * Filename: codim0extractor.hh
│ │ │ │ +
6 * Filename: codim1extractor.hh
│ │ │ │
7 * Version: 1.0
│ │ │ │
8 * Created on: Jun 23, 2009
│ │ │ │
9 * Author: Oliver Sander, Christian Engwer
│ │ │ │
10 * ---------------------------------
│ │ │ │
11 * Project: dune-grid-glue
│ │ │ │ -
12 * Description: base class for grid extractors extracting surface grids
│ │ │ │ +
12 * Description: class for grid extractors extracting surface grids
│ │ │ │
13 *
│ │ │ │
14 */
│ │ │ │ -
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ -
21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ +
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
│ │ │ │ +
21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
│ │ │ │
22
│ │ │ │ -
23#include <deque>
│ │ │ │ -
24#include <functional>
│ │ │ │ -
25
│ │ │ │ -
26#include <dune/common/deprecated.hh>
│ │ │ │ -
27#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ +
23#include "extractor.hh"
│ │ │ │ +
24
│ │ │ │ +
25#include <array>
│ │ │ │ +
26#include <deque>
│ │ │ │ +
27#include <functional>
│ │ │ │
28
│ │ │ │ -
29#include "extractor.hh"
│ │ │ │ -
30
│ │ │ │ -
31namespace Dune {
│ │ │ │ +
29#include <dune/common/deprecated.hh>
│ │ │ │ +
30#include <dune/common/version.hh>
│ │ │ │ + │ │ │ │
32
│ │ │ │ -
33 namespace GridGlue {
│ │ │ │ +
33namespace Dune {
│ │ │ │
34
│ │ │ │ -
38template<typename GV>
│ │ │ │ -
│ │ │ │ -
39class Codim0Extractor : public Extractor<GV,0>
│ │ │ │ -
40{
│ │ │ │ -
41
│ │ │ │ -
42public:
│ │ │ │ -
43
│ │ │ │ -
44 /* 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 */
│ │ │ │ -
45 using Extractor<GV,0>::codim;
│ │ │ │ -
46 typedef typename Extractor<GV,0>::ctype ctype;
│ │ │ │ -
47 using Extractor<GV,0>::dim;
│ │ │ │ -
48 using Extractor<GV,0>::dimworld;
│ │ │ │ - │ │ │ │ -
50
│ │ │ │ -
51 typedef typename GV::Traits::template Codim<dim>::Entity Vertex;
│ │ │ │ -
52 typedef typename GV::Traits::template Codim<0>::Entity Element;
│ │ │ │ -
53 typedef std::function<bool(const Element&, unsigned int subentity)> Predicate;
│ │ │ │ -
54
│ │ │ │ -
55 // import typedefs from base class
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
61
│ │ │ │ -
│ │ │ │ -
67 Codim0Extractor(const GV& gv, const Predicate& predicate)
│ │ │ │ -
68 : Extractor<GV,0>(gv), positiveNormalDirection_(false)
│ │ │ │ -
69 {
│ │ │ │ -
70 std::cout << "This is Codim0Extractor on a <"
│ │ │ │ -
71 << GV::dimension << "," << GV::dimensionworld << "> grid!" << std::endl;
│ │ │ │ -
72 update(predicate);
│ │ │ │ -
73 }
│ │ │ │ +
35 namespace GridGlue {
│ │ │ │ +
36
│ │ │ │ +
40template<typename GV>
│ │ │ │ +
│ │ │ │ +
41class Codim1Extractor : public Extractor<GV,1>
│ │ │ │ +
42{
│ │ │ │ +
43public:
│ │ │ │ +
44
│ │ │ │ +
45 /* 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 */
│ │ │ │ +
46
│ │ │ │ +
47 using Extractor<GV,1>::dimworld;
│ │ │ │ +
48 using Extractor<GV,1>::dim;
│ │ │ │ +
49 using Extractor<GV,1>::codim;
│ │ │ │ +
50 using Extractor<GV,1>::cube_corners;
│ │ │ │ + │ │ │ │ +
52
│ │ │ │ +
54 static constexpr int simplex_corners = dim;
│ │ │ │ +
55
│ │ │ │ +
56 typedef GV GridView;
│ │ │ │ +
57
│ │ │ │ +
58 typedef typename GV::Grid::ctype ctype;
│ │ │ │ +
59 typedef Dune::FieldVector<ctype, dimworld> Coords;
│ │ │ │ +
60
│ │ │ │ +
61 typedef typename GV::Traits::template Codim<dim>::Entity Vertex;
│ │ │ │ +
62 typedef typename GV::Traits::template Codim<0>::Entity Element;
│ │ │ │ +
63 typedef std::function<bool(const Element&, unsigned int subentity)> Predicate;
│ │ │ │ +
64
│ │ │ │ +
65 // import typedefs from base class
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
71
│ │ │ │ +
72public:
│ │ │ │ +
73
│ │ │ │ +
74 /* C O N S T R U C T O R S A N D D E S T R U C T O R S */
│ │ │ │ +
75
│ │ │ │ +
│ │ │ │ +
81 Codim1Extractor(const GV& gv, const Predicate& predicate)
│ │ │ │ +
82 : Extractor<GV,1>(gv)
│ │ │ │ +
83 {
│ │ │ │ +
84 std::cout << "This is Codim1Extractor on a <" << dim
│ │ │ │ +
85 << "," << dimworld << "> grid!"
│ │ │ │ +
86 << std::endl;
│ │ │ │ +
87 update(predicate);
│ │ │ │ +
88 }
│ │ │ │
│ │ │ │ -
74
│ │ │ │ - │ │ │ │ -
76 const bool & positiveNormalDirection() const { return positiveNormalDirection_; }
│ │ │ │ -
77
│ │ │ │ -
78protected:
│ │ │ │ - │ │ │ │ -
80private:
│ │ │ │ -
81 void update(const Predicate& predicate);
│ │ │ │ -
82};
│ │ │ │ -
│ │ │ │ -
83
│ │ │ │ -
84
│ │ │ │ -
85template<typename GV>
│ │ │ │ -
86void Codim0Extractor<GV>::update(const Predicate& predicate)
│ │ │ │ -
87{
│ │ │ │ -
88 // In this first pass iterate over all entities of codim 0.
│ │ │ │ -
89 // Get its corner vertices, find resp. store them together with their associated index,
│ │ │ │ -
90 // and remember the indices of the corners.
│ │ │ │ +
89
│ │ │ │ +
90private:
│ │ │ │
91
│ │ │ │ -
92 // free everything there is in this object
│ │ │ │ -
93 this->clear();
│ │ │ │ -
94
│ │ │ │ -
95 // several counter for consecutive indexing are needed
│ │ │ │ -
96 size_t element_index = 0;
│ │ │ │ -
97 size_t vertex_index = 0;
│ │ │ │ -
98
│ │ │ │ -
99 // a temporary container where newly acquired face
│ │ │ │ -
100 // information can be stored at first
│ │ │ │ -
101 std::deque<SubEntityInfo> temp_faces;
│ │ │ │ -
102
│ │ │ │ -
103 // iterate over all codim 0 elements on the grid
│ │ │ │ -
104 for (const auto& elmt : elements(this->gv_, Partitions::interior))
│ │ │ │ -
105 {
│ │ │ │ -
106 const auto geometry = elmt.geometry();
│ │ │ │ -
107 IndexType eindex = this->cellMapper_.index(elmt);
│ │ │ │ +
105 void update(const Predicate& predicate);
│ │ │ │ +
106
│ │ │ │ +
107};
│ │ │ │ +
│ │ │ │
108
│ │ │ │ -
109 // only do sth. if this element is "interesting"
│ │ │ │ -
110 // implicit cast is done automatically
│ │ │ │ -
111 if (predicate(elmt,0))
│ │ │ │ -
112 {
│ │ │ │ -
113 // add an entry to the element info map, the index will be set properly later
│ │ │ │ -
114 this->elmtInfo_.emplace(eindex, ElementInfo(element_index, elmt, 1));
│ │ │ │ +
109
│ │ │ │ +
110template<typename GV>
│ │ │ │ +
111void Codim1Extractor<GV>::update(const Predicate& predicate)
│ │ │ │ +
112{
│ │ │ │ +
113 // free everything there is in this object
│ │ │ │ +
114 this->clear();
│ │ │ │
115
│ │ │ │ -
116 unsigned int numCorners = elmt.subEntities(dim);
│ │ │ │ -
117 unsigned int vertex_indices[numCorners]; // index in global vector
│ │ │ │ -
118 unsigned int vertex_numbers[numCorners]; // index in parent entity
│ │ │ │ -
119
│ │ │ │ -
120 // try for each of the faces vertices whether it is already inserted or not
│ │ │ │ -
121 for (unsigned int i = 0; i < numCorners; ++i)
│ │ │ │ -
122 {
│ │ │ │ -
123 vertex_numbers[i] = i;
│ │ │ │ -
124
│ │ │ │ -
125 // get the vertex pointer and the index from the index set
│ │ │ │ -
126 const Vertex vertex = elmt.template subEntity<dim>(vertex_numbers[i]);
│ │ │ │ -
127 IndexType vindex = this->gv_.indexSet().template index<dim>(vertex);
│ │ │ │ +
116 // In this first pass iterate over all entities of codim 0.
│ │ │ │ +
117 // For each codim 1 intersection check if it is part of the boundary and if so,
│ │ │ │ +
118 // get its corner vertices, find resp. store them together with their associated index,
│ │ │ │ +
119 // and remember the indices of the boundary faces' corners.
│ │ │ │ +
120 {
│ │ │ │ +
121 // several counter for consecutive indexing are needed
│ │ │ │ +
122 int simplex_index = 0;
│ │ │ │ +
123 int vertex_index = 0;
│ │ │ │ +
124 IndexType eindex = 0; // supress warning
│ │ │ │ +
125
│ │ │ │ +
126 // needed later for insertion into a std::set which only
│ │ │ │ +
127 // works with const references
│ │ │ │
128
│ │ │ │ -
129 // if the vertex is not yet inserted in the vertex info map
│ │ │ │ -
130 // it is a new one -> it will be inserted now!
│ │ │ │ -
131 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex);
│ │ │ │ -
132 if (vimit == this->vtxInfo_.end())
│ │ │ │ -
133 {
│ │ │ │ -
134 // insert into the map
│ │ │ │ -
135 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex));
│ │ │ │ -
136 // remember this vertex' index
│ │ │ │ -
137 vertex_indices[i] = vertex_index;
│ │ │ │ -
138 // increase the current index
│ │ │ │ -
139 vertex_index++;
│ │ │ │ -
140 }
│ │ │ │ -
141 else
│ │ │ │ -
142 {
│ │ │ │ -
143 // only remember the vertex' index
│ │ │ │ -
144 vertex_indices[i] = vimit->second.idx;
│ │ │ │ -
145 }
│ │ │ │ -
146 }
│ │ │ │ -
147
│ │ │ │ -
148 // flip cell if necessary
│ │ │ │ -
149 {
│ │ │ │ -
150 switch (int(dim))
│ │ │ │ -
151 {
│ │ │ │ -
152 case 0 :
│ │ │ │ -
153 break;
│ │ │ │ -
154 case 1 :
│ │ │ │ -
155 {
│ │ │ │ -
156 // The following test only works if the zero-th coordinate is the
│ │ │ │ -
157 // one that defines the orientation. A sufficient condition for
│ │ │ │ -
158 // this is dimworld == 1
│ │ │ │ -
159 /* assert(dimworld==1); */
│ │ │ │ -
160 bool elementNormalDirection =
│ │ │ │ -
161 (geometry.corner(1)[0] < geometry.corner(0)[0]);
│ │ │ │ -
162 if ( positiveNormalDirection_ != elementNormalDirection )
│ │ │ │ -
163 {
│ │ │ │ -
164 std::swap(vertex_indices[0], vertex_indices[1]);
│ │ │ │ -
165 std::swap(vertex_numbers[0], vertex_numbers[1]);
│ │ │ │ -
166 }
│ │ │ │ -
167 break;
│ │ │ │ -
168 }
│ │ │ │ -
169 case 2 :
│ │ │ │ -
170 {
│ │ │ │ -
171 Dune::FieldVector<ctype, dimworld>
│ │ │ │ -
172 v0 = geometry.corner(1),
│ │ │ │ -
173 v1 = geometry.corner(2);
│ │ │ │ -
174 v0 -= geometry.corner(0);
│ │ │ │ -
175 v1 -= geometry.corner(0);
│ │ │ │ -
176 ctype normal_sign = v0[0]*v1[1] - v0[1]*v1[0];
│ │ │ │ -
177 bool elementNormalDirection = (normal_sign < 0);
│ │ │ │ -
178 if ( positiveNormalDirection_ != elementNormalDirection )
│ │ │ │ -
179 {
│ │ │ │ -
180 std::cout << "swap\n";
│ │ │ │ -
181 if (elmt.type().isCube())
│ │ │ │ -
182 {
│ │ │ │ -
183 for (int i = 0; i < (1<<dim); i+=2)
│ │ │ │ -
184 {
│ │ │ │ -
185 // swap i and i+1
│ │ │ │ -
186 std::swap(vertex_indices[i], vertex_indices[i+1]);
│ │ │ │ -
187 std::swap(vertex_numbers[i], vertex_numbers[i+1]);
│ │ │ │ -
188 }
│ │ │ │ -
189 } else if (elmt.type().isSimplex()) {
│ │ │ │ -
190 std::swap(vertex_indices[0], vertex_indices[1]);
│ │ │ │ -
191 std::swap(vertex_numbers[0], vertex_numbers[1]);
│ │ │ │ -
192 } else {
│ │ │ │ -
193 DUNE_THROW(Dune::Exception, "Unexpected Geometrytype");
│ │ │ │ -
194 }
│ │ │ │ -
195 }
│ │ │ │ -
196 break;
│ │ │ │ -
197 }
│ │ │ │ -
198 }
│ │ │ │ -
199 }
│ │ │ │ -
200
│ │ │ │ -
201 // add a new face to the temporary collection
│ │ │ │ -
202 temp_faces.emplace_back(eindex, 0, elmt.type());
│ │ │ │ -
203 element_index++;
│ │ │ │ -
204 for (unsigned int i=0; i<numCorners; i++) {
│ │ │ │ -
205 temp_faces.back().corners[i].idx = vertex_indices[i];
│ │ │ │ -
206 // remember the vertices' numbers in parent element's vertices
│ │ │ │ -
207 temp_faces.back().corners[i].num = vertex_numbers[i];
│ │ │ │ -
208 }
│ │ │ │ -
209
│ │ │ │ -
210 }
│ │ │ │ -
211 } // end loop over elements
│ │ │ │ -
212
│ │ │ │ -
213 // allocate the array for the face specific information...
│ │ │ │ -
214 this->subEntities_.resize(element_index);
│ │ │ │ -
215 // ...and fill in the data from the temporary containers
│ │ │ │ -
216 copy(temp_faces.begin(), temp_faces.end(), this->subEntities_.begin());
│ │ │ │ -
217
│ │ │ │ -
218 // now first write the array with the coordinates...
│ │ │ │ -
219 this->coords_.resize(this->vtxInfo_.size());
│ │ │ │ -
220 for (const auto& vinfo : this->vtxInfo_)
│ │ │ │ -
221 {
│ │ │ │ -
222 // get a pointer to the associated info object
│ │ │ │ -
223 CoordinateInfo* current = &this->coords_[vinfo.second.idx];
│ │ │ │ -
224 // store this coordinates index // NEEDED?
│ │ │ │ -
225 current->index = vinfo.second.idx;
│ │ │ │ -
226 // store the vertex' index for the index2vertex mapping
│ │ │ │ -
227 current->vtxindex = vinfo.first;
│ │ │ │ -
228 // store the vertex' coordinates under the associated index
│ │ │ │ -
229 // in the coordinates array
│ │ │ │ -
230 const auto vtx = this->grid().entity(vinfo.second.p);
│ │ │ │ -
231 current->coord = vtx.geometry().corner(0);
│ │ │ │ -
232 }
│ │ │ │ +
129 // a temporary container where newly acquired face
│ │ │ │ +
130 // information can be stored at first
│ │ │ │ +
131 std::deque<SubEntityInfo> temp_faces;
│ │ │ │ +
132
│ │ │ │ +
133 // iterate over interior codim 0 elements on the grid
│ │ │ │ +
134 for (const auto& elmt : elements(this->gv_, Partitions::interior))
│ │ │ │ +
135 {
│ │ │ │ +
136 Dune::GeometryType gt = elmt.type();
│ │ │ │ +
137
│ │ │ │ +
138 // if some face is part of the surface add it!
│ │ │ │ +
139 if (elmt.hasBoundaryIntersections())
│ │ │ │ +
140 {
│ │ │ │ +
141 // add an entry to the element info map, the index will be set properly later,
│ │ │ │ +
142 // whereas the number of faces is already known
│ │ │ │ +
143 eindex = this->cellMapper_.index(elmt);
│ │ │ │ +
144 this->elmtInfo_.emplace(eindex, ElementInfo(simplex_index, elmt, 0));
│ │ │ │ +
145
│ │ │ │ +
146 // now add the faces in ascending order of their indices
│ │ │ │ +
147 // (we are only talking about 1-4 faces here, so O(n^2) is ok!)
│ │ │ │ +
148 for (const auto& in : intersections(this->gv_, elmt))
│ │ │ │ +
149 {
│ │ │ │ +
150 // Stop only at selected boundary faces
│ │ │ │ +
151 if (!in.boundary() or !predicate(elmt, in.indexInInside()))
│ │ │ │ +
152 continue;
│ │ │ │ +
153
│ │ │ │ +
154 const auto& refElement = Dune::ReferenceElements<ctype, dim>::general(gt);
│ │ │ │ +
155 // get the corner count of this face
│ │ │ │ +
156 const int face_corners = refElement.size(in.indexInInside(), 1, dim);
│ │ │ │ +
157
│ │ │ │ +
158 // now we only have to care about the 3D case, i.e. a triangle face can be
│ │ │ │ +
159 // inserted directly whereas a quadrilateral face has to be divided into two triangles
│ │ │ │ +
160 switch (face_corners)
│ │ │ │ +
161 {
│ │ │ │ +
162 case 2 :
│ │ │ │ +
163 case 3:
│ │ │ │ +
164 {
│ │ │ │ +
165 // we have a simplex here
│ │ │ │ +
166
│ │ │ │ +
167 // register the additional face(s)
│ │ │ │ +
168 this->elmtInfo_.at(eindex).faces++;
│ │ │ │ +
169
│ │ │ │ +
170 // add a new face to the temporary collection
│ │ │ │ +
171 temp_faces.emplace_back(eindex, in.indexInInside(),
│ │ │ │ +
172#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ +
173 Dune::GeometryTypes::simplex(dim-codim)
│ │ │ │ +
174#else
│ │ │ │ +
175 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim)
│ │ │ │ +
176#endif
│ │ │ │ +
177 );
│ │ │ │ +
178
│ │ │ │ +
179 std::vector<FieldVector<ctype,dimworld> > cornerCoords(face_corners);
│ │ │ │ +
180
│ │ │ │ +
181 // try for each of the faces vertices whether it is already inserted or not
│ │ │ │ +
182 for (int i = 0; i < face_corners; ++i)
│ │ │ │ +
183 {
│ │ │ │ +
184 // get the number of the vertex in the parent element
│ │ │ │ +
185 int vertex_number = refElement.subEntity(in.indexInInside(), 1, i, dim);
│ │ │ │ +
186
│ │ │ │ +
187 // get the vertex pointer and the index from the index set
│ │ │ │ +
188 const Vertex vertex = elmt.template subEntity<dim>(vertex_number);
│ │ │ │ +
189 cornerCoords[i] = vertex.geometry().corner(0);
│ │ │ │ +
190
│ │ │ │ +
191 IndexType vindex = this->gv_.indexSet().template index<dim>(vertex);
│ │ │ │ +
192
│ │ │ │ +
193 // remember the vertex' number in parent element's vertices
│ │ │ │ +
194 temp_faces.back().corners[i].num = vertex_number;
│ │ │ │ +
195
│ │ │ │ +
196 // if the vertex is not yet inserted in the vertex info map
│ │ │ │ +
197 // it is a new one -> it will be inserted now!
│ │ │ │ +
198 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex);
│ │ │ │ +
199 if (vimit == this->vtxInfo_.end())
│ │ │ │ +
200 {
│ │ │ │ +
201 // insert into the map
│ │ │ │ +
202 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex));
│ │ │ │ +
203 // remember the vertex as a corner of the current face in temp_faces
│ │ │ │ +
204 temp_faces.back().corners[i].idx = vertex_index;
│ │ │ │ +
205 // increase the current index
│ │ │ │ +
206 vertex_index++;
│ │ │ │ +
207 }
│ │ │ │ +
208 else
│ │ │ │ +
209 {
│ │ │ │ +
210 // only insert the index into the simplices array
│ │ │ │ +
211 temp_faces.back().corners[i].idx = vimit->second.idx;
│ │ │ │ +
212 }
│ │ │ │ +
213 }
│ │ │ │ +
214
│ │ │ │ +
215 // Now we have the correct vertices in the last entries of temp_faces, but they may
│ │ │ │ +
216 // have the wrong orientation. We want them to be oriented such that all boundary edges
│ │ │ │ +
217 // point in the counterclockwise direction. Therefore, we check the orientation of the
│ │ │ │ +
218 // new face and possibly switch the two vertices.
│ │ │ │ +
219 FieldVector<ctype,dimworld> realNormal = in.centerUnitOuterNormal();
│ │ │ │ +
220
│ │ │ │ +
221 // Compute segment normal
│ │ │ │ +
222 FieldVector<ctype,dimworld> reconstructedNormal;
│ │ │ │ +
223 if (dim==2) // boundary face is a line segment
│ │ │ │ +
224 {
│ │ │ │ +
225 reconstructedNormal[0] = cornerCoords[1][1] - cornerCoords[0][1];
│ │ │ │ +
226 reconstructedNormal[1] = cornerCoords[0][0] - cornerCoords[1][0];
│ │ │ │ +
227 } else { // boundary face is a triangle
│ │ │ │ +
228 FieldVector<ctype,dimworld> segment1 = cornerCoords[1] - cornerCoords[0];
│ │ │ │ +
229 FieldVector<ctype,dimworld> segment2 = cornerCoords[2] - cornerCoords[0];
│ │ │ │ +
230 reconstructedNormal = crossProduct(segment1, segment2);
│ │ │ │ +
231 }
│ │ │ │ +
232 reconstructedNormal /= reconstructedNormal.two_norm();
│ │ │ │
233
│ │ │ │ -
234}
│ │ │ │ -
235
│ │ │ │ -
236} // namespace GridGlue
│ │ │ │ -
237
│ │ │ │ -
238} // namespace Dune
│ │ │ │ -
239
│ │ │ │ -
240#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ -
extractor base class
│ │ │ │ +
234 if (realNormal * reconstructedNormal < 0.0)
│ │ │ │ +
235 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]);
│ │ │ │ +
236
│ │ │ │ +
237 // now increase the current face index
│ │ │ │ +
238 simplex_index++;
│ │ │ │ +
239 break;
│ │ │ │ +
240 }
│ │ │ │ +
241 case 4 :
│ │ │ │ +
242 {
│ │ │ │ +
243 assert(dim == 3 && cube_corners == 4);
│ │ │ │ +
244 // we have a quadrilateral here
│ │ │ │ +
245 std::array<unsigned int, 4> vertex_indices;
│ │ │ │ +
246 std::array<unsigned int, 4> vertex_numbers;
│ │ │ │ +
247
│ │ │ │ +
248 // register the additional face(s) (2 simplices)
│ │ │ │ +
249 this->elmtInfo_.at(eindex).faces += 2;
│ │ │ │ +
250
│ │ │ │ +
251 std::array<FieldVector<ctype,dimworld>, 4> cornerCoords;
│ │ │ │ +
252
│ │ │ │ +
253 // get the vertex pointers for the quadrilateral's corner vertices
│ │ │ │ +
254 // and try for each of them whether it is already inserted or not
│ │ │ │ +
255 for (int i = 0; i < cube_corners; ++i)
│ │ │ │ +
256 {
│ │ │ │ +
257 // get the number of the vertex in the parent element
│ │ │ │ +
258 vertex_numbers[i] = refElement.subEntity(in.indexInInside(), 1, i, dim);
│ │ │ │ +
259
│ │ │ │ +
260 // get the vertex pointer and the index from the index set
│ │ │ │ +
261 const Vertex vertex = elmt.template subEntity<dim>(vertex_numbers[i]);
│ │ │ │ +
262 cornerCoords[i] = vertex.geometry().corner(0);
│ │ │ │ +
263
│ │ │ │ +
264 IndexType vindex = this->gv_.indexSet().template index<dim>(vertex);
│ │ │ │ +
265
│ │ │ │ +
266 // if the vertex is not yet inserted in the vertex info map
│ │ │ │ +
267 // it is a new one -> it will be inserted now!
│ │ │ │ +
268 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex);
│ │ │ │ +
269 if (vimit == this->vtxInfo_.end())
│ │ │ │ +
270 {
│ │ │ │ +
271 // insert into the map
│ │ │ │ +
272 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex));
│ │ │ │ +
273 // remember this vertex' index
│ │ │ │ +
274 vertex_indices[i] = vertex_index;
│ │ │ │ +
275 // increase the current index
│ │ │ │ +
276 vertex_index++;
│ │ │ │ +
277 }
│ │ │ │ +
278 else
│ │ │ │ +
279 {
│ │ │ │ +
280 // only remember the vertex' index
│ │ │ │ +
281 vertex_indices[i] = vimit->second.idx;
│ │ │ │ +
282 }
│ │ │ │ +
283 }
│ │ │ │ +
284
│ │ │ │ +
285 // now introduce the two triangles subdividing the quadrilateral
│ │ │ │ +
286 // ATTENTION: the order of vertices given by "orientedSubface" corresponds to the order
│ │ │ │ +
287 // of a Dune quadrilateral, i.e. the triangles are given by 0 1 2 and 3 2 1
│ │ │ │ +
288
│ │ │ │ +
289 // add a new face to the temporary collection for the first tri
│ │ │ │ +
290 temp_faces.emplace_back(eindex, in.indexInInside(),
│ │ │ │ +
291#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ +
292 Dune::GeometryTypes::simplex(dim-codim)
│ │ │ │ +
293#else
│ │ │ │ +
294 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim)
│ │ │ │ +
295#endif
│ │ │ │ +
296 );
│ │ │ │ +
297 temp_faces.back().corners[0].idx = vertex_indices[0];
│ │ │ │ +
298 temp_faces.back().corners[1].idx = vertex_indices[1];
│ │ │ │ +
299 temp_faces.back().corners[2].idx = vertex_indices[2];
│ │ │ │ +
300 // remember the vertices' numbers in parent element's vertices
│ │ │ │ +
301 temp_faces.back().corners[0].num = vertex_numbers[0];
│ │ │ │ +
302 temp_faces.back().corners[1].num = vertex_numbers[1];
│ │ │ │ +
303 temp_faces.back().corners[2].num = vertex_numbers[2];
│ │ │ │ +
304
│ │ │ │ +
305 // Now we have the correct vertices in the last entries of temp_faces, but they may
│ │ │ │ +
306 // have the wrong orientation. We want the triangle vertices on counterclockwise order,
│ │ │ │ +
307 // when viewed from the outside of the grid. Therefore, we check the orientation of the
│ │ │ │ +
308 // new face and possibly switch two vertices.
│ │ │ │ +
309 FieldVector<ctype,dimworld> realNormal = in.centerUnitOuterNormal();
│ │ │ │ +
310
│ │ │ │ +
311 // Compute segment normal
│ │ │ │ +
312 FieldVector<ctype,dimworld> reconstructedNormal = crossProduct(cornerCoords[1] - cornerCoords[0],
│ │ │ │ +
313 cornerCoords[2] - cornerCoords[0]);
│ │ │ │ +
314 reconstructedNormal /= reconstructedNormal.two_norm();
│ │ │ │ +
315
│ │ │ │ +
316 if (realNormal * reconstructedNormal < 0.0)
│ │ │ │ +
317 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]);
│ │ │ │ +
318
│ │ │ │ +
319
│ │ │ │ +
320 // add a new face to the temporary collection for the second tri
│ │ │ │ +
321 temp_faces.emplace_back(eindex, in.indexInInside(),
│ │ │ │ +
322#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ +
323 Dune::GeometryTypes::simplex(dim-codim)
│ │ │ │ +
324#else
│ │ │ │ +
325 Dune::GeometryType(Dune::GeometryType::simplex,dim-codim)
│ │ │ │ +
326#endif
│ │ │ │ +
327 );
│ │ │ │ +
328 temp_faces.back().corners[0].idx = vertex_indices[3];
│ │ │ │ +
329 temp_faces.back().corners[1].idx = vertex_indices[2];
│ │ │ │ +
330 temp_faces.back().corners[2].idx = vertex_indices[1];
│ │ │ │ +
331 // remember the vertices' numbers in parent element's vertices
│ │ │ │ +
332 temp_faces.back().corners[0].num = vertex_numbers[3];
│ │ │ │ +
333 temp_faces.back().corners[1].num = vertex_numbers[2];
│ │ │ │ +
334 temp_faces.back().corners[2].num = vertex_numbers[1];
│ │ │ │ +
335
│ │ │ │ +
336 // Now we have the correct vertices in the last entries of temp_faces, but they may
│ │ │ │ +
337 // have the wrong orientation. We want the triangle vertices on counterclockwise order,
│ │ │ │ +
338 // when viewed from the outside of the grid. Therefore, we check the orientation of the
│ │ │ │ +
339 // new face and possibly switch two vertices.
│ │ │ │ +
340 // Compute segment normal
│ │ │ │ +
341 reconstructedNormal = crossProduct(cornerCoords[2] - cornerCoords[3],
│ │ │ │ +
342 cornerCoords[1] - cornerCoords[3]);
│ │ │ │ +
343 reconstructedNormal /= reconstructedNormal.two_norm();
│ │ │ │ +
344
│ │ │ │ +
345 if (realNormal * reconstructedNormal < 0.0)
│ │ │ │ +
346 std::swap(temp_faces.back().corners[0], temp_faces.back().corners[1]);
│ │ │ │ +
347
│ │ │ │ +
348 simplex_index+=2;
│ │ │ │ +
349 break;
│ │ │ │ +
350 }
│ │ │ │ +
351 default :
│ │ │ │ +
352 DUNE_THROW(Dune::NotImplemented, "the extractor does only work for triangle and quadrilateral faces (" << face_corners << " corners)");
│ │ │ │ +
353 break;
│ │ │ │ +
354 }
│ │ │ │ +
355 } // end loop over found surface parts
│ │ │ │ +
356 }
│ │ │ │ +
357 } // end loop over elements
│ │ │ │ +
358
│ │ │ │ +
359 std::cout << "added " << simplex_index << " subfaces\n";
│ │ │ │ +
360
│ │ │ │ +
361 // allocate the array for the face specific information...
│ │ │ │ +
362 this->subEntities_.resize(simplex_index);
│ │ │ │ +
363 // ...and fill in the data from the temporary containers
│ │ │ │ +
364 copy(temp_faces.begin(), temp_faces.end(), this->subEntities_.begin());
│ │ │ │ +
365 }
│ │ │ │ +
366
│ │ │ │ +
367
│ │ │ │ +
368 // now first write the array with the coordinates...
│ │ │ │ +
369 this->coords_.resize(this->vtxInfo_.size());
│ │ │ │ +
370 for (const auto& vinfo : this->vtxInfo_)
│ │ │ │ +
371 {
│ │ │ │ +
372 // get a pointer to the associated info object
│ │ │ │ +
373 CoordinateInfo* current = &this->coords_[vinfo.second.idx];
│ │ │ │ +
374 // store this coordinates index // NEEDED?
│ │ │ │ +
375 current->index = vinfo.second.idx;
│ │ │ │ +
376 // store the vertex' index for the index2vertex mapping
│ │ │ │ +
377 current->vtxindex = vinfo.first;
│ │ │ │ +
378 // store the vertex' coordinates under the associated index
│ │ │ │ +
379 // in the coordinates array
│ │ │ │ +
380 const auto vtx = this->grid().entity(vinfo.second.p);
│ │ │ │ +
381 current->coord = vtx.geometry().corner(0);
│ │ │ │ +
382 }
│ │ │ │ +
383
│ │ │ │ +
384}
│ │ │ │ +
385
│ │ │ │ +
386} // namespace GridGlue
│ │ │ │ +
387
│ │ │ │ +
388} // namespace Dune
│ │ │ │ +
389
│ │ │ │ +
390#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
│ │ │ │ + │ │ │ │ +
extractor base class
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
Definition codim0extractor.hh:40
│ │ │ │ -
bool & positiveNormalDirection()
Definition codim0extractor.hh:75
│ │ │ │ -
Extractor< GV, 0 >::IndexType IndexType
Definition codim0extractor.hh:49
│ │ │ │ -
const bool & positiveNormalDirection() const
Definition codim0extractor.hh:76
│ │ │ │ -
GV::Traits::template Codim< dim >::Entity Vertex
Definition codim0extractor.hh:51
│ │ │ │ -
Extractor< GV, 0 >::CoordinateInfo CoordinateInfo
Definition codim0extractor.hh:59
│ │ │ │ -
Extractor< GV, 0 >::VertexInfo VertexInfo
Definition codim0extractor.hh:58
│ │ │ │ -
Extractor< GV, 0 >::ctype ctype
Definition codim0extractor.hh:46
│ │ │ │ -
bool positiveNormalDirection_
Definition codim0extractor.hh:79
│ │ │ │ -
Extractor< GV, 0 >::VertexInfoMap VertexInfoMap
Definition codim0extractor.hh:60
│ │ │ │ -
std::function< bool(const Element &, unsigned int subentity)> Predicate
Definition codim0extractor.hh:53
│ │ │ │ -
Codim0Extractor(const GV &gv, const Predicate &predicate)
Constructor.
Definition codim0extractor.hh:67
│ │ │ │ -
Extractor< GV, 0 >::ElementInfo ElementInfo
Definition codim0extractor.hh:57
│ │ │ │ -
GV::Traits::template Codim< 0 >::Entity Element
Definition codim0extractor.hh:52
│ │ │ │ -
Extractor< GV, 0 >::SubEntityInfo SubEntityInfo
Definition codim0extractor.hh:56
│ │ │ │ +
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ +
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
│ │ │ │ +
Definition codim1extractor.hh:42
│ │ │ │ +
Extractor< GV, 1 >::IndexType IndexType
Definition codim1extractor.hh:51
│ │ │ │ +
GV GridView
Definition codim1extractor.hh:56
│ │ │ │ +
GV::Traits::template Codim< 0 >::Entity Element
Definition codim1extractor.hh:62
│ │ │ │ +
Dune::FieldVector< ctype, dimworld > Coords
Definition codim1extractor.hh:59
│ │ │ │ +
GV::Grid::ctype ctype
Definition codim1extractor.hh:58
│ │ │ │ +
Codim1Extractor(const GV &gv, const Predicate &predicate)
Constructor.
Definition codim1extractor.hh:81
│ │ │ │ +
static constexpr int simplex_corners
compile time number of corners of surface simplices
Definition codim1extractor.hh:54
│ │ │ │ +
Extractor< GV, 1 >::VertexInfo VertexInfo
Definition codim1extractor.hh:68
│ │ │ │ +
Extractor< GV, 1 >::CoordinateInfo CoordinateInfo
Definition codim1extractor.hh:69
│ │ │ │ +
Extractor< GV, 1 >::ElementInfo ElementInfo
Definition codim1extractor.hh:67
│ │ │ │ +
Extractor< GV, 1 >::SubEntityInfo SubEntityInfo
Definition codim1extractor.hh:66
│ │ │ │ +
Extractor< GV, 1 >::VertexInfoMap VertexInfoMap
Definition codim1extractor.hh:70
│ │ │ │ +
std::function< bool(const Element &, unsigned int subentity)> Predicate
Definition codim1extractor.hh:63
│ │ │ │ +
GV::Traits::template Codim< dim >::Entity Vertex
Definition codim1extractor.hh:61
│ │ │ │
Provides codimension-independent methods for grid extraction.
Definition extractor.hh:46
│ │ │ │ -
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ +
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │
int IndexType
Definition extractor.hh:77
│ │ │ │ -
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │ +
static constexpr int cube_corners
Definition extractor.hh:54
│ │ │ │ +
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │
std::map< IndexType, VertexInfo > VertexInfoMap
Definition extractor.hh:196
│ │ │ │ -
GV::Grid::ctype ctype
Definition extractor.hh:59
│ │ │ │ -
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │ +
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │ │ │ │ │
simple struct holding a vertex pointer and an index
Definition extractor.hh:120
│ │ │ │
simple struct holding an element seed and an index
Definition extractor.hh:132
│ │ │ │
Holds some information about an element's subentity involved in a coupling.
Definition extractor.hh:151
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
extractor.hh File Reference
│ │ │ │ +
codim0extractor.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

extractor base class │ │ │ │ +

Mesh grid extractor base class. │ │ │ │ More...

│ │ │ │ -
#include <vector>
│ │ │ │ -#include <map>
│ │ │ │ -#include <algorithm>
│ │ │ │ -#include <dune/common/exceptions.hh>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/common/version.hh>
│ │ │ │ -#include <dune/grid/common/geometry.hh>
│ │ │ │ -#include <dune/grid/common/grid.hh>
│ │ │ │ +
#include <deque>
│ │ │ │ +#include <functional>
│ │ │ │ +#include <dune/common/deprecated.hh>
│ │ │ │ #include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ -#include <dune/geometry/multilineargeometry.hh>
│ │ │ │ +#include "extractor.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GridGlue::Extractor< GV, cd >
 Provides codimension-independent methods for grid extraction. More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::CornerInfo
 Helpful struct holding one index for the coordinate (vertex) to which it is associated and the element's corner index;. More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::CoordinateInfo
 
struct  Dune::GridGlue::Extractor< GV, cd >::VertexInfo
 simple struct holding a vertex pointer and an index More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::ElementInfo
 simple struct holding an element seed and an index More...
 
struct  Dune::GridGlue::Extractor< GV, cd >::SubEntityInfo
 Holds some information about an element's subentity involved in a coupling. More...
class  Dune::GridGlue::Codim0Extractor< GV >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

extractor base class

│ │ │ │ +

Mesh grid extractor base class.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,49 +2,27 @@ │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _e_x_t_r_a_c_t_o_r_s │ │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -extractor.hh File Reference │ │ │ │ │ -extractor base class _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ +codim0extractor.hh File Reference │ │ │ │ │ +Mesh grid extractor base class. _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ +#include "_e_x_t_r_a_c_t_o_r_._h_h" │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ CCllaasssseess │ │ │ │ │ - class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _> │ │ │ │ │ -  Provides codimension-independent methods for grid extraction. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_C_o_r_n_e_r_I_n_f_o │ │ │ │ │ -  Helpful struct holding one index for the coordinate (vertex) to which │ │ │ │ │ - it is associated and the element's corner index;. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ -  simple struct holding a vertex pointer and an index _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ -  simple struct holding an element seed and an index _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ -struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _c_d_ _>_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ -  Holds some information about an element's subentity involved in a │ │ │ │ │ - coupling. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_<_ _G_V_ _> │ │ │ │ │   │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -extractor base class │ │ │ │ │ +Mesh grid extractor base class. │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: extractor.hh Source File │ │ │ │ +dune-grid-glue: codim0extractor.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,490 +74,276 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
extractor.hh
│ │ │ │ +
codim0extractor.hh
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │
5/*
│ │ │ │ -
6 * Filename: extractor.hh
│ │ │ │ +
6 * Filename: codim0extractor.hh
│ │ │ │
7 * Version: 1.0
│ │ │ │ -
8 * Created on: Oct 05, 2009
│ │ │ │ -
9 * Author: Christian Engwer
│ │ │ │ +
8 * Created on: Jun 23, 2009
│ │ │ │ +
9 * Author: Oliver Sander, Christian Engwer
│ │ │ │
10 * ---------------------------------
│ │ │ │
11 * Project: dune-grid-glue
│ │ │ │ -
12 * Description: base class for all grid extractors
│ │ │ │ +
12 * Description: base class for grid extractors extracting surface grids
│ │ │ │
13 *
│ │ │ │
14 */
│ │ │ │ -
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH
│ │ │ │ -
21#define DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH
│ │ │ │ +
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ +
21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │
22
│ │ │ │ -
23#include <vector>
│ │ │ │ -
24#include <map>
│ │ │ │ -
25#include <algorithm>
│ │ │ │ -
26#include <dune/common/exceptions.hh>
│ │ │ │ -
27#include <dune/common/fvector.hh>
│ │ │ │ -
28#include <dune/common/version.hh>
│ │ │ │ -
29#include <dune/grid/common/geometry.hh>
│ │ │ │ -
30#include <dune/grid/common/grid.hh>
│ │ │ │ -
31#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ -
32#include <dune/geometry/multilineargeometry.hh>
│ │ │ │ -
33
│ │ │ │ -
34namespace Dune {
│ │ │ │ -
35
│ │ │ │ -
36 namespace GridGlue {
│ │ │ │ -
37
│ │ │ │ -
44template<typename GV, int cd>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
46{
│ │ │ │ -
47
│ │ │ │ -
48public:
│ │ │ │ -
49
│ │ │ │ -
50 static constexpr auto dimworld = GV::dimensionworld;
│ │ │ │ -
51 static constexpr auto dim = GV::dimension;
│ │ │ │ -
52 static constexpr auto codim = cd;
│ │ │ │ -
53
│ │ │ │ -
54 static constexpr int cube_corners = 1 << (dim-codim);
│ │ │ │ -
55
│ │ │ │ -
56 typedef GV GridView;
│ │ │ │ -
57 typedef typename GridView::Grid Grid;
│ │ │ │ -
58
│ │ │ │ -
59 typedef typename GV::Grid::ctype ctype;
│ │ │ │ -
60 typedef Dune::FieldVector<ctype, dimworld> Coords;
│ │ │ │ -
61 typedef Dune::FieldVector<ctype, dim> LocalCoords;
│ │ │ │ -
62
│ │ │ │ -
63 typedef typename GV::Traits::template Codim<dim>::Entity Vertex;
│ │ │ │ -
64 typedef typename Vertex::EntitySeed VertexSeed;
│ │ │ │ -
65
│ │ │ │ -
66 typedef typename GV::Traits::template Codim<0>::Entity Element;
│ │ │ │ -
67 typedef typename Element::EntitySeed ElementSeed;
│ │ │ │ -
68
│ │ │ │ -
69 typedef std::vector<unsigned int> VertexVector;
│ │ │ │ -
70
│ │ │ │ -
71#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6)
│ │ │ │ -
72 using CellMapper = MultipleCodimMultipleGeomTypeMapper<GridView>;
│ │ │ │ -
73#else
│ │ │ │ -
74 using CellMapper = MultipleCodimMultipleGeomTypeMapper<GridView, MCMGElementLayout>;
│ │ │ │ -
75#endif
│ │ │ │ -
76 // typedef typename CellMapper::IndexType IndexType;
│ │ │ │ -
77 typedef int IndexType;
│ │ │ │ -
78public:
│ │ │ │ -
79
│ │ │ │ -
80 // transformations
│ │ │ │ -
81 typedef Dune::MultiLinearGeometry<ctype, dim-codim, dimworld> Geometry;
│ │ │ │ -
82 typedef Dune::MultiLinearGeometry<ctype, dim-codim, dim> LocalGeometry;
│ │ │ │ -
83
│ │ │ │ -
84protected:
│ │ │ │ -
85 /************************** PRIVATE SUBCLASSES **********************/
│ │ │ │ -
86
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
92 {
│ │ │ │ -
93 unsigned int idx : 28;
│ │ │ │ -
94 unsigned int num : 4;
│ │ │ │ -
95 };
│ │ │ │ -
│ │ │ │ -
96
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
98 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
100 {}
│ │ │ │ +
23#include <deque>
│ │ │ │ +
24#include <functional>
│ │ │ │ +
25
│ │ │ │ +
26#include <dune/common/deprecated.hh>
│ │ │ │ +
27#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ +
28
│ │ │ │ +
29#include "extractor.hh"
│ │ │ │ +
30
│ │ │ │ +
31namespace Dune {
│ │ │ │ +
32
│ │ │ │ +
33 namespace GridGlue {
│ │ │ │ +
34
│ │ │ │ +
38template<typename GV>
│ │ │ │ +
│ │ │ │ +
39class Codim0Extractor : public Extractor<GV,0>
│ │ │ │ +
40{
│ │ │ │ +
41
│ │ │ │ +
42public:
│ │ │ │ +
43
│ │ │ │ +
44 /* 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 */
│ │ │ │ +
45 using Extractor<GV,0>::codim;
│ │ │ │ +
46 typedef typename Extractor<GV,0>::ctype ctype;
│ │ │ │ +
47 using Extractor<GV,0>::dim;
│ │ │ │ +
48 using Extractor<GV,0>::dimworld;
│ │ │ │ + │ │ │ │ +
50
│ │ │ │ +
51 typedef typename GV::Traits::template Codim<dim>::Entity Vertex;
│ │ │ │ +
52 typedef typename GV::Traits::template Codim<0>::Entity Element;
│ │ │ │ +
53 typedef std::function<bool(const Element&, unsigned int subentity)> Predicate;
│ │ │ │ +
54
│ │ │ │ +
55 // import typedefs from base class
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
61
│ │ │ │ +
│ │ │ │ +
67 Codim0Extractor(const GV& gv, const Predicate& predicate)
│ │ │ │ +
68 : Extractor<GV,0>(gv), positiveNormalDirection_(false)
│ │ │ │ +
69 {
│ │ │ │ +
70 std::cout << "This is Codim0Extractor on a <"
│ │ │ │ +
71 << GV::dimension << "," << GV::dimensionworld << "> grid!" << std::endl;
│ │ │ │ +
72 update(predicate);
│ │ │ │ +
73 }
│ │ │ │ +
│ │ │ │ +
74
│ │ │ │ + │ │ │ │ +
76 const bool & positiveNormalDirection() const { return positiveNormalDirection_; }
│ │ │ │ +
77
│ │ │ │ +
78protected:
│ │ │ │ + │ │ │ │ +
80private:
│ │ │ │ +
81 void update(const Predicate& predicate);
│ │ │ │ +
82};
│ │ │ │
│ │ │ │ -
101
│ │ │ │ -
│ │ │ │ -
102 CoordinateInfo(unsigned int index_, IndexType vtxindex_)
│ │ │ │ -
103 : vtxindex(vtxindex_), index(index_)
│ │ │ │ -
104 {}
│ │ │ │ -
│ │ │ │ -
105
│ │ │ │ - │ │ │ │ +
83
│ │ │ │ +
84
│ │ │ │ +
85template<typename GV>
│ │ │ │ +
86void Codim0Extractor<GV>::update(const Predicate& predicate)
│ │ │ │ +
87{
│ │ │ │ +
88 // In this first pass iterate over all entities of codim 0.
│ │ │ │ +
89 // Get its corner vertices, find resp. store them together with their associated index,
│ │ │ │ +
90 // and remember the indices of the corners.
│ │ │ │ +
91
│ │ │ │ +
92 // free everything there is in this object
│ │ │ │ +
93 this->clear();
│ │ │ │ +
94
│ │ │ │ +
95 // several counter for consecutive indexing are needed
│ │ │ │ +
96 size_t element_index = 0;
│ │ │ │ +
97 size_t vertex_index = 0;
│ │ │ │ +
98
│ │ │ │ +
99 // a temporary container where newly acquired face
│ │ │ │ +
100 // information can be stored at first
│ │ │ │ +
101 std::deque<SubEntityInfo> temp_faces;
│ │ │ │ +
102
│ │ │ │ +
103 // iterate over all codim 0 elements on the grid
│ │ │ │ +
104 for (const auto& elmt : elements(this->gv_, Partitions::interior))
│ │ │ │ +
105 {
│ │ │ │ +
106 const auto geometry = elmt.geometry();
│ │ │ │ +
107 IndexType eindex = this->cellMapper_.index(elmt);
│ │ │ │
108
│ │ │ │ - │ │ │ │ -
111
│ │ │ │ -
113 unsigned int index;
│ │ │ │ -
114 };
│ │ │ │ -
│ │ │ │ +
109 // only do sth. if this element is "interesting"
│ │ │ │ +
110 // implicit cast is done automatically
│ │ │ │ +
111 if (predicate(elmt,0))
│ │ │ │ +
112 {
│ │ │ │ +
113 // add an entry to the element info map, the index will be set properly later
│ │ │ │ +
114 this->elmtInfo_.emplace(eindex, ElementInfo(element_index, elmt, 1));
│ │ │ │
115
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
120 {
│ │ │ │ -
│ │ │ │ -
121 VertexInfo(unsigned int idx_, const Vertex& p_) : idx(idx_), p(p_.seed())
│ │ │ │ -
122 {}
│ │ │ │ -
│ │ │ │ -
123 unsigned int idx;
│ │ │ │ - │ │ │ │ -
125 };
│ │ │ │ -
│ │ │ │ -
126
│ │ │ │ -
127
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
132 {
│ │ │ │ -
│ │ │ │ -
133 ElementInfo(unsigned int idx_, const Element& p_, unsigned int f_) : idx(idx_), faces(f_), p(p_.seed())
│ │ │ │ -
134 {}
│ │ │ │ -
│ │ │ │ -
135
│ │ │ │ -
137 unsigned int idx : 28;
│ │ │ │ -
138
│ │ │ │ -
140 unsigned int faces : 4;
│ │ │ │ -
141
│ │ │ │ - │ │ │ │ -
144 };
│ │ │ │ -
│ │ │ │ -
145
│ │ │ │ -
146
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
151 {
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
153 /*
│ │ │ │ -
154 * TODO: move default value of `geometryType_` to member declaration
│ │ │ │ -
155 * when removing support for older dune-geometry
│ │ │ │ -
156 */
│ │ │ │ -
157#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6)
│ │ │ │ -
158 : geometryType_(GeometryTypes::simplex(dim-codim))
│ │ │ │ -
159 {}
│ │ │ │ -
160#else
│ │ │ │ -
161 {
│ │ │ │ -
162 geometryType_.makeSimplex(dim-codim);
│ │ │ │ -
163 }
│ │ │ │ -
│ │ │ │ -
164#endif
│ │ │ │ -
165
│ │ │ │ -
│ │ │ │ -
166 SubEntityInfo(IndexType parent_, unsigned int num_in_parent_,
│ │ │ │ -
167 const Dune::GeometryType& geometryType)
│ │ │ │ -
168 : parent(parent_), num_in_parent(num_in_parent_), geometryType_(geometryType)
│ │ │ │ -
169 {}
│ │ │ │ -
│ │ │ │ -
170
│ │ │ │ -
│ │ │ │ -
171 unsigned int nCorners() const
│ │ │ │ -
172 {
│ │ │ │ -
173 return Dune::ReferenceElements<ctype, dim-codim>::general(geometryType_).size(dim-codim);
│ │ │ │ -
174 }
│ │ │ │ -
│ │ │ │ -
175
│ │ │ │ - │ │ │ │ -
178
│ │ │ │ -
180 unsigned int num_in_parent : 3;
│ │ │ │ -
181
│ │ │ │ -
183 Dune::GeometryType geometryType_;
│ │ │ │ -
184
│ │ │ │ -
191 CornerInfo corners[cube_corners]; // sim = numer of vertices in a simplex
│ │ │ │ -
192 };
│ │ │ │ -
│ │ │ │ -
193
│ │ │ │ -
194
│ │ │ │ -
195 typedef std::map<IndexType, ElementInfo> ElementInfoMap;
│ │ │ │ -
196 typedef std::map<IndexType, VertexInfo> VertexInfoMap;
│ │ │ │ -
197
│ │ │ │ -
198 /************************** MEMBER VARIABLES ************************/
│ │ │ │ -
199
│ │ │ │ - │ │ │ │ -
202
│ │ │ │ -
203 /* Geometrical and Topological Information */
│ │ │ │ -
204
│ │ │ │ -
206 std::vector<CoordinateInfo> coords_;
│ │ │ │ -
207
│ │ │ │ -
209 std::vector<SubEntityInfo> subEntities_;
│ │ │ │ -
210
│ │ │ │ - │ │ │ │ +
116 unsigned int numCorners = elmt.subEntities(dim);
│ │ │ │ +
117 unsigned int vertex_indices[numCorners]; // index in global vector
│ │ │ │ +
118 unsigned int vertex_numbers[numCorners]; // index in parent entity
│ │ │ │ +
119
│ │ │ │ +
120 // try for each of the faces vertices whether it is already inserted or not
│ │ │ │ +
121 for (unsigned int i = 0; i < numCorners; ++i)
│ │ │ │ +
122 {
│ │ │ │ +
123 vertex_numbers[i] = i;
│ │ │ │ +
124
│ │ │ │ +
125 // get the vertex pointer and the index from the index set
│ │ │ │ +
126 const Vertex vertex = elmt.template subEntity<dim>(vertex_numbers[i]);
│ │ │ │ +
127 IndexType vindex = this->gv_.indexSet().template index<dim>(vertex);
│ │ │ │ +
128
│ │ │ │ +
129 // if the vertex is not yet inserted in the vertex info map
│ │ │ │ +
130 // it is a new one -> it will be inserted now!
│ │ │ │ +
131 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex);
│ │ │ │ +
132 if (vimit == this->vtxInfo_.end())
│ │ │ │ +
133 {
│ │ │ │ +
134 // insert into the map
│ │ │ │ +
135 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex));
│ │ │ │ +
136 // remember this vertex' index
│ │ │ │ +
137 vertex_indices[i] = vertex_index;
│ │ │ │ +
138 // increase the current index
│ │ │ │ +
139 vertex_index++;
│ │ │ │ +
140 }
│ │ │ │ +
141 else
│ │ │ │ +
142 {
│ │ │ │ +
143 // only remember the vertex' index
│ │ │ │ +
144 vertex_indices[i] = vimit->second.idx;
│ │ │ │ +
145 }
│ │ │ │ +
146 }
│ │ │ │ +
147
│ │ │ │ +
148 // flip cell if necessary
│ │ │ │ +
149 {
│ │ │ │ +
150 switch (int(dim))
│ │ │ │ +
151 {
│ │ │ │ +
152 case 0 :
│ │ │ │ +
153 break;
│ │ │ │ +
154 case 1 :
│ │ │ │ +
155 {
│ │ │ │ +
156 // The following test only works if the zero-th coordinate is the
│ │ │ │ +
157 // one that defines the orientation. A sufficient condition for
│ │ │ │ +
158 // this is dimworld == 1
│ │ │ │ +
159 /* assert(dimworld==1); */
│ │ │ │ +
160 bool elementNormalDirection =
│ │ │ │ +
161 (geometry.corner(1)[0] < geometry.corner(0)[0]);
│ │ │ │ +
162 if ( positiveNormalDirection_ != elementNormalDirection )
│ │ │ │ +
163 {
│ │ │ │ +
164 std::swap(vertex_indices[0], vertex_indices[1]);
│ │ │ │ +
165 std::swap(vertex_numbers[0], vertex_numbers[1]);
│ │ │ │ +
166 }
│ │ │ │ +
167 break;
│ │ │ │ +
168 }
│ │ │ │ +
169 case 2 :
│ │ │ │ +
170 {
│ │ │ │ +
171 Dune::FieldVector<ctype, dimworld>
│ │ │ │ +
172 v0 = geometry.corner(1),
│ │ │ │ +
173 v1 = geometry.corner(2);
│ │ │ │ +
174 v0 -= geometry.corner(0);
│ │ │ │ +
175 v1 -= geometry.corner(0);
│ │ │ │ +
176 ctype normal_sign = v0[0]*v1[1] - v0[1]*v1[0];
│ │ │ │ +
177 bool elementNormalDirection = (normal_sign < 0);
│ │ │ │ +
178 if ( positiveNormalDirection_ != elementNormalDirection )
│ │ │ │ +
179 {
│ │ │ │ +
180 std::cout << "swap\n";
│ │ │ │ +
181 if (elmt.type().isCube())
│ │ │ │ +
182 {
│ │ │ │ +
183 for (int i = 0; i < (1<<dim); i+=2)
│ │ │ │ +
184 {
│ │ │ │ +
185 // swap i and i+1
│ │ │ │ +
186 std::swap(vertex_indices[i], vertex_indices[i+1]);
│ │ │ │ +
187 std::swap(vertex_numbers[i], vertex_numbers[i+1]);
│ │ │ │ +
188 }
│ │ │ │ +
189 } else if (elmt.type().isSimplex()) {
│ │ │ │ +
190 std::swap(vertex_indices[0], vertex_indices[1]);
│ │ │ │ +
191 std::swap(vertex_numbers[0], vertex_numbers[1]);
│ │ │ │ +
192 } else {
│ │ │ │ +
193 DUNE_THROW(Dune::Exception, "Unexpected Geometrytype");
│ │ │ │ +
194 }
│ │ │ │ +
195 }
│ │ │ │ +
196 break;
│ │ │ │ +
197 }
│ │ │ │ +
198 }
│ │ │ │ +
199 }
│ │ │ │ +
200
│ │ │ │ +
201 // add a new face to the temporary collection
│ │ │ │ +
202 temp_faces.emplace_back(eindex, 0, elmt.type());
│ │ │ │ +
203 element_index++;
│ │ │ │ +
204 for (unsigned int i=0; i<numCorners; i++) {
│ │ │ │ +
205 temp_faces.back().corners[i].idx = vertex_indices[i];
│ │ │ │ +
206 // remember the vertices' numbers in parent element's vertices
│ │ │ │ +
207 temp_faces.back().corners[i].num = vertex_numbers[i];
│ │ │ │ +
208 }
│ │ │ │ +
209
│ │ │ │ +
210 }
│ │ │ │ +
211 } // end loop over elements
│ │ │ │ +
212
│ │ │ │ +
213 // allocate the array for the face specific information...
│ │ │ │ +
214 this->subEntities_.resize(element_index);
│ │ │ │ +
215 // ...and fill in the data from the temporary containers
│ │ │ │ +
216 copy(temp_faces.begin(), temp_faces.end(), this->subEntities_.begin());
│ │ │ │
217
│ │ │ │ - │ │ │ │ -
224
│ │ │ │ - │ │ │ │ -
226
│ │ │ │ -
227public:
│ │ │ │ -
228
│ │ │ │ -
229 /* C O N S T R U C T O R S A N D D E S T R U C T O R S */
│ │ │ │ -
230
│ │ │ │ -
│ │ │ │ -
235 Extractor(const GV& gv)
│ │ │ │ -
236 : gv_(gv)
│ │ │ │ -
237#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6)
│ │ │ │ -
238 , cellMapper_(gv, mcmgElementLayout())
│ │ │ │ -
239#else
│ │ │ │ -
240 , cellMapper_(gv)
│ │ │ │ -
241#endif
│ │ │ │ -
242 {}
│ │ │ │ -
│ │ │ │ -
243
│ │ │ │ -
244 /* F U N C T I O N A L I T Y */
│ │ │ │ -
245
│ │ │ │ -
│ │ │ │ -
249 void clear()
│ │ │ │ -
250 {
│ │ │ │ -
251 // this is an inofficial way on how to free the memory allocated
│ │ │ │ -
252 // by a std::vector
│ │ │ │ -
253 {
│ │ │ │ -
254 std::vector<CoordinateInfo> dummy;
│ │ │ │ -
255 coords_.swap(dummy);
│ │ │ │ -
256 }
│ │ │ │ -
257 {
│ │ │ │ -
258 std::vector<SubEntityInfo> dummy;
│ │ │ │ -
259 subEntities_.swap(dummy);
│ │ │ │ -
260 }
│ │ │ │ -
261
│ │ │ │ -
262 // ...then clear the maps themselves, too
│ │ │ │ -
263 vtxInfo_.clear();
│ │ │ │ -
264 elmtInfo_.clear();
│ │ │ │ -
265 }
│ │ │ │ -
│ │ │ │ -
266
│ │ │ │ -
267
│ │ │ │ -
268 /* G E T T E R S */
│ │ │ │ -
269
│ │ │ │ -
│ │ │ │ -
275 void getCoords(std::vector<Dune::FieldVector<ctype, dimworld> >& coords) const
│ │ │ │ -
276 {
│ │ │ │ -
277 coords.resize(coords_.size());
│ │ │ │ -
278 for (unsigned int i = 0; i < coords_.size(); ++i)
│ │ │ │ -
279 coords[i] = coords_[i].coord;
│ │ │ │ -
280 }
│ │ │ │ -
│ │ │ │ -
281
│ │ │ │ -
282
│ │ │ │ -
│ │ │ │ -
287 unsigned int nCoords() const
│ │ │ │ -
288 {
│ │ │ │ -
289 return coords_.size();
│ │ │ │ -
290 }
│ │ │ │ -
│ │ │ │ -
291
│ │ │ │ -
│ │ │ │ -
293 void getGeometryTypes(std::vector<Dune::GeometryType>& geometryTypes) const
│ │ │ │ -
294 {
│ │ │ │ -
295 geometryTypes.resize(subEntities_.size());
│ │ │ │ -
296 for (size_t i=0; i<subEntities_.size(); i++)
│ │ │ │ -
297 geometryTypes[i] = subEntities_[i].geometryType_;
│ │ │ │ -
298 }
│ │ │ │ -
│ │ │ │ -
299
│ │ │ │ -
300
│ │ │ │ -
│ │ │ │ -
304 void getFaces(std::vector<VertexVector>& faces) const
│ │ │ │ -
305 {
│ │ │ │ -
306 faces.resize(subEntities_.size());
│ │ │ │ -
307 for (unsigned int i = 0; i < subEntities_.size(); ++i) {
│ │ │ │ -
308 faces[i].resize(subEntities_[i].nCorners());
│ │ │ │ -
309 for (unsigned int j = 0; j < subEntities_[i].nCorners(); ++j)
│ │ │ │ -
310 faces[i][j] = subEntities_[i].corners[j].idx;
│ │ │ │ -
311 }
│ │ │ │ -
312 }
│ │ │ │ -
│ │ │ │ -
313
│ │ │ │ -
314
│ │ │ │ -
│ │ │ │ -
323 bool faceIndices(const Element& e, int& first, int& count) const
│ │ │ │ -
324 {
│ │ │ │ -
325 typename ElementInfoMap::const_iterator it =
│ │ │ │ -
326 elmtInfo_.find(cellMapper_.map(e));
│ │ │ │ -
327 if (it == elmtInfo_.end())
│ │ │ │ -
328 {
│ │ │ │ -
329 first = -1;
│ │ │ │ -
330 count = 0;
│ │ │ │ -
331 return false;
│ │ │ │ -
332 }
│ │ │ │ -
333 // the iterator is valid, fill the out params
│ │ │ │ -
334 first = it->second.idx;
│ │ │ │ -
335 count = it->second.faces;
│ │ │ │ -
336 return true;
│ │ │ │ -
337 }
│ │ │ │ -
│ │ │ │ -
338
│ │ │ │ -
339
│ │ │ │ -
│ │ │ │ -
345 int indexInInside(unsigned int index) const
│ │ │ │ -
346 {
│ │ │ │ -
347 return index < subEntities_.size() ? subEntities_[index].num_in_parent : -1;
│ │ │ │ -
348 }
│ │ │ │ -
│ │ │ │ -
349
│ │ │ │ -
350 // /**
│ │ │ │ -
351 // * @brief tests that a given entry in the extraction set does have local couplings
│ │ │ │ -
352 // * @todo parallel interface
│ │ │ │ -
353 // */
│ │ │ │ -
354 // bool contains (unsigned int global, unsigned int & local) const
│ │ │ │ -
355 // {
│ │ │ │ -
356 // local = global;
│ │ │ │ -
357 // return true;
│ │ │ │ -
358 // }
│ │ │ │ -
359
│ │ │ │ -
│ │ │ │ -
363 const GridView & gridView() const
│ │ │ │ -
364 {
│ │ │ │ -
365 return gv_;
│ │ │ │ -
366 }
│ │ │ │ -
│ │ │ │ -
367
│ │ │ │ -
│ │ │ │ -
368 const Grid& grid() const
│ │ │ │ -
369 {
│ │ │ │ -
370 return gv_.grid();
│ │ │ │ -
371 }
│ │ │ │ -
│ │ │ │ -
372
│ │ │ │ -
379 Element
│ │ │ │ -
│ │ │ │ -
380 element(unsigned int index) const
│ │ │ │ -
381 {
│ │ │ │ -
382 if (index >= subEntities_.size())
│ │ │ │ -
383 DUNE_THROW(Dune::GridError, "invalid face index");
│ │ │ │ -
384 const ElementSeed seed = elmtInfo_.at(subEntities_[index].parent).p;
│ │ │ │ -
385 return grid().entity(seed);
│ │ │ │ -
386 }
│ │ │ │ -
│ │ │ │ -
387
│ │ │ │ -
388#if 1
│ │ │ │ -
395 Vertex
│ │ │ │ -
│ │ │ │ -
396 vertex(unsigned int index) const
│ │ │ │ -
397 {
│ │ │ │ -
398 if (index >= coords_.size())
│ │ │ │ -
399 DUNE_THROW(Dune::GridError, "invalid coordinate index");
│ │ │ │ -
400 const VertexSeed seed = vtxInfo_.at(coords_[index].vtxindex).p;
│ │ │ │ -
401 return grid().entity(seed);
│ │ │ │ -
402 }
│ │ │ │ -
│ │ │ │ -
403#endif
│ │ │ │ -
404
│ │ │ │ -
│ │ │ │ -
406 Geometry geometry(unsigned int index) const;
│ │ │ │ -
407
│ │ │ │ -
│ │ │ │ -
409 LocalGeometry geometryLocal(unsigned int index) const;
│ │ │ │ -
410
│ │ │ │ -
411};
│ │ │ │ -
412
│ │ │ │ -
413
│ │ │ │ -
415template<typename GV, int cd>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
417{
│ │ │ │ -
418 std::vector<Coords> corners(subEntities_[index].nCorners());
│ │ │ │ -
419 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i)
│ │ │ │ -
420 corners[i] = coords_[subEntities_[index].corners[i].idx].coord;
│ │ │ │ -
421
│ │ │ │ -
422 return Geometry(subEntities_[index].geometryType_, corners);
│ │ │ │ -
423}
│ │ │ │ -
│ │ │ │ -
424
│ │ │ │ -
425
│ │ │ │ -
427template<typename GV, int cd>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
429{
│ │ │ │ -
430 std::vector<LocalCoords> corners(subEntities_[index].nCorners());
│ │ │ │ -
431
│ │ │ │ -
432 // get face info
│ │ │ │ -
433 const SubEntityInfo & face = subEntities_[index];
│ │ │ │ -
434 Dune::GeometryType facetype = subEntities_[index].geometryType_;
│ │ │ │ -
435
│ │ │ │ -
436 // get reference element
│ │ │ │ -
437 const auto elmtseed = elmtInfo_.at(face.parent).p;
│ │ │ │ -
438 const auto elmt = grid().entity(elmtseed);
│ │ │ │ -
439 const Dune::GeometryType celltype = elmt.type();
│ │ │ │ -
440 const auto& re = Dune::ReferenceElements<ctype, dim>::general(celltype);
│ │ │ │ -
441 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i)
│ │ │ │ -
442 corners[i] = re.position(face.corners[i].num,dim);
│ │ │ │ -
443
│ │ │ │ -
444 return LocalGeometry(facetype, corners);
│ │ │ │ -
445}
│ │ │ │ -
│ │ │ │ -
│ │ │ │ -
446
│ │ │ │ -
447} // namespace GridGlue
│ │ │ │ -
448
│ │ │ │ -
449} // namespace Dune
│ │ │ │ -
450
│ │ │ │ -
451#endif // DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH
│ │ │ │ -
│ │ │ │ -
│ │ │ │ +
218 // now first write the array with the coordinates...
│ │ │ │ +
219 this->coords_.resize(this->vtxInfo_.size());
│ │ │ │ +
220 for (const auto& vinfo : this->vtxInfo_)
│ │ │ │ +
221 {
│ │ │ │ +
222 // get a pointer to the associated info object
│ │ │ │ +
223 CoordinateInfo* current = &this->coords_[vinfo.second.idx];
│ │ │ │ +
224 // store this coordinates index // NEEDED?
│ │ │ │ +
225 current->index = vinfo.second.idx;
│ │ │ │ +
226 // store the vertex' index for the index2vertex mapping
│ │ │ │ +
227 current->vtxindex = vinfo.first;
│ │ │ │ +
228 // store the vertex' coordinates under the associated index
│ │ │ │ +
229 // in the coordinates array
│ │ │ │ +
230 const auto vtx = this->grid().entity(vinfo.second.p);
│ │ │ │ +
231 current->coord = vtx.geometry().corner(0);
│ │ │ │ +
232 }
│ │ │ │ +
233
│ │ │ │ +
234}
│ │ │ │ +
235
│ │ │ │ +
236} // namespace GridGlue
│ │ │ │ +
237
│ │ │ │ +
238} // namespace Dune
│ │ │ │ +
239
│ │ │ │ +
240#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ +
extractor base class
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ +
Definition codim0extractor.hh:40
│ │ │ │ +
bool & positiveNormalDirection()
Definition codim0extractor.hh:75
│ │ │ │ +
Extractor< GV, 0 >::IndexType IndexType
Definition codim0extractor.hh:49
│ │ │ │ +
const bool & positiveNormalDirection() const
Definition codim0extractor.hh:76
│ │ │ │ +
GV::Traits::template Codim< dim >::Entity Vertex
Definition codim0extractor.hh:51
│ │ │ │ +
Extractor< GV, 0 >::CoordinateInfo CoordinateInfo
Definition codim0extractor.hh:59
│ │ │ │ +
Extractor< GV, 0 >::VertexInfo VertexInfo
Definition codim0extractor.hh:58
│ │ │ │ +
Extractor< GV, 0 >::ctype ctype
Definition codim0extractor.hh:46
│ │ │ │ +
bool positiveNormalDirection_
Definition codim0extractor.hh:79
│ │ │ │ +
Extractor< GV, 0 >::VertexInfoMap VertexInfoMap
Definition codim0extractor.hh:60
│ │ │ │ +
std::function< bool(const Element &, unsigned int subentity)> Predicate
Definition codim0extractor.hh:53
│ │ │ │ +
Codim0Extractor(const GV &gv, const Predicate &predicate)
Constructor.
Definition codim0extractor.hh:67
│ │ │ │ +
Extractor< GV, 0 >::ElementInfo ElementInfo
Definition codim0extractor.hh:57
│ │ │ │ +
GV::Traits::template Codim< 0 >::Entity Element
Definition codim0extractor.hh:52
│ │ │ │ +
Extractor< GV, 0 >::SubEntityInfo SubEntityInfo
Definition codim0extractor.hh:56
│ │ │ │
Provides codimension-independent methods for grid extraction.
Definition extractor.hh:46
│ │ │ │ -
GV::Traits::template Codim< dim >::Entity Vertex
Definition extractor.hh:63
│ │ │ │ -
VertexInfoMap vtxInfo_
a map enabling faster access to vertices and coordinates
Definition extractor.hh:216
│ │ │ │ -
const Grid & grid() const
Definition extractor.hh:368
│ │ │ │ -
MultipleCodimMultipleGeomTypeMapper< GridView, MCMGElementLayout > CellMapper
Definition extractor.hh:74
│ │ │ │ -
Element element(unsigned int index) const
gets the parent element for a given face index, throws an exception if index not valid
Definition extractor.hh:380
│ │ │ │ -
int indexInInside(unsigned int index) const
gets the number face in the parent element
Definition extractor.hh:345
│ │ │ │ -
Dune::FieldVector< ctype, dim > LocalCoords
Definition extractor.hh:61
│ │ │ │ -
LocalGeometry geometryLocal(unsigned int index) const
Get geometry of the extracted face in element coordinates.
Definition extractor.hh:428
│ │ │ │ -
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ -
Dune::MultiLinearGeometry< ctype, dim-codim, dimworld > Geometry
Definition extractor.hh:81
│ │ │ │ +
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │
int IndexType
Definition extractor.hh:77
│ │ │ │ -
std::vector< CoordinateInfo > coords_
all information about the corner vertices of the extracted
Definition extractor.hh:206
│ │ │ │ -
GV::Traits::template Codim< 0 >::Entity Element
Definition extractor.hh:66
│ │ │ │ -
const GridView & gridView() const
give access to the Dune::GridView where this Patch belongs to
Definition extractor.hh:363
│ │ │ │ -
void getFaces(std::vector< VertexVector > &faces) const
Get the corners of the extracted subentities.
Definition extractor.hh:304
│ │ │ │ -
std::vector< unsigned int > VertexVector
Definition extractor.hh:69
│ │ │ │ -
const GridView gv_
the grid object to extract the surface from
Definition extractor.hh:201
│ │ │ │ -
std::vector< SubEntityInfo > subEntities_
all information about the extracted subEntities
Definition extractor.hh:209
│ │ │ │ -
static constexpr int cube_corners
Definition extractor.hh:54
│ │ │ │ -
Vertex vertex(unsigned int index) const
gets the vertex for a given coordinate index throws an exception if index not valid
Definition extractor.hh:396
│ │ │ │ -
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │ -
Dune::FieldVector< ctype, dimworld > Coords
Definition extractor.hh:60
│ │ │ │ -
void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const
Get the list of geometry types.
Definition extractor.hh:293
│ │ │ │ +
static constexpr auto codim
Definition extractor.hh:52
│ │ │ │
std::map< IndexType, VertexInfo > VertexInfoMap
Definition extractor.hh:196
│ │ │ │ -
GridView::Grid Grid
Definition extractor.hh:57
│ │ │ │ -
bool faceIndices(const Element &e, int &first, int &count) const
gets index of first subentity as well as the total number of subentities that were extracted from thi...
Definition extractor.hh:323
│ │ │ │ -
Geometry geometry(unsigned int index) const
Get world geometry of the extracted face.
Definition extractor.hh:416
│ │ │ │ -
GV GridView
Definition extractor.hh:56
│ │ │ │ -
unsigned int nCoords() const
getter for the count of coordinates
Definition extractor.hh:287
│ │ │ │
GV::Grid::ctype ctype
Definition extractor.hh:59
│ │ │ │ -
std::map< IndexType, ElementInfo > ElementInfoMap
Definition extractor.hh:195
│ │ │ │ -
Extractor(const GV &gv)
Constructor.
Definition extractor.hh:235
│ │ │ │ -
void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) const
getter for the coordinates array
Definition extractor.hh:275
│ │ │ │ -
CellMapper cellMapper_
Definition extractor.hh:225
│ │ │ │ -
Element::EntitySeed ElementSeed
Definition extractor.hh:67
│ │ │ │ -
Vertex::EntitySeed VertexSeed
Definition extractor.hh:64
│ │ │ │ -
ElementInfoMap elmtInfo_
a map enabling faster access to elements and faces
Definition extractor.hh:223
│ │ │ │ -
void clear()
delete everything build up so far and free the memory
Definition extractor.hh:249
│ │ │ │ -
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │ -
Dune::MultiLinearGeometry< ctype, dim-codim, dim > LocalGeometry
Definition extractor.hh:82
│ │ │ │ -
Helpful struct holding one index for the coordinate (vertex) to which it is associated and the elemen...
Definition extractor.hh:92
│ │ │ │ -
unsigned int idx
index of the vertex
Definition extractor.hh:93
│ │ │ │ -
unsigned int num
element corner
Definition extractor.hh:94
│ │ │ │ +
static constexpr auto dim
Definition extractor.hh:51
│ │ │ │ │ │ │ │ -
CoordinateInfo(unsigned int index_, IndexType vtxindex_)
Definition extractor.hh:102
│ │ │ │ -
unsigned int index
the index of this coordinate (in internal storage scheme) // NEEDED??
Definition extractor.hh:113
│ │ │ │ -
CoordinateInfo()
Definition extractor.hh:99
│ │ │ │ -
Coords coord
the coordinate
Definition extractor.hh:110
│ │ │ │ -
IndexType vtxindex
the index of the parent element (from index set)
Definition extractor.hh:107
│ │ │ │
simple struct holding a vertex pointer and an index
Definition extractor.hh:120
│ │ │ │ -
unsigned int idx
Definition extractor.hh:123
│ │ │ │ -
VertexInfo(unsigned int idx_, const Vertex &p_)
Definition extractor.hh:121
│ │ │ │ -
VertexSeed p
Definition extractor.hh:124
│ │ │ │
simple struct holding an element seed and an index
Definition extractor.hh:132
│ │ │ │ -
unsigned int idx
the index of this element's first face in the internal list of extracted faces
Definition extractor.hh:137
│ │ │ │ -
unsigned int faces
the number of extracted faces for this element
Definition extractor.hh:140
│ │ │ │ -
ElementInfo(unsigned int idx_, const Element &p_, unsigned int f_)
Definition extractor.hh:133
│ │ │ │ -
ElementSeed p
the entity seed for the element
Definition extractor.hh:143
│ │ │ │
Holds some information about an element's subentity involved in a coupling.
Definition extractor.hh:151
│ │ │ │ -
unsigned int nCorners() const
Definition extractor.hh:171
│ │ │ │ -
CornerInfo corners[cube_corners]
the corner indices plus the numbers of the vertices in the parent element
Definition extractor.hh:191
│ │ │ │ -
IndexType parent
the index of the parent element (from index set)
Definition extractor.hh:177
│ │ │ │ -
SubEntityInfo(IndexType parent_, unsigned int num_in_parent_, const Dune::GeometryType &geometryType)
Definition extractor.hh:166
│ │ │ │ -
unsigned int num_in_parent
the number of the face in the parent element
Definition extractor.hh:180
│ │ │ │ -
Dune::GeometryType geometryType_
The GeometryType of the subentity.
Definition extractor.hh:183
│ │ │ │ -
SubEntityInfo()
Definition extractor.hh:152
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,607 +1,325 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _e_x_t_r_a_c_t_o_r_s │ │ │ │ │ -extractor.hh │ │ │ │ │ +codim0extractor.hh │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ 5/* │ │ │ │ │ -6 * Filename: extractor.hh │ │ │ │ │ +6 * Filename: codim0extractor.hh │ │ │ │ │ 7 * Version: 1.0 │ │ │ │ │ -8 * Created on: Oct 05, 2009 │ │ │ │ │ -9 * Author: Christian Engwer │ │ │ │ │ +8 * Created on: Jun 23, 2009 │ │ │ │ │ +9 * Author: Oliver Sander, Christian Engwer │ │ │ │ │ 10 * --------------------------------- │ │ │ │ │ 11 * Project: dune-grid-glue │ │ │ │ │ -12 * Description: base class for all grid extractors │ │ │ │ │ +12 * Description: base class for grid extractors extracting surface grids │ │ │ │ │ 13 * │ │ │ │ │ 14 */ │ │ │ │ │ -20#ifndef DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH │ │ │ │ │ -21#define DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH │ │ │ │ │ +20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH │ │ │ │ │ +21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH │ │ │ │ │ 22 │ │ │ │ │ -23#include │ │ │ │ │ -24#include │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27#include │ │ │ │ │ -28#include │ │ │ │ │ -29#include │ │ │ │ │ -30#include │ │ │ │ │ -31#include │ │ │ │ │ -32#include │ │ │ │ │ -33 │ │ │ │ │ -34namespace _D_u_n_e { │ │ │ │ │ -35 │ │ │ │ │ -36 namespace GridGlue { │ │ │ │ │ -37 │ │ │ │ │ -44template │ │ │ │ │ -_4_5class _E_x_t_r_a_c_t_o_r │ │ │ │ │ -46{ │ │ │ │ │ -47 │ │ │ │ │ -48public: │ │ │ │ │ -49 │ │ │ │ │ -_5_0 static constexpr auto _d_i_m_w_o_r_l_d = GV::dimensionworld; │ │ │ │ │ -_5_1 static constexpr auto _d_i_m = GV::dimension; │ │ │ │ │ -_5_2 static constexpr auto _c_o_d_i_m = cd; │ │ │ │ │ -53 │ │ │ │ │ -_5_4 static constexpr int _c_u_b_e___c_o_r_n_e_r_s = 1 << (_d_i_m-_c_o_d_i_m); │ │ │ │ │ -55 │ │ │ │ │ -_5_6 typedef GV _G_r_i_d_V_i_e_w; │ │ │ │ │ -_5_7 typedef typename GridView::Grid _G_r_i_d; │ │ │ │ │ -58 │ │ │ │ │ -_5_9 typedef typename GV::Grid::ctype _c_t_y_p_e; │ │ │ │ │ -_6_0 typedef Dune::FieldVector _C_o_o_r_d_s; │ │ │ │ │ -_6_1 typedef Dune::FieldVector _L_o_c_a_l_C_o_o_r_d_s; │ │ │ │ │ -62 │ │ │ │ │ -_6_3 typedef typename GV::Traits::template Codim::Entity _V_e_r_t_e_x; │ │ │ │ │ -_6_4 typedef typename Vertex::EntitySeed _V_e_r_t_e_x_S_e_e_d; │ │ │ │ │ -65 │ │ │ │ │ -_6_6 typedef typename GV::Traits::template Codim<0>::Entity _E_l_e_m_e_n_t; │ │ │ │ │ -_6_7 typedef typename Element::EntitySeed _E_l_e_m_e_n_t_S_e_e_d; │ │ │ │ │ -68 │ │ │ │ │ -_6_9 typedef std::vector _V_e_r_t_e_x_V_e_c_t_o_r; │ │ │ │ │ -70 │ │ │ │ │ -71#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6) │ │ │ │ │ -72 using _C_e_l_l_M_a_p_p_e_r = MultipleCodimMultipleGeomTypeMapper; │ │ │ │ │ -73#else │ │ │ │ │ -_7_4 using _C_e_l_l_M_a_p_p_e_r = MultipleCodimMultipleGeomTypeMapper; │ │ │ │ │ -75#endif │ │ │ │ │ -76 // typedef typename CellMapper::IndexType IndexType; │ │ │ │ │ -_7_7 typedef int _I_n_d_e_x_T_y_p_e; │ │ │ │ │ -78public: │ │ │ │ │ -79 │ │ │ │ │ -80 // transformations │ │ │ │ │ -_8_1 typedef Dune::MultiLinearGeometry<_c_t_y_p_e, _d_i_m-_c_o_d_i_m, _d_i_m_w_o_r_l_d> _G_e_o_m_e_t_r_y; │ │ │ │ │ -_8_2 typedef Dune::MultiLinearGeometry<_c_t_y_p_e, _d_i_m-_c_o_d_i_m, _d_i_m> _L_o_c_a_l_G_e_o_m_e_t_r_y; │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ +25 │ │ │ │ │ +26#include │ │ │ │ │ +27#include │ │ │ │ │ +28 │ │ │ │ │ +29#include "_e_x_t_r_a_c_t_o_r_._h_h" │ │ │ │ │ +30 │ │ │ │ │ +31namespace _D_u_n_e { │ │ │ │ │ +32 │ │ │ │ │ +33 namespace GridGlue { │ │ │ │ │ +34 │ │ │ │ │ +38template │ │ │ │ │ +_3_9class _C_o_d_i_m_0_E_x_t_r_a_c_t_o_r : public _E_x_t_r_a_c_t_o_r │ │ │ │ │ +40{ │ │ │ │ │ +41 │ │ │ │ │ +42public: │ │ │ │ │ +43 │ │ │ │ │ +44 /* 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 */ │ │ │ │ │ +45 using _E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m; │ │ │ │ │ +_4_6 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_0_>_:_:_c_t_y_p_e _c_t_y_p_e; │ │ │ │ │ +47 using _E_x_t_r_a_c_t_o_r_:_:_d_i_m; │ │ │ │ │ +48 using _E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d; │ │ │ │ │ +_4_9 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_0_>_:_:_I_n_d_e_x_T_y_p_e _I_n_d_e_x_T_y_p_e; │ │ │ │ │ +50 │ │ │ │ │ +_5_1 typedef typename GV::Traits::template Codim::Entity _V_e_r_t_e_x; │ │ │ │ │ +_5_2 typedef typename GV::Traits::template Codim<0>::Entity _E_l_e_m_e_n_t; │ │ │ │ │ +_5_3 typedef std::function │ │ │ │ │ +_P_r_e_d_i_c_a_t_e; │ │ │ │ │ +54 │ │ │ │ │ +55 // import typedefs from base class │ │ │ │ │ +_5_6 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_0_>_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o _S_u_b_E_n_t_i_t_y_I_n_f_o; │ │ │ │ │ +_5_7 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_0_>_:_:_E_l_e_m_e_n_t_I_n_f_o _E_l_e_m_e_n_t_I_n_f_o; │ │ │ │ │ +_5_8 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_0_>_:_:_V_e_r_t_e_x_I_n_f_o _V_e_r_t_e_x_I_n_f_o; │ │ │ │ │ +_5_9 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_0_>_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o _C_o_o_r_d_i_n_a_t_e_I_n_f_o; │ │ │ │ │ +_6_0 typedef typename _E_x_t_r_a_c_t_o_r_<_G_V_,_0_>_:_:_V_e_r_t_e_x_I_n_f_o_M_a_p _V_e_r_t_e_x_I_n_f_o_M_a_p; │ │ │ │ │ +61 │ │ │ │ │ +_6_7 _C_o_d_i_m_0_E_x_t_r_a_c_t_o_r(const GV& gv, const _P_r_e_d_i_c_a_t_e& predicate) │ │ │ │ │ +68 : _E_x_t_r_a_c_t_o_r(gv), _p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n__(false) │ │ │ │ │ +69 { │ │ │ │ │ +70 std::cout << "This is Codim0Extractor on a <" │ │ │ │ │ +71 << GV::dimension << "," << GV::dimensionworld << "> grid!" << std::endl; │ │ │ │ │ +72 update(predicate); │ │ │ │ │ +73 } │ │ │ │ │ +74 │ │ │ │ │ +_7_5 bool & _p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n() { return _p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n__; } │ │ │ │ │ +_7_6 const bool & _p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n() const { return │ │ │ │ │ +_p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n__; } │ │ │ │ │ +77 │ │ │ │ │ +78protected: │ │ │ │ │ +_7_9 bool _p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n__; │ │ │ │ │ +80private: │ │ │ │ │ +81 void update(const _P_r_e_d_i_c_a_t_e& predicate); │ │ │ │ │ +82}; │ │ │ │ │ 83 │ │ │ │ │ -84protected: │ │ │ │ │ -85 /************************** PRIVATE SUBCLASSES **********************/ │ │ │ │ │ -86 │ │ │ │ │ -_9_1 struct _C_o_r_n_e_r_I_n_f_o │ │ │ │ │ -92 { │ │ │ │ │ -_9_3 unsigned int _i_d_x : 28; │ │ │ │ │ -_9_4 unsigned int _n_u_m : 4; │ │ │ │ │ -95 }; │ │ │ │ │ -96 │ │ │ │ │ -_9_7 struct _C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ -98 { │ │ │ │ │ -_9_9 _C_o_o_r_d_i_n_a_t_e_I_n_f_o() │ │ │ │ │ -100 {} │ │ │ │ │ -101 │ │ │ │ │ -_1_0_2 _C_o_o_r_d_i_n_a_t_e_I_n_f_o(unsigned int index_, _I_n_d_e_x_T_y_p_e vtxindex_) │ │ │ │ │ -103 : _v_t_x_i_n_d_e_x(vtxindex_), _i_n_d_e_x(index_) │ │ │ │ │ -104 {} │ │ │ │ │ -105 │ │ │ │ │ -_1_0_7 _I_n_d_e_x_T_y_p_e _v_t_x_i_n_d_e_x; │ │ │ │ │ +84 │ │ │ │ │ +85template │ │ │ │ │ +86void _C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_<_G_V_>_:_:_u_p_d_a_t_e(const Predicate& predicate) │ │ │ │ │ +87{ │ │ │ │ │ +88 // In this first pass iterate over all entities of codim 0. │ │ │ │ │ +89 // Get its corner vertices, find resp. store them together with their │ │ │ │ │ +associated index, │ │ │ │ │ +90 // and remember the indices of the corners. │ │ │ │ │ +91 │ │ │ │ │ +92 // free everything there is in this object │ │ │ │ │ +93 this->clear(); │ │ │ │ │ +94 │ │ │ │ │ +95 // several counter for consecutive indexing are needed │ │ │ │ │ +96 size_t element_index = 0; │ │ │ │ │ +97 size_t vertex_index = 0; │ │ │ │ │ +98 │ │ │ │ │ +99 // a temporary container where newly acquired face │ │ │ │ │ +100 // information can be stored at first │ │ │ │ │ +101 std::deque temp_faces; │ │ │ │ │ +102 │ │ │ │ │ +103 // iterate over all codim 0 elements on the grid │ │ │ │ │ +104 for (const auto& elmt : elements(this->gv_, Partitions::interior)) │ │ │ │ │ +105 { │ │ │ │ │ +106 const auto geometry = elmt.geometry(); │ │ │ │ │ +107 IndexType eindex = this->cellMapper_.index(elmt); │ │ │ │ │ 108 │ │ │ │ │ -_1_1_0 _C_o_o_r_d_s _c_o_o_r_d; │ │ │ │ │ -111 │ │ │ │ │ -_1_1_3 unsigned int _i_n_d_e_x; │ │ │ │ │ -114 }; │ │ │ │ │ +109 // only do sth. if this element is "interesting" │ │ │ │ │ +110 // implicit cast is done automatically │ │ │ │ │ +111 if (predicate(elmt,0)) │ │ │ │ │ +112 { │ │ │ │ │ +113 // add an entry to the element info map, the index will be set properly │ │ │ │ │ +later │ │ │ │ │ +114 this->elmtInfo_.emplace(eindex, ElementInfo(element_index, elmt, 1)); │ │ │ │ │ 115 │ │ │ │ │ -_1_1_9 struct _V_e_r_t_e_x_I_n_f_o │ │ │ │ │ -120 { │ │ │ │ │ -_1_2_1 _V_e_r_t_e_x_I_n_f_o(unsigned int idx_, const _V_e_r_t_e_x& p_) : _i_d_x(idx_), _p(p_.seed()) │ │ │ │ │ -122 {} │ │ │ │ │ -_1_2_3 unsigned int _i_d_x; │ │ │ │ │ -_1_2_4 _V_e_r_t_e_x_S_e_e_d _p; │ │ │ │ │ -125 }; │ │ │ │ │ -126 │ │ │ │ │ -127 │ │ │ │ │ -_1_3_1 struct _E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ -132 { │ │ │ │ │ -_1_3_3 _E_l_e_m_e_n_t_I_n_f_o(unsigned int idx_, const _E_l_e_m_e_n_t& p_, unsigned int f_) : _i_d_x │ │ │ │ │ -(idx_), _f_a_c_e_s(f_), _p(p_.seed()) │ │ │ │ │ -134 {} │ │ │ │ │ -135 │ │ │ │ │ -_1_3_7 unsigned int _i_d_x : 28; │ │ │ │ │ -138 │ │ │ │ │ -_1_4_0 unsigned int _f_a_c_e_s : 4; │ │ │ │ │ -141 │ │ │ │ │ -_1_4_3 _E_l_e_m_e_n_t_S_e_e_d _p; │ │ │ │ │ -144 }; │ │ │ │ │ -145 │ │ │ │ │ -146 │ │ │ │ │ -_1_5_0 struct _S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ +116 unsigned int numCorners = elmt.subEntities(dim); │ │ │ │ │ +117 unsigned int vertex_indices[numCorners]; // index in global vector │ │ │ │ │ +118 unsigned int vertex_numbers[numCorners]; // index in parent entity │ │ │ │ │ +119 │ │ │ │ │ +120 // try for each of the faces vertices whether it is already inserted or not │ │ │ │ │ +121 for (unsigned int i = 0; i < numCorners; ++i) │ │ │ │ │ +122 { │ │ │ │ │ +123 vertex_numbers[i] = i; │ │ │ │ │ +124 │ │ │ │ │ +125 // get the vertex pointer and the index from the index set │ │ │ │ │ +126 const Vertex vertex = elmt.template subEntity(vertex_numbers[i]); │ │ │ │ │ +127 IndexType vindex = this->gv_.indexSet().template index(vertex); │ │ │ │ │ +128 │ │ │ │ │ +129 // if the vertex is not yet inserted in the vertex info map │ │ │ │ │ +130 // it is a new one -> it will be inserted now! │ │ │ │ │ +131 typename VertexInfoMap::iterator vimit = this->vtxInfo_.find(vindex); │ │ │ │ │ +132 if (vimit == this->vtxInfo_.end()) │ │ │ │ │ +133 { │ │ │ │ │ +134 // insert into the map │ │ │ │ │ +135 this->vtxInfo_.emplace(vindex, VertexInfo(vertex_index, vertex)); │ │ │ │ │ +136 // remember this vertex' index │ │ │ │ │ +137 vertex_indices[i] = vertex_index; │ │ │ │ │ +138 // increase the current index │ │ │ │ │ +139 vertex_index++; │ │ │ │ │ +140 } │ │ │ │ │ +141 else │ │ │ │ │ +142 { │ │ │ │ │ +143 // only remember the vertex' index │ │ │ │ │ +144 vertex_indices[i] = vimit->second.idx; │ │ │ │ │ +145 } │ │ │ │ │ +146 } │ │ │ │ │ +147 │ │ │ │ │ +148 // flip cell if necessary │ │ │ │ │ +149 { │ │ │ │ │ +150 switch (int(dim)) │ │ │ │ │ 151 { │ │ │ │ │ -_1_5_2 _S_u_b_E_n_t_i_t_y_I_n_f_o() │ │ │ │ │ -153 /* │ │ │ │ │ -154 * TODO: move default value of `geometryType_` to member declaration │ │ │ │ │ -155 * when removing support for older dune-geometry │ │ │ │ │ -156 */ │ │ │ │ │ -157#if DUNE_VERSION_NEWER(DUNE_GEOMETRY, 2, 6) │ │ │ │ │ -158 : _g_e_o_m_e_t_r_y_T_y_p_e__(GeometryTypes::simplex(_d_i_m-_c_o_d_i_m)) │ │ │ │ │ -159 {} │ │ │ │ │ -160#else │ │ │ │ │ -161 { │ │ │ │ │ -162 _g_e_o_m_e_t_r_y_T_y_p_e__.makeSimplex(_d_i_m-_c_o_d_i_m); │ │ │ │ │ -163 } │ │ │ │ │ -164#endif │ │ │ │ │ -165 │ │ │ │ │ -_1_6_6 _S_u_b_E_n_t_i_t_y_I_n_f_o(_I_n_d_e_x_T_y_p_e parent_, unsigned int num_in_parent_, │ │ │ │ │ -167 const Dune::GeometryType& geometryType) │ │ │ │ │ -168 : _p_a_r_e_n_t(parent_), _n_u_m___i_n___p_a_r_e_n_t(num_in_parent_), _g_e_o_m_e_t_r_y_T_y_p_e__ │ │ │ │ │ -(geometryType) │ │ │ │ │ -169 {} │ │ │ │ │ -170 │ │ │ │ │ -_1_7_1 unsigned int _n_C_o_r_n_e_r_s() const │ │ │ │ │ -172 { │ │ │ │ │ -173 return Dune::ReferenceElements::general │ │ │ │ │ -(_g_e_o_m_e_t_r_y_T_y_p_e__).size(_d_i_m-_c_o_d_i_m); │ │ │ │ │ -174 } │ │ │ │ │ -175 │ │ │ │ │ -_1_7_7 _I_n_d_e_x_T_y_p_e _p_a_r_e_n_t; │ │ │ │ │ -178 │ │ │ │ │ -_1_8_0 unsigned int _n_u_m___i_n___p_a_r_e_n_t : 3; │ │ │ │ │ -181 │ │ │ │ │ -_1_8_3 Dune::GeometryType _g_e_o_m_e_t_r_y_T_y_p_e__; │ │ │ │ │ -184 │ │ │ │ │ -_1_9_1 _C_o_r_n_e_r_I_n_f_o _c_o_r_n_e_r_s[_c_u_b_e___c_o_r_n_e_r_s]; // sim = numer of vertices in a simplex │ │ │ │ │ -192 }; │ │ │ │ │ -193 │ │ │ │ │ -194 │ │ │ │ │ -_1_9_5 typedef std::map _E_l_e_m_e_n_t_I_n_f_o_M_a_p; │ │ │ │ │ -_1_9_6 typedef std::map _V_e_r_t_e_x_I_n_f_o_M_a_p; │ │ │ │ │ -197 │ │ │ │ │ -198 /************************** MEMBER VARIABLES ************************/ │ │ │ │ │ -199 │ │ │ │ │ -_2_0_1 const _G_r_i_d_V_i_e_w _g_v__; │ │ │ │ │ -202 │ │ │ │ │ -203 /* Geometrical and Topological Information */ │ │ │ │ │ -204 │ │ │ │ │ -_2_0_6 std::vector _c_o_o_r_d_s__; │ │ │ │ │ -207 │ │ │ │ │ -_2_0_9 std::vector _s_u_b_E_n_t_i_t_i_e_s__; │ │ │ │ │ -210 │ │ │ │ │ -_2_1_6 _V_e_r_t_e_x_I_n_f_o_M_a_p _v_t_x_I_n_f_o__; │ │ │ │ │ +152 case 0 : │ │ │ │ │ +153 break; │ │ │ │ │ +154 case 1 : │ │ │ │ │ +155 { │ │ │ │ │ +156 // The following test only works if the zero-th coordinate is the │ │ │ │ │ +157 // one that defines the orientation. A sufficient condition for │ │ │ │ │ +158 // this is dimworld == 1 │ │ │ │ │ +159 /* assert(dimworld==1); */ │ │ │ │ │ +160 bool elementNormalDirection = │ │ │ │ │ +161 (geometry.corner(1)[0] < geometry.corner(0)[0]); │ │ │ │ │ +162 if ( positiveNormalDirection_ != elementNormalDirection ) │ │ │ │ │ +163 { │ │ │ │ │ +164 std::swap(vertex_indices[0], vertex_indices[1]); │ │ │ │ │ +165 std::swap(vertex_numbers[0], vertex_numbers[1]); │ │ │ │ │ +166 } │ │ │ │ │ +167 break; │ │ │ │ │ +168 } │ │ │ │ │ +169 case 2 : │ │ │ │ │ +170 { │ │ │ │ │ +171 Dune::FieldVector │ │ │ │ │ +172 v0 = geometry.corner(1), │ │ │ │ │ +173 v1 = geometry.corner(2); │ │ │ │ │ +174 v0 -= geometry.corner(0); │ │ │ │ │ +175 v1 -= geometry.corner(0); │ │ │ │ │ +176 ctype normal_sign = v0[0]*v1[1] - v0[1]*v1[0]; │ │ │ │ │ +177 bool elementNormalDirection = (normal_sign < 0); │ │ │ │ │ +178 if ( positiveNormalDirection_ != elementNormalDirection ) │ │ │ │ │ +179 { │ │ │ │ │ +180 std::cout << "swap\n"; │ │ │ │ │ +181 if (elmt.type().isCube()) │ │ │ │ │ +182 { │ │ │ │ │ +183 for (int i = 0; i < (1<subEntities_.resize(element_index); │ │ │ │ │ +215 // ...and fill in the data from the temporary containers │ │ │ │ │ +216 copy(temp_faces.begin(), temp_faces.end(), this->subEntities_.begin()); │ │ │ │ │ 217 │ │ │ │ │ -_2_2_3 _E_l_e_m_e_n_t_I_n_f_o_M_a_p _e_l_m_t_I_n_f_o__; │ │ │ │ │ -224 │ │ │ │ │ -_2_2_5 _C_e_l_l_M_a_p_p_e_r _c_e_l_l_M_a_p_p_e_r__; │ │ │ │ │ -226 │ │ │ │ │ -227public: │ │ │ │ │ -228 │ │ │ │ │ -229 /* C O N S T R U C T O R S A N D D E S T R U C T O R S */ │ │ │ │ │ -230 │ │ │ │ │ -_2_3_5 _E_x_t_r_a_c_t_o_r(const GV& gv) │ │ │ │ │ -236 : _g_v__(gv) │ │ │ │ │ -237#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 6) │ │ │ │ │ -238 , _c_e_l_l_M_a_p_p_e_r__(gv, mcmgElementLayout()) │ │ │ │ │ -239#else │ │ │ │ │ -240 , _c_e_l_l_M_a_p_p_e_r__(gv) │ │ │ │ │ -241#endif │ │ │ │ │ -242 {} │ │ │ │ │ -243 │ │ │ │ │ -244 /* F U N C T I O N A L I T Y */ │ │ │ │ │ -245 │ │ │ │ │ -_2_4_9 void _c_l_e_a_r() │ │ │ │ │ -250 { │ │ │ │ │ -251 // this is an inofficial way on how to free the memory allocated │ │ │ │ │ -252 // by a std::vector │ │ │ │ │ -253 { │ │ │ │ │ -254 std::vector dummy; │ │ │ │ │ -255 _c_o_o_r_d_s__.swap(dummy); │ │ │ │ │ -256 } │ │ │ │ │ -257 { │ │ │ │ │ -258 std::vector dummy; │ │ │ │ │ -259 _s_u_b_E_n_t_i_t_i_e_s__.swap(dummy); │ │ │ │ │ -260 } │ │ │ │ │ -261 │ │ │ │ │ -262 // ...then clear the maps themselves, too │ │ │ │ │ -263 _v_t_x_I_n_f_o__.clear(); │ │ │ │ │ -264 _e_l_m_t_I_n_f_o__.clear(); │ │ │ │ │ -265 } │ │ │ │ │ -266 │ │ │ │ │ -267 │ │ │ │ │ -268 /* G E T T E R S */ │ │ │ │ │ -269 │ │ │ │ │ -_2_7_5 void _g_e_t_C_o_o_r_d_s(std::vector >& coords) │ │ │ │ │ -const │ │ │ │ │ -276 { │ │ │ │ │ -277 coords.resize(_c_o_o_r_d_s__.size()); │ │ │ │ │ -278 for (unsigned int i = 0; i < _c_o_o_r_d_s__.size(); ++i) │ │ │ │ │ -279 coords[i] = _c_o_o_r_d_s__[i].coord; │ │ │ │ │ -280 } │ │ │ │ │ -281 │ │ │ │ │ -282 │ │ │ │ │ -_2_8_7 unsigned int _n_C_o_o_r_d_s() const │ │ │ │ │ -288 { │ │ │ │ │ -289 return _c_o_o_r_d_s__.size(); │ │ │ │ │ -290 } │ │ │ │ │ -291 │ │ │ │ │ -_2_9_3 void _g_e_t_G_e_o_m_e_t_r_y_T_y_p_e_s(std::vector& geometryTypes) const │ │ │ │ │ -294 { │ │ │ │ │ -295 geometryTypes.resize(_s_u_b_E_n_t_i_t_i_e_s__.size()); │ │ │ │ │ -296 for (size_t i=0; i<_s_u_b_E_n_t_i_t_i_e_s__.size(); i++) │ │ │ │ │ -297 geometryTypes[i] = _s_u_b_E_n_t_i_t_i_e_s__[i].geometryType_; │ │ │ │ │ -298 } │ │ │ │ │ -299 │ │ │ │ │ -300 │ │ │ │ │ -_3_0_4 void _g_e_t_F_a_c_e_s(std::vector& faces) const │ │ │ │ │ -305 { │ │ │ │ │ -306 faces.resize(_s_u_b_E_n_t_i_t_i_e_s__.size()); │ │ │ │ │ -307 for (unsigned int i = 0; i < _s_u_b_E_n_t_i_t_i_e_s__.size(); ++i) { │ │ │ │ │ -308 faces[i].resize(_s_u_b_E_n_t_i_t_i_e_s__[i].nCorners()); │ │ │ │ │ -309 for (unsigned int j = 0; j < _s_u_b_E_n_t_i_t_i_e_s__[i].nCorners(); ++j) │ │ │ │ │ -310 faces[i][j] = _s_u_b_E_n_t_i_t_i_e_s__[i].corners[j].idx; │ │ │ │ │ -311 } │ │ │ │ │ -312 } │ │ │ │ │ -313 │ │ │ │ │ -314 │ │ │ │ │ -_3_2_3 bool _f_a_c_e_I_n_d_i_c_e_s(const _E_l_e_m_e_n_t& e, int& first, int& count) const │ │ │ │ │ -324 { │ │ │ │ │ -325 typename ElementInfoMap::const_iterator it = │ │ │ │ │ -326 _e_l_m_t_I_n_f_o__.find(_c_e_l_l_M_a_p_p_e_r__.map(e)); │ │ │ │ │ -327 if (it == _e_l_m_t_I_n_f_o__.end()) │ │ │ │ │ -328 { │ │ │ │ │ -329 first = -1; │ │ │ │ │ -330 count = 0; │ │ │ │ │ -331 return false; │ │ │ │ │ -332 } │ │ │ │ │ -333 // the iterator is valid, fill the out params │ │ │ │ │ -334 first = it->second.idx; │ │ │ │ │ -335 count = it->second.faces; │ │ │ │ │ -336 return true; │ │ │ │ │ -337 } │ │ │ │ │ -338 │ │ │ │ │ -339 │ │ │ │ │ -_3_4_5 int _i_n_d_e_x_I_n_I_n_s_i_d_e(unsigned int index) const │ │ │ │ │ -346 { │ │ │ │ │ -347 return index < _s_u_b_E_n_t_i_t_i_e_s__.size() ? _s_u_b_E_n_t_i_t_i_e_s__[index].num_in_parent : - │ │ │ │ │ -1; │ │ │ │ │ -348 } │ │ │ │ │ -349 │ │ │ │ │ -350 // /** │ │ │ │ │ -351 // * @brief tests that a given entry in the extraction set does have local │ │ │ │ │ -couplings │ │ │ │ │ -352 // * @todo parallel interface │ │ │ │ │ -353 // */ │ │ │ │ │ -354 // bool contains (unsigned int global, unsigned int & local) const │ │ │ │ │ -355 // { │ │ │ │ │ -356 // local = global; │ │ │ │ │ -357 // return true; │ │ │ │ │ -358 // } │ │ │ │ │ -359 │ │ │ │ │ -_3_6_3 const _G_r_i_d_V_i_e_w & _g_r_i_d_V_i_e_w() const │ │ │ │ │ -364 { │ │ │ │ │ -365 return _g_v__; │ │ │ │ │ -366 } │ │ │ │ │ -367 │ │ │ │ │ -_3_6_8 const _G_r_i_d& _g_r_i_d() const │ │ │ │ │ -369 { │ │ │ │ │ -370 return _g_v__.grid(); │ │ │ │ │ -371 } │ │ │ │ │ -372 │ │ │ │ │ -379 _E_l_e_m_e_n_t │ │ │ │ │ -_3_8_0 _e_l_e_m_e_n_t(unsigned int index) const │ │ │ │ │ -381 { │ │ │ │ │ -382 if (index >= _s_u_b_E_n_t_i_t_i_e_s__.size()) │ │ │ │ │ -383 DUNE_THROW(Dune::GridError, "invalid face index"); │ │ │ │ │ -384 const _E_l_e_m_e_n_t_S_e_e_d seed = _e_l_m_t_I_n_f_o__.at(_s_u_b_E_n_t_i_t_i_e_s__[index].parent).p; │ │ │ │ │ -385 return _g_r_i_d().entity(seed); │ │ │ │ │ -386 } │ │ │ │ │ -387 │ │ │ │ │ -388#if 1 │ │ │ │ │ -395 _V_e_r_t_e_x │ │ │ │ │ -_3_9_6 _v_e_r_t_e_x(unsigned int index) const │ │ │ │ │ -397 { │ │ │ │ │ -398 if (index >= _c_o_o_r_d_s__.size()) │ │ │ │ │ -399 DUNE_THROW(Dune::GridError, "invalid coordinate index"); │ │ │ │ │ -400 const _V_e_r_t_e_x_S_e_e_d seed = _v_t_x_I_n_f_o__.at(_c_o_o_r_d_s__[index].vtxindex).p; │ │ │ │ │ -401 return _g_r_i_d().entity(seed); │ │ │ │ │ -402 } │ │ │ │ │ -403#endif │ │ │ │ │ -404 │ │ │ │ │ -_4_0_6 _G_e_o_m_e_t_r_y _g_e_o_m_e_t_r_y(unsigned int index) const; │ │ │ │ │ -407 │ │ │ │ │ -_4_0_9 _L_o_c_a_l_G_e_o_m_e_t_r_y _g_e_o_m_e_t_r_y_L_o_c_a_l(unsigned int index) const; │ │ │ │ │ -410 │ │ │ │ │ -411}; │ │ │ │ │ -412 │ │ │ │ │ -413 │ │ │ │ │ -415template │ │ │ │ │ -_4_1_6typename _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_G_e_o_m_e_t_r_y _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_g_e_o_m_e_t_r_y(unsigned int │ │ │ │ │ -index) const │ │ │ │ │ -417{ │ │ │ │ │ -418 std::vector corners(subEntities_[index].nCorners()); │ │ │ │ │ -419 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i) │ │ │ │ │ -420 corners[i] = coords_[subEntities_[index].corners[i].idx].coord; │ │ │ │ │ -421 │ │ │ │ │ -422 return _G_e_o_m_e_t_r_y(subEntities_[index].geometryType_, corners); │ │ │ │ │ -423} │ │ │ │ │ -424 │ │ │ │ │ -425 │ │ │ │ │ -427template │ │ │ │ │ -_4_2_8typename _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_L_o_c_a_l_G_e_o_m_e_t_r_y _E_x_t_r_a_c_t_o_r_<_G_V_,_c_d_>_:_:_g_e_o_m_e_t_r_y_L_o_c_a_l │ │ │ │ │ -(unsigned int index) const │ │ │ │ │ -429{ │ │ │ │ │ -430 std::vector corners(subEntities_[index].nCorners()); │ │ │ │ │ -431 │ │ │ │ │ -432 // get face info │ │ │ │ │ -433 const _S_u_b_E_n_t_i_t_y_I_n_f_o & face = subEntities_[index]; │ │ │ │ │ -434 Dune::GeometryType facetype = subEntities_[index]._g_e_o_m_e_t_r_y_T_y_p_e__; │ │ │ │ │ -435 │ │ │ │ │ -436 // get reference element │ │ │ │ │ -437 const auto elmtseed = elmtInfo_.at(face._p_a_r_e_n_t).p; │ │ │ │ │ -438 const auto elmt = grid().entity(elmtseed); │ │ │ │ │ -439 const Dune::GeometryType celltype = elmt.type(); │ │ │ │ │ -440 const auto& re = Dune::ReferenceElements::general(celltype); │ │ │ │ │ -441 for (unsigned int i = 0; i < subEntities_[index].nCorners(); ++i) │ │ │ │ │ -442 corners[i] = re.position(face._c_o_r_n_e_r_s[i]._n_u_m,dim); │ │ │ │ │ -443 │ │ │ │ │ -444 return _L_o_c_a_l_G_e_o_m_e_t_r_y(facetype, corners); │ │ │ │ │ -445} │ │ │ │ │ -446 │ │ │ │ │ -447} // namespace GridGlue │ │ │ │ │ -448 │ │ │ │ │ -449} // namespace Dune │ │ │ │ │ -450 │ │ │ │ │ -451#endif // DUNE_GRIDGLUE_EXTRACTORS_EXTRACTOR_HH │ │ │ │ │ +218 // now first write the array with the coordinates... │ │ │ │ │ +219 this->coords_.resize(this->vtxInfo_.size()); │ │ │ │ │ +220 for (const auto& vinfo : this->vtxInfo_) │ │ │ │ │ +221 { │ │ │ │ │ +222 // get a pointer to the associated info object │ │ │ │ │ +223 CoordinateInfo* current = &this->coords_[vinfo.second.idx]; │ │ │ │ │ +224 // store this coordinates index // NEEDED? │ │ │ │ │ +225 current->index = vinfo.second.idx; │ │ │ │ │ +226 // store the vertex' index for the index2vertex mapping │ │ │ │ │ +227 current->vtxindex = vinfo.first; │ │ │ │ │ +228 // store the vertex' coordinates under the associated index │ │ │ │ │ +229 // in the coordinates array │ │ │ │ │ +230 const auto vtx = this->grid().entity(vinfo.second.p); │ │ │ │ │ +231 current->coord = vtx.geometry().corner(0); │ │ │ │ │ +232 } │ │ │ │ │ +233 │ │ │ │ │ +234} │ │ │ │ │ +235 │ │ │ │ │ +236} // namespace GridGlue │ │ │ │ │ +237 │ │ │ │ │ +238} // namespace Dune │ │ │ │ │ +239 │ │ │ │ │ +240#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH │ │ │ │ │ +_e_x_t_r_a_c_t_o_r_._h_h │ │ │ │ │ +extractor base class │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:40 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n │ │ │ │ │ +bool & positiveNormalDirection() │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:75 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ +Extractor< GV, 0 >::IndexType IndexType │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:49 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n │ │ │ │ │ +const bool & positiveNormalDirection() const │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:76 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ │ +GV::Traits::template Codim< dim >::Entity Vertex │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:51 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ +Extractor< GV, 0 >::CoordinateInfo CoordinateInfo │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:59 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ +Extractor< GV, 0 >::VertexInfo VertexInfo │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_c_t_y_p_e │ │ │ │ │ +Extractor< GV, 0 >::ctype ctype │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:46 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_p_o_s_i_t_i_v_e_N_o_r_m_a_l_D_i_r_e_c_t_i_o_n__ │ │ │ │ │ +bool positiveNormalDirection_ │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:79 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_M_a_p │ │ │ │ │ +Extractor< GV, 0 >::VertexInfoMap VertexInfoMap │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:60 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_P_r_e_d_i_c_a_t_e │ │ │ │ │ +std::function< bool(const Element &, unsigned int subentity)> Predicate │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r │ │ │ │ │ +Codim0Extractor(const GV &gv, const Predicate &predicate) │ │ │ │ │ +Constructor. │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:67 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ +Extractor< GV, 0 >::ElementInfo ElementInfo │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:57 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t │ │ │ │ │ +GV::Traits::template Codim< 0 >::Entity Element │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:52 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_d_i_m_0_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ +Extractor< GV, 0 >::SubEntityInfo SubEntityInfo │ │ │ │ │ +DDeeffiinniittiioonn codim0extractor.hh:56 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ Provides codimension-independent methods for grid extraction. │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:46 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ │ -GV::Traits::template Codim< dim >::Entity Vertex │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:63 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_v_t_x_I_n_f_o__ │ │ │ │ │ -VertexInfoMap vtxInfo_ │ │ │ │ │ -a map enabling faster access to vertices and coordinates │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:216 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_r_i_d │ │ │ │ │ -const Grid & grid() const │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:368 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_e_l_l_M_a_p_p_e_r │ │ │ │ │ -MultipleCodimMultipleGeomTypeMapper< GridView, MCMGElementLayout > CellMapper │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:74 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_e_l_e_m_e_n_t │ │ │ │ │ -Element element(unsigned int index) const │ │ │ │ │ -gets the parent element for a given face index, throws an exception if index │ │ │ │ │ -not valid │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:380 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_i_n_d_e_x_I_n_I_n_s_i_d_e │ │ │ │ │ -int indexInInside(unsigned int index) const │ │ │ │ │ -gets the number face in the parent element │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:345 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_L_o_c_a_l_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< ctype, dim > LocalCoords │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:61 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_o_m_e_t_r_y_L_o_c_a_l │ │ │ │ │ -LocalGeometry geometryLocal(unsigned int index) const │ │ │ │ │ -Get geometry of the extracted face in element coordinates. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:428 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _0_ _>_:_:_d_i_m_w_o_r_l_d │ │ │ │ │ static constexpr auto dimworld │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:50 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_G_e_o_m_e_t_r_y │ │ │ │ │ -Dune::MultiLinearGeometry< ctype, dim-codim, dimworld > Geometry │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:81 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ │ int IndexType │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:77 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_o_o_r_d_s__ │ │ │ │ │ -std::vector< CoordinateInfo > coords_ │ │ │ │ │ -all information about the corner vertices of the extracted │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:206 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t │ │ │ │ │ -GV::Traits::template Codim< 0 >::Entity Element │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:66 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_r_i_d_V_i_e_w │ │ │ │ │ -const GridView & gridView() const │ │ │ │ │ -give access to the Dune::GridView where this Patch belongs to │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:363 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_F_a_c_e_s │ │ │ │ │ -void getFaces(std::vector< VertexVector > &faces) const │ │ │ │ │ -Get the corners of the extracted subentities. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:304 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_V_e_c_t_o_r │ │ │ │ │ -std::vector< unsigned int > VertexVector │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:69 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_v__ │ │ │ │ │ -const GridView gv_ │ │ │ │ │ -the grid object to extract the surface from │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:201 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_s_u_b_E_n_t_i_t_i_e_s__ │ │ │ │ │ -std::vector< SubEntityInfo > subEntities_ │ │ │ │ │ -all information about the extracted subEntities │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:209 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_u_b_e___c_o_r_n_e_r_s │ │ │ │ │ -static constexpr int cube_corners │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:54 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_v_e_r_t_e_x │ │ │ │ │ -Vertex vertex(unsigned int index) const │ │ │ │ │ -gets the vertex for a given coordinate index throws an exception if index not │ │ │ │ │ -valid │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:396 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_o_d_i_m │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _0_ _>_:_:_c_o_d_i_m │ │ │ │ │ static constexpr auto codim │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:52 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< ctype, dimworld > Coords │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:60 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_G_e_o_m_e_t_r_y_T_y_p_e_s │ │ │ │ │ -void getGeometryTypes(std::vector< Dune::GeometryType > &geometryTypes) const │ │ │ │ │ -Get the list of geometry types. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:293 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_M_a_p │ │ │ │ │ std::map< IndexType, VertexInfo > VertexInfoMap │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:196 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_G_r_i_d │ │ │ │ │ -GridView::Grid Grid │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:57 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_f_a_c_e_I_n_d_i_c_e_s │ │ │ │ │ -bool faceIndices(const Element &e, int &first, int &count) const │ │ │ │ │ -gets index of first subentity as well as the total number of subentities that │ │ │ │ │ -were extracted from thi... │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:323 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_o_m_e_t_r_y │ │ │ │ │ -Geometry geometry(unsigned int index) const │ │ │ │ │ -Get world geometry of the extracted face. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:416 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_G_r_i_d_V_i_e_w │ │ │ │ │ -GV GridView │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_n_C_o_o_r_d_s │ │ │ │ │ -unsigned int nCoords() const │ │ │ │ │ -getter for the count of coordinates │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:287 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_t_y_p_e │ │ │ │ │ GV::Grid::ctype ctype │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_M_a_p │ │ │ │ │ -std::map< IndexType, ElementInfo > ElementInfoMap │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:195 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_x_t_r_a_c_t_o_r │ │ │ │ │ -Extractor(const GV &gv) │ │ │ │ │ -Constructor. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:235 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_g_e_t_C_o_o_r_d_s │ │ │ │ │ -void getCoords(std::vector< Dune::FieldVector< ctype, dimworld > > &coords) │ │ │ │ │ -const │ │ │ │ │ -getter for the coordinates array │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:275 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_e_l_l_M_a_p_p_e_r__ │ │ │ │ │ -CellMapper cellMapper_ │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:225 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_S_e_e_d │ │ │ │ │ -Element::EntitySeed ElementSeed │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:67 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_S_e_e_d │ │ │ │ │ -Vertex::EntitySeed VertexSeed │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_e_l_m_t_I_n_f_o__ │ │ │ │ │ -ElementInfoMap elmtInfo_ │ │ │ │ │ -a map enabling faster access to elements and faces │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:223 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_c_l_e_a_r │ │ │ │ │ -void clear() │ │ │ │ │ -delete everything build up so far and free the memory │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:249 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_d_i_m │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_<_ _G_V_,_ _0_ _>_:_:_d_i_m │ │ │ │ │ static constexpr auto dim │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:51 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_L_o_c_a_l_G_e_o_m_e_t_r_y │ │ │ │ │ -Dune::MultiLinearGeometry< ctype, dim-codim, dim > LocalGeometry │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:82 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_r_n_e_r_I_n_f_o │ │ │ │ │ -Helpful struct holding one index for the coordinate (vertex) to which it is │ │ │ │ │ -associated and the elemen... │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:92 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_r_n_e_r_I_n_f_o_:_:_i_d_x │ │ │ │ │ -unsigned int idx │ │ │ │ │ -index of the vertex │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:93 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_r_n_e_r_I_n_f_o_:_:_n_u_m │ │ │ │ │ -unsigned int num │ │ │ │ │ -element corner │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:94 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:98 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ -CoordinateInfo(unsigned int index_, IndexType vtxindex_) │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:102 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_i_n_d_e_x │ │ │ │ │ -unsigned int index │ │ │ │ │ -the index of this coordinate (in internal storage scheme) // NEEDED?? │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:113 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o │ │ │ │ │ -CoordinateInfo() │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:99 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_c_o_o_r_d │ │ │ │ │ -Coords coord │ │ │ │ │ -the coordinate │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:110 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_C_o_o_r_d_i_n_a_t_e_I_n_f_o_:_:_v_t_x_i_n_d_e_x │ │ │ │ │ -IndexType vtxindex │ │ │ │ │ -the index of the parent element (from index set) │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:107 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ simple struct holding a vertex pointer and an index │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:120 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_:_:_i_d_x │ │ │ │ │ -unsigned int idx │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:123 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_:_:_V_e_r_t_e_x_I_n_f_o │ │ │ │ │ -VertexInfo(unsigned int idx_, const Vertex &p_) │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:121 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_V_e_r_t_e_x_I_n_f_o_:_:_p │ │ │ │ │ -VertexSeed p │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:124 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ simple struct holding an element seed and an index │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:132 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_i_d_x │ │ │ │ │ -unsigned int idx │ │ │ │ │ -the index of this element's first face in the internal list of extracted faces │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:137 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_f_a_c_e_s │ │ │ │ │ -unsigned int faces │ │ │ │ │ -the number of extracted faces for this element │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:140 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_E_l_e_m_e_n_t_I_n_f_o │ │ │ │ │ -ElementInfo(unsigned int idx_, const Element &p_, unsigned int f_) │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:133 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_E_l_e_m_e_n_t_I_n_f_o_:_:_p │ │ │ │ │ -ElementSeed p │ │ │ │ │ -the entity seed for the element │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:143 │ │ │ │ │ _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ Holds some information about an element's subentity involved in a coupling. │ │ │ │ │ DDeeffiinniittiioonn extractor.hh:151 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_n_C_o_r_n_e_r_s │ │ │ │ │ -unsigned int nCorners() const │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:171 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_c_o_r_n_e_r_s │ │ │ │ │ -CornerInfo corners[cube_corners] │ │ │ │ │ -the corner indices plus the numbers of the vertices in the parent element │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:191 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_p_a_r_e_n_t │ │ │ │ │ -IndexType parent │ │ │ │ │ -the index of the parent element (from index set) │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:177 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ -SubEntityInfo(IndexType parent_, unsigned int num_in_parent_, const Dune:: │ │ │ │ │ -GeometryType &geometryType) │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:166 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_n_u_m___i_n___p_a_r_e_n_t │ │ │ │ │ -unsigned int num_in_parent │ │ │ │ │ -the number of the face in the parent element │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:180 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_g_e_o_m_e_t_r_y_T_y_p_e__ │ │ │ │ │ -Dune::GeometryType geometryType_ │ │ │ │ │ -The GeometryType of the subentity. │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:183 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_E_x_t_r_a_c_t_o_r_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o_:_:_S_u_b_E_n_t_i_t_y_I_n_f_o │ │ │ │ │ -SubEntityInfo() │ │ │ │ │ -DDeeffiinniittiioonn extractor.hh:152 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: merger.hh File Reference │ │ │ │ +dune-grid-glue: overlappingmerge.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,39 +70,49 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
merger.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Macros
│ │ │ │ +
overlappingmerge.cc File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <vector>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/geometry/type.hh>
│ │ │ │ -#include <dune/grid-glue/merging/intersectionlist.hh>
│ │ │ │ -
│ │ │ │ + │ │ │ │

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::GridGlue::Merger< ctype, grid1Dim, grid2Dim, dimworld >
 Abstract base for all classes that take extracted grids and build sets of intersections. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ +Macros

#define DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC
 
│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,26 +1,23 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _m_e_r_g_i_n_g │ │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ -merger.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_i_n_t_e_r_s_e_c_t_i_o_n_l_i_s_t_._h_h> │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ │ +overlappingmerge.cc File Reference │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ -CCllaasssseess │ │ │ │ │ -class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_<_ _c_t_y_p_e_,_ _g_r_i_d_1_D_i_m_,_ _g_r_i_d_2_D_i_m_,_ _d_i_m_w_o_r_l_d_ _> │ │ │ │ │ -  Abstract base for all classes that take extracted grids and build sets │ │ │ │ │ - of intersections. _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_U_N_E___G_R_I_D_G_L_U_E___O_V_E_R_L_A_P_P_I_N_G_M_E_R_G_E___C_C │ │ │ │ │ +  │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDUUNNEE__GGRRIIDDGGLLUUEE__OOVVEERRLLAAPPPPIINNGGMMEERRGGEE__CCCC ********** │ │ │ │ │ +#define DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: merger.hh Source File │ │ │ │ +dune-grid-glue: overlappingmerge.cc Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,110 +74,215 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
merger.hh
│ │ │ │ +
overlappingmerge.cc
│ │ │ │
│ │ │ │
│ │ │ │ Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ │
2// vi: set et ts=4 sw=2 sts=2:
│ │ │ │
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │
4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ │ -
5#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH
│ │ │ │ -
6#define DUNE_GRIDGLUE_MERGING_MERGER_HH
│ │ │ │ -
7
│ │ │ │ -
8#include <vector>
│ │ │ │ +
5
│ │ │ │ +
6#ifndef DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC
│ │ │ │ +
7#define DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC
│ │ │ │ +
8//#include <algorithm>
│ │ │ │
9
│ │ │ │ -
10#include <dune/common/fvector.hh>
│ │ │ │ -
11#include <dune/geometry/type.hh>
│ │ │ │ +
10namespace Dune {
│ │ │ │ +
11namespace GridGlue {
│ │ │ │
12
│ │ │ │ - │ │ │ │ -
14
│ │ │ │ -
15namespace Dune {
│ │ │ │ -
16namespace GridGlue {
│ │ │ │ +
13template<int dim1, int dim2, int dimworld, typename T>
│ │ │ │ +
14bool OverlappingMerge<dim1,dim2,dimworld, T>::inPlane(std::vector<FieldVector<T,dimworld> >& points) {
│ │ │ │ +
15
│ │ │ │ +
16 T eps = 1e-8;
│ │ │ │
17
│ │ │ │ -
25template <class ctype, int grid1Dim, int grid2Dim, int dimworld>
│ │ │ │ -
│ │ │ │ -
26class Merger
│ │ │ │ -
27{
│ │ │ │ -
28public:
│ │ │ │ +
18 assert(dim1 == 3 && dim2 == 3 && dimworld == 3);
│ │ │ │ +
19 assert(points.size() == 4);
│ │ │ │ +
20
│ │ │ │ +
21 FieldVector<T,dimworld> v1 = points[1]-points[0];
│ │ │ │ +
22 FieldVector<T,dimworld> v2 = points[2]-points[0];
│ │ │ │ +
23 FieldVector<T,dimworld> v3 = points[3]-points[0];
│ │ │ │ +
24
│ │ │ │ +
25 FieldVector<T,dimworld> v1xv2;
│ │ │ │ +
26 v1xv2[0] = v1[1]*v2[2] - v1[2]*v2[1];
│ │ │ │ +
27 v1xv2[1] = v1[2]*v2[0] - v1[0]*v2[2];
│ │ │ │ +
28 v1xv2[2] = v1[0]*v2[1] - v1[1]*v2[0];
│ │ │ │
29
│ │ │ │ -
31 typedef Dune::FieldVector<ctype, grid1Dim> Grid1Coords;
│ │ │ │ +
30 return (std::abs(v3.dot(v1xv2)) < eps);
│ │ │ │ +
31}
│ │ │ │
32
│ │ │ │ -
34 typedef Dune::FieldVector<ctype, grid2Dim> Grid2Coords;
│ │ │ │ -
35
│ │ │ │ -
37 typedef Dune::FieldVector<ctype, dimworld> WorldCoords;
│ │ │ │ -
38
│ │ │ │ - │ │ │ │ -
40
│ │ │ │ -
54 virtual void build(const std::vector<Dune::FieldVector<ctype,dimworld> >& grid1_coords,
│ │ │ │ -
55 const std::vector<unsigned int>& grid1_elements,
│ │ │ │ -
56 const std::vector<Dune::GeometryType>& grid1_element_types,
│ │ │ │ -
57 const std::vector<Dune::FieldVector<ctype,dimworld> >& grid2_coords,
│ │ │ │ -
58 const std::vector<unsigned int>& grid2_elements,
│ │ │ │ -
59 const std::vector<Dune::GeometryType>& grid2_element_types) = 0;
│ │ │ │ -
60
│ │ │ │ -
│ │ │ │ -
64 unsigned int nSimplices() const
│ │ │ │ -
65 { return intersectionList()->size(); }
│ │ │ │ -
│ │ │ │ -
66
│ │ │ │ -
67 virtual void clear() = 0;
│ │ │ │ -
68
│ │ │ │ -
74 virtual std::shared_ptr<IntersectionList> intersectionList() const = 0;
│ │ │ │ -
75
│ │ │ │ -
79 template<int n>
│ │ │ │ -
│ │ │ │ -
80 unsigned int parents(unsigned int idx) const {
│ │ │ │ -
81 return intersectionList()->template parents<n>(idx);
│ │ │ │ -
82 }
│ │ │ │ -
│ │ │ │ -
83
│ │ │ │ -
90 template<int n>
│ │ │ │ -
│ │ │ │ -
91 unsigned int parent(unsigned int idx, unsigned int parId = 0) const
│ │ │ │ -
92 {
│ │ │ │ -
93 return intersectionList()->template parent<n>(idx, parId);
│ │ │ │ -
94 }
│ │ │ │ -
│ │ │ │ -
95
│ │ │ │ -
104 template<int n>
│ │ │ │ -
│ │ │ │ -
105 auto parentLocal(unsigned int idx, unsigned int corner, unsigned int parId = 0) const
│ │ │ │ -
106 {
│ │ │ │ -
107 return intersectionList()->template corner<n>(idx, corner, parId);
│ │ │ │ -
108 }
│ │ │ │ -
│ │ │ │ -
109
│ │ │ │ -
114 unsigned int counter;
│ │ │ │ -
115};
│ │ │ │ -
│ │ │ │ -
116
│ │ │ │ -
117} /* namespace GridGlue */
│ │ │ │ -
118} /* namespace Dune */
│ │ │ │ -
119
│ │ │ │ -
120#endif
│ │ │ │ - │ │ │ │ +
33template<int dim1, int dim2, int dimworld, typename T>
│ │ │ │ +
│ │ │ │ +
34void OverlappingMerge<dim1,dim2,dimworld, T>::computeIntersections(const Dune::GeometryType& grid1ElementType,
│ │ │ │ +
35 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
│ │ │ │ +
36 std::bitset<(1<<dim1)>& neighborIntersects1,
│ │ │ │ +
37 unsigned int grid1Index,
│ │ │ │ +
38 const Dune::GeometryType& grid2ElementType,
│ │ │ │ +
39 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
│ │ │ │ +
40 std::bitset<(1<<dim2)>& neighborIntersects2,
│ │ │ │ +
41 unsigned int grid2Index,
│ │ │ │ +
42 std::vector<SimplicialIntersection>& intersections)
│ │ │ │ +
43{
│ │ │ │ +
44 using std::min;
│ │ │ │ +
45
│ │ │ │ +
46 this->counter++;
│ │ │ │ +
47 intersections.clear();
│ │ │ │ +
48
│ │ │ │ + │ │ │ │ +
50
│ │ │ │ +
51#ifndef NDEBUG
│ │ │ │ +
52 const auto& refElement1 = Dune::ReferenceElements<T,dim1>::general(grid1ElementType);
│ │ │ │ +
53 const auto& refElement2 = Dune::ReferenceElements<T,dim2>::general(grid2ElementType);
│ │ │ │ +
54
│ │ │ │ +
55 // A few consistency checks
│ │ │ │ +
56 assert((unsigned int)(refElement1.size(dim1)) == grid1ElementCorners.size());
│ │ │ │ +
57 assert((unsigned int)(refElement2.size(dim2)) == grid2ElementCorners.size());
│ │ │ │ +
58#endif
│ │ │ │ +
59
│ │ │ │ +
60 // Make generic geometries representing the grid1- and grid2 element.
│ │ │ │ +
61 // this eases computation of local coordinates.
│ │ │ │ +
62 typedef MultiLinearGeometry<T,dim1,dimworld> Geometry1;
│ │ │ │ +
63 typedef MultiLinearGeometry<T,dim2,dimworld> Geometry2;
│ │ │ │ +
64
│ │ │ │ +
65 Geometry1 grid1Geometry(grid1ElementType, grid1ElementCorners);
│ │ │ │ +
66 Geometry2 grid2Geometry(grid2ElementType, grid2ElementCorners);
│ │ │ │ +
67
│ │ │ │ +
68 // Dirty workaround for the intersection computation scaling problem (part 1/2)
│ │ │ │ +
69 std::vector<Dune::FieldVector<T,dimworld> > scaledGrid1ElementCorners(grid1ElementCorners.size());
│ │ │ │ +
70 std::vector<Dune::FieldVector<T,dimworld> > scaledGrid2ElementCorners(grid2ElementCorners.size());
│ │ │ │ +
71
│ │ │ │ +
72 // the scaling parameter is the length minimum of the lengths of the first edge in the grid1 geometry
│ │ │ │ +
73 // and the first edge in the grid2 geometry
│ │ │ │ +
74 T scaling = min((grid1ElementCorners[0] - grid1ElementCorners[1]).two_norm(),
│ │ │ │ +
75 (grid2ElementCorners[0] - grid2ElementCorners[1]).two_norm());
│ │ │ │ +
76
│ │ │ │ +
77 // scale the coordinates according to scaling parameter
│ │ │ │ +
78 for (unsigned int i = 0; i < grid1ElementCorners.size(); ++i) {
│ │ │ │ +
79 scaledGrid1ElementCorners[i] = grid1ElementCorners[i];
│ │ │ │ +
80 scaledGrid1ElementCorners[i] *= (1.0/scaling);
│ │ │ │ +
81 }
│ │ │ │ +
82 for (unsigned int i = 0; i < grid2ElementCorners.size(); ++i) {
│ │ │ │ +
83 scaledGrid2ElementCorners[i] = grid2ElementCorners[i];
│ │ │ │ +
84 scaledGrid2ElementCorners[i] *= (1.0/scaling);
│ │ │ │ +
85 }
│ │ │ │ +
86
│ │ │ │ +
87 // get size_type for all the vectors we are using
│ │ │ │ +
88 typedef typename std::vector<Empty>::size_type size_type;
│ │ │ │ +
89
│ │ │ │ +
90 const int dimis = dim1 < dim2 ? dim1 : dim2;
│ │ │ │ +
91 const size_type n_intersectionnodes = dimis+1;
│ │ │ │ +
92 size_type i;
│ │ │ │ +
93
│ │ │ │ +
94 std::vector<FieldVector<T,dimworld> > scaledP(0), P(0);
│ │ │ │ +
95 std::vector<std::vector<int> > H,SX(1<<dim1),SY(1<<dim2);
│ │ │ │ +
96 FieldVector<T,dimworld> centroid;
│ │ │ │ +
97 // local grid1 coordinates of the intersections
│ │ │ │ +
98 std::vector<FieldVector<T,dim1> > g1local(n_intersectionnodes);
│ │ │ │ +
99 // local grid2 coordinates of the intersections
│ │ │ │ +
100 std::vector<FieldVector<T,dim2> > g2local(n_intersectionnodes);
│ │ │ │ +
101
│ │ │ │ +
102 // compute the intersection nodes
│ │ │ │ +
103 IntersectionComputation<CM>::computeIntersection(scaledGrid1ElementCorners,
│ │ │ │ +
104 scaledGrid2ElementCorners,
│ │ │ │ +
105 SX,SY,scaledP);
│ │ │ │ +
106
│ │ │ │ +
107 // Dirty workaround - rescale the result (part 2/2)
│ │ │ │ +
108 P.resize(scaledP.size());
│ │ │ │ +
109 for (unsigned int i = 0; i < scaledP.size(); ++i) {
│ │ │ │ +
110 P[i] = scaledP[i];
│ │ │ │ +
111 P[i] *= scaling;
│ │ │ │ +
112 }
│ │ │ │ +
113
│ │ │ │ +
114 for (size_type i = 0; i < neighborIntersects1.size(); ++i) {
│ │ │ │ +
115 if (i < SX.size())
│ │ │ │ +
116 neighborIntersects1[i] = (SX[i].size() > 0);
│ │ │ │ +
117 else
│ │ │ │ +
118 neighborIntersects1[i] = false;
│ │ │ │ +
119 }
│ │ │ │ +
120 for (size_type i = 0; i < neighborIntersects2.size(); ++i) {
│ │ │ │ +
121 if (i < SY.size())
│ │ │ │ +
122 neighborIntersects2[i] = (SY[i].size() > 0);
│ │ │ │ +
123 else
│ │ │ │ +
124 neighborIntersects2[i] = false;
│ │ │ │ +
125 }
│ │ │ │ +
126
│ │ │ │ +
127 // P is an simplex of dimension dimis
│ │ │ │ +
128 if (P.size() == n_intersectionnodes) {
│ │ │ │ +
129
│ │ │ │ +
130 for (i = 0; i < n_intersectionnodes; ++i) {
│ │ │ │ +
131 g1local[i] = grid1Geometry.local(P[i]);
│ │ │ │ +
132 g2local[i] = grid2Geometry.local(P[i]);
│ │ │ │ +
133 }
│ │ │ │ +
134
│ │ │ │ +
135 intersections.emplace_back(grid1Index, grid2Index);
│ │ │ │ +
136 for (i = 0; i < n_intersectionnodes; ++i) {
│ │ │ │ +
137 intersections.back().corners0[0][i] = g1local[i];
│ │ │ │ +
138 intersections.back().corners1[0][i] = g2local[i];
│ │ │ │ +
139 }
│ │ │ │ +
140
│ │ │ │ +
141 } else if (P.size() > n_intersectionnodes) { // P is a union of simplices of dimension dimis
│ │ │ │ +
142
│ │ │ │ +
143 assert(dimis != 1);
│ │ │ │ +
144 std::vector<FieldVector<T,dimworld> > global(n_intersectionnodes);
│ │ │ │ +
145
│ │ │ │ +
146 // Compute the centroid
│ │ │ │ +
147 centroid=0;
│ │ │ │ +
148 for (size_type i=0; i < P.size(); i++)
│ │ │ │ +
149 centroid += P[i] ;
│ │ │ │ +
150 centroid /= static_cast<T>(P.size()) ;
│ │ │ │ +
151
│ │ │ │ +
152 // order the points and get intersection face indices
│ │ │ │ +
153 H.clear() ;
│ │ │ │ +
154 IntersectionComputation<CM>::template orderPoints<dimis,dimworld>(centroid,SX,SY,P,H);
│ │ │ │ +
155
│ │ │ │ +
156 // Loop over all intersection elements
│ │ │ │ +
157 for (size_type i=0; i < H.size(); i++) {
│ │ │ │ +
158 int hs = H[i].size(); // number of nodes of the intersection
│ │ │ │ +
159
│ │ │ │ +
160 // if the intersection element is not degenerated
│ │ │ │ +
161 if (hs==dimis) {
│ │ │ │ +
162
│ │ │ │ +
163 // create the intersection geometry
│ │ │ │ +
164 for ( size_type j=0 ; j < dimis; ++j) {
│ │ │ │ +
165 global[j]= P[H[i][j]]; // get the intersection face
│ │ │ │ +
166 }
│ │ │ │ +
167
│ │ │ │ +
168 // intersection face + centroid = new element
│ │ │ │ +
169 global[dimis]=centroid;
│ │ │ │ +
170
│ │ │ │ +
171 // create local representation of the intersection
│ │ │ │ +
172 for (size_type j = 0; j < n_intersectionnodes; ++j) {
│ │ │ │ +
173 g1local[j] = grid1Geometry.local(global[j]);
│ │ │ │ +
174 g2local[j] = grid2Geometry.local(global[j]);
│ │ │ │ +
175 }
│ │ │ │ +
176
│ │ │ │ +
177 intersections.emplace_back(grid1Index,grid2Index);
│ │ │ │ +
178 for (size_type j = 0; j < n_intersectionnodes; ++j) {
│ │ │ │ +
179 intersections.back().corners0[0][j] = g1local[j];
│ │ │ │ +
180 intersections.back().corners1[0][j] = g2local[j];
│ │ │ │ +
181 }
│ │ │ │ +
182 }
│ │ │ │ +
183 }
│ │ │ │ +
184 }
│ │ │ │ +
185}
│ │ │ │ +
│ │ │ │ +
186
│ │ │ │ +
187} /* namespace Dune::GridGlue */
│ │ │ │ +
188} /* namespace Dune */
│ │ │ │ +
189
│ │ │ │ +
190#endif // DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
Definition intersectionlist.hh:134
│ │ │ │ -
Abstract base for all classes that take extracted grids and build sets of intersections.
Definition merger.hh:27
│ │ │ │ -
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
│ │ │ │ -
virtual void clear()=0
│ │ │ │ -
Dune::FieldVector< ctype, dimworld > WorldCoords
the coordinate type used in this interface
Definition merger.hh:37
│ │ │ │ -
Dune::FieldVector< ctype, grid1Dim > Grid1Coords
the local coordinate type for the grid1 coordinates
Definition merger.hh:31
│ │ │ │ -
unsigned int counter
Counts the number of times the computeIntersection method has been called.
Definition merger.hh:114
│ │ │ │ -
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
│ │ │ │ -
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
│ │ │ │ -
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
│ │ │ │ -
virtual std::shared_ptr< IntersectionList > intersectionList() const =0
│ │ │ │ -
unsigned int parents(unsigned int idx) const
Definition merger.hh:80
│ │ │ │ -
Dune::FieldVector< ctype, grid2Dim > Grid2Coords
the local coordinate type for the grid2 coordinates
Definition merger.hh:34
│ │ │ │ +
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ +
Intersection computation method for two elements of arbitrary dimension.
Definition computeintersection.hh:39
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ +
Definition simplexintersection.cc:30
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,139 +1,244 @@ │ │ │ │ │ dune-grid-glue 2.9 │ │ │ │ │ Loading... │ │ │ │ │ Searching... │ │ │ │ │ No Matches │ │ │ │ │ * _d_u_n_e │ │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ │ * _m_e_r_g_i_n_g │ │ │ │ │ -merger.hh │ │ │ │ │ +overlappingmerge.cc │ │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ │ 1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ │ 2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ │ 3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ │ LICENSE.md in module root │ │ │ │ │ 4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ │ dune-grid-glue-exception │ │ │ │ │ -5#ifndef DUNE_GRIDGLUE_MERGING_MERGER_HH │ │ │ │ │ -6#define DUNE_GRIDGLUE_MERGING_MERGER_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ +5 │ │ │ │ │ +6#ifndef DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC │ │ │ │ │ +_7#define DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC │ │ │ │ │ +8//#include │ │ │ │ │ 9 │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ +10namespace _D_u_n_e { │ │ │ │ │ +11namespace GridGlue { │ │ │ │ │ 12 │ │ │ │ │ -13#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_i_n_t_e_r_s_e_c_t_i_o_n_l_i_s_t_._h_h> │ │ │ │ │ -14 │ │ │ │ │ -15namespace _D_u_n_e { │ │ │ │ │ -16namespace GridGlue { │ │ │ │ │ +13template │ │ │ │ │ +14bool OverlappingMerge::inPlane(std:: │ │ │ │ │ +vector >& points) { │ │ │ │ │ +15 │ │ │ │ │ +16 T eps = 1e-8; │ │ │ │ │ 17 │ │ │ │ │ -25template │ │ │ │ │ -_2_6class _M_e_r_g_e_r │ │ │ │ │ -27{ │ │ │ │ │ -28public: │ │ │ │ │ +18 assert(dim1 == 3 && dim2 == 3 && dimworld == 3); │ │ │ │ │ +19 assert(points.size() == 4); │ │ │ │ │ +20 │ │ │ │ │ +21 FieldVector v1 = points[1]-points[0]; │ │ │ │ │ +22 FieldVector v2 = points[2]-points[0]; │ │ │ │ │ +23 FieldVector v3 = points[3]-points[0]; │ │ │ │ │ +24 │ │ │ │ │ +25 FieldVector v1xv2; │ │ │ │ │ +26 v1xv2[0] = v1[1]*v2[2] - v1[2]*v2[1]; │ │ │ │ │ +27 v1xv2[1] = v1[2]*v2[0] - v1[0]*v2[2]; │ │ │ │ │ +28 v1xv2[2] = v1[0]*v2[1] - v1[1]*v2[0]; │ │ │ │ │ 29 │ │ │ │ │ -_3_1 typedef Dune::FieldVector _G_r_i_d_1_C_o_o_r_d_s; │ │ │ │ │ +30 return (std::abs(v3.dot(v1xv2)) < eps); │ │ │ │ │ +31} │ │ │ │ │ 32 │ │ │ │ │ -_3_4 typedef Dune::FieldVector _G_r_i_d_2_C_o_o_r_d_s; │ │ │ │ │ -35 │ │ │ │ │ -_3_7 typedef Dune::FieldVector _W_o_r_l_d_C_o_o_r_d_s; │ │ │ │ │ -38 │ │ │ │ │ -_3_9 using _I_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t = _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t_<_G_r_i_d_1_C_o_o_r_d_s_, │ │ │ │ │ -_G_r_i_d_2_C_o_o_r_d_s_>; │ │ │ │ │ -40 │ │ │ │ │ -_5_4 virtual void _b_u_i_l_d(const std::vector >& │ │ │ │ │ -grid1_coords, │ │ │ │ │ -55 const std::vector& grid1_elements, │ │ │ │ │ -56 const std::vector& grid1_element_types, │ │ │ │ │ -57 const std::vector >& grid2_coords, │ │ │ │ │ -58 const std::vector& grid2_elements, │ │ │ │ │ -59 const std::vector& grid2_element_types) = 0; │ │ │ │ │ -60 │ │ │ │ │ -_6_4 unsigned int _n_S_i_m_p_l_i_c_e_s() const │ │ │ │ │ -65 { return _i_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t()->size(); } │ │ │ │ │ -66 │ │ │ │ │ -_6_7 virtual void _c_l_e_a_r() = 0; │ │ │ │ │ -68 │ │ │ │ │ -_7_4 virtual std::shared_ptr _i_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t() const = 0; │ │ │ │ │ -75 │ │ │ │ │ -79 template │ │ │ │ │ -_8_0 unsigned int _p_a_r_e_n_t_s(unsigned int idx) const { │ │ │ │ │ -81 return _i_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t()->template parents(idx); │ │ │ │ │ -82 } │ │ │ │ │ -83 │ │ │ │ │ -90 template │ │ │ │ │ -_9_1 unsigned int _p_a_r_e_n_t(unsigned int idx, unsigned int parId = 0) const │ │ │ │ │ -92 { │ │ │ │ │ -93 return _i_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t()->template parent(idx, parId); │ │ │ │ │ -94 } │ │ │ │ │ -95 │ │ │ │ │ -104 template │ │ │ │ │ -_1_0_5 auto _p_a_r_e_n_t_L_o_c_a_l(unsigned int idx, unsigned int corner, unsigned int parId │ │ │ │ │ -= 0) const │ │ │ │ │ -106 { │ │ │ │ │ -107 return _i_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t()->template corner(idx, corner, parId); │ │ │ │ │ -108 } │ │ │ │ │ -109 │ │ │ │ │ -_1_1_4 unsigned int _c_o_u_n_t_e_r; │ │ │ │ │ -115}; │ │ │ │ │ -116 │ │ │ │ │ -117} /* namespace GridGlue */ │ │ │ │ │ -118} /* namespace Dune */ │ │ │ │ │ -119 │ │ │ │ │ -120#endif │ │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_l_i_s_t_._h_h │ │ │ │ │ +33template │ │ │ │ │ +_3_4void _O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e_<_d_i_m_1_,_d_i_m_2_,_d_i_m_w_o_r_l_d_,_ _T_>_:_:_c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_s(const │ │ │ │ │ +Dune::GeometryType& grid1ElementType, │ │ │ │ │ +35 const std::vector >& grid1ElementCorners, │ │ │ │ │ +36 std::bitset<(1<& neighborIntersects1, │ │ │ │ │ +37 unsigned int grid1Index, │ │ │ │ │ +38 const Dune::GeometryType& grid2ElementType, │ │ │ │ │ +39 const std::vector >& grid2ElementCorners, │ │ │ │ │ +40 std::bitset<(1<& neighborIntersects2, │ │ │ │ │ +41 unsigned int grid2Index, │ │ │ │ │ +42 std::vector& _i_n_t_e_r_s_e_c_t_i_o_n_s) │ │ │ │ │ +43{ │ │ │ │ │ +44 using std::min; │ │ │ │ │ +45 │ │ │ │ │ +46 this->counter++; │ │ │ │ │ +47 _i_n_t_e_r_s_e_c_t_i_o_n_s.clear(); │ │ │ │ │ +48 │ │ │ │ │ +49 typedef _S_i_m_p_l_e_x_M_e_t_h_o_d_<_d_i_m_w_o_r_l_d_,_d_i_m_1_,_d_i_m_2_,_T_> CM; │ │ │ │ │ +50 │ │ │ │ │ +51#ifndef NDEBUG │ │ │ │ │ +52 const auto& refElement1 = Dune::ReferenceElements::general │ │ │ │ │ +(grid1ElementType); │ │ │ │ │ +53 const auto& refElement2 = Dune::ReferenceElements::general │ │ │ │ │ +(grid2ElementType); │ │ │ │ │ +54 │ │ │ │ │ +55 // A few consistency checks │ │ │ │ │ +56 assert((unsigned int)(refElement1.size(dim1)) == grid1ElementCorners.size │ │ │ │ │ +()); │ │ │ │ │ +57 assert((unsigned int)(refElement2.size(dim2)) == grid2ElementCorners.size │ │ │ │ │ +()); │ │ │ │ │ +58#endif │ │ │ │ │ +59 │ │ │ │ │ +60 // Make generic geometries representing the grid1- and grid2 element. │ │ │ │ │ +61 // this eases computation of local coordinates. │ │ │ │ │ +62 typedef MultiLinearGeometry Geometry1; │ │ │ │ │ +63 typedef MultiLinearGeometry Geometry2; │ │ │ │ │ +64 │ │ │ │ │ +65 Geometry1 grid1Geometry(grid1ElementType, grid1ElementCorners); │ │ │ │ │ +66 Geometry2 grid2Geometry(grid2ElementType, grid2ElementCorners); │ │ │ │ │ +67 │ │ │ │ │ +68 // Dirty workaround for the intersection computation scaling problem (part │ │ │ │ │ +1/2) │ │ │ │ │ +69 std::vector > scaledGrid1ElementCorners │ │ │ │ │ +(grid1ElementCorners.size()); │ │ │ │ │ +70 std::vector > scaledGrid2ElementCorners │ │ │ │ │ +(grid2ElementCorners.size()); │ │ │ │ │ +71 │ │ │ │ │ +72 // the scaling parameter is the length minimum of the lengths of the first │ │ │ │ │ +edge in the grid1 geometry │ │ │ │ │ +73 // and the first edge in the grid2 geometry │ │ │ │ │ +74 T scaling = min((grid1ElementCorners[0] - grid1ElementCorners[1]).two_norm │ │ │ │ │ +(), │ │ │ │ │ +75 (grid2ElementCorners[0] - grid2ElementCorners[1]).two_norm()); │ │ │ │ │ +76 │ │ │ │ │ +77 // scale the coordinates according to scaling parameter │ │ │ │ │ +78 for (unsigned int i = 0; i < grid1ElementCorners.size(); ++i) { │ │ │ │ │ +79 scaledGrid1ElementCorners[i] = grid1ElementCorners[i]; │ │ │ │ │ +80 scaledGrid1ElementCorners[i] *= (1.0/scaling); │ │ │ │ │ +81 } │ │ │ │ │ +82 for (unsigned int i = 0; i < grid2ElementCorners.size(); ++i) { │ │ │ │ │ +83 scaledGrid2ElementCorners[i] = grid2ElementCorners[i]; │ │ │ │ │ +84 scaledGrid2ElementCorners[i] *= (1.0/scaling); │ │ │ │ │ +85 } │ │ │ │ │ +86 │ │ │ │ │ +87 // get size_type for all the vectors we are using │ │ │ │ │ +88 typedef typename std::vector::size_type size_type; │ │ │ │ │ +89 │ │ │ │ │ +90 const int dimis = dim1 < dim2 ? dim1 : dim2; │ │ │ │ │ +91 const size_type n_intersectionnodes = dimis+1; │ │ │ │ │ +92 size_type i; │ │ │ │ │ +93 │ │ │ │ │ +94 std::vector > scaledP(0), P(0); │ │ │ │ │ +95 std::vector > H,SX(1< centroid; │ │ │ │ │ +97 // local grid1 coordinates of the intersections │ │ │ │ │ +98 std::vector > g1local(n_intersectionnodes); │ │ │ │ │ +99 // local grid2 coordinates of the intersections │ │ │ │ │ +100 std::vector > g2local(n_intersectionnodes); │ │ │ │ │ +101 │ │ │ │ │ +102 // compute the intersection nodes │ │ │ │ │ +103 _I_n_t_e_r_s_e_c_t_i_o_n_C_o_m_p_u_t_a_t_i_o_n_<_C_M_>_:_:_c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n(scaledGrid1ElementCorners, │ │ │ │ │ +104 scaledGrid2ElementCorners, │ │ │ │ │ +105 SX,SY,scaledP); │ │ │ │ │ +106 │ │ │ │ │ +107 // Dirty workaround - rescale the result (part 2/2) │ │ │ │ │ +108 P.resize(scaledP.size()); │ │ │ │ │ +109 for (unsigned int i = 0; i < scaledP.size(); ++i) { │ │ │ │ │ +110 P[i] = scaledP[i]; │ │ │ │ │ +111 P[i] *= scaling; │ │ │ │ │ +112 } │ │ │ │ │ +113 │ │ │ │ │ +114 for (size_type i = 0; i < neighborIntersects1.size(); ++i) { │ │ │ │ │ +115 if (i < SX.size()) │ │ │ │ │ +116 neighborIntersects1[i] = (SX[i].size() > 0); │ │ │ │ │ +117 else │ │ │ │ │ +118 neighborIntersects1[i] = false; │ │ │ │ │ +119 } │ │ │ │ │ +120 for (size_type i = 0; i < neighborIntersects2.size(); ++i) { │ │ │ │ │ +121 if (i < SY.size()) │ │ │ │ │ +122 neighborIntersects2[i] = (SY[i].size() > 0); │ │ │ │ │ +123 else │ │ │ │ │ +124 neighborIntersects2[i] = false; │ │ │ │ │ +125 } │ │ │ │ │ +126 │ │ │ │ │ +127 // P is an simplex of dimension dimis │ │ │ │ │ +128 if (P.size() == n_intersectionnodes) { │ │ │ │ │ +129 │ │ │ │ │ +130 for (i = 0; i < n_intersectionnodes; ++i) { │ │ │ │ │ +131 g1local[i] = grid1Geometry.local(P[i]); │ │ │ │ │ +132 g2local[i] = grid2Geometry.local(P[i]); │ │ │ │ │ +133 } │ │ │ │ │ +134 │ │ │ │ │ +135 _i_n_t_e_r_s_e_c_t_i_o_n_s.emplace_back(grid1Index, grid2Index); │ │ │ │ │ +136 for (i = 0; i < n_intersectionnodes; ++i) { │ │ │ │ │ +137 _i_n_t_e_r_s_e_c_t_i_o_n_s.back().corners0[0][i] = g1local[i]; │ │ │ │ │ +138 _i_n_t_e_r_s_e_c_t_i_o_n_s.back().corners1[0][i] = g2local[i]; │ │ │ │ │ +139 } │ │ │ │ │ +140 │ │ │ │ │ +141 } else if (P.size() > n_intersectionnodes) { // P is a union of simplices │ │ │ │ │ +of dimension dimis │ │ │ │ │ +142 │ │ │ │ │ +143 assert(dimis != 1); │ │ │ │ │ +144 std::vector > global(n_intersectionnodes); │ │ │ │ │ +145 │ │ │ │ │ +146 // Compute the centroid │ │ │ │ │ +147 centroid=0; │ │ │ │ │ +148 for (size_type i=0; i < P.size(); i++) │ │ │ │ │ +149 centroid += P[i] ; │ │ │ │ │ +150 centroid /= static_cast(P.size()) ; │ │ │ │ │ +151 │ │ │ │ │ +152 // order the points and get intersection face indices │ │ │ │ │ +153 H.clear() ; │ │ │ │ │ +154 _I_n_t_e_r_s_e_c_t_i_o_n_C_o_m_p_u_t_a_t_i_o_n_<_C_M_>_:_:_t_e_m_p_l_a_t_e orderPoints │ │ │ │ │ +(centroid,SX,SY,P,H); │ │ │ │ │ +155 │ │ │ │ │ +156 // Loop over all intersection elements │ │ │ │ │ +157 for (size_type i=0; i < H.size(); i++) { │ │ │ │ │ +158 int hs = H[i].size(); // number of nodes of the intersection │ │ │ │ │ +159 │ │ │ │ │ +160 // if the intersection element is not degenerated │ │ │ │ │ +161 if (hs==dimis) { │ │ │ │ │ +162 │ │ │ │ │ +163 // create the intersection geometry │ │ │ │ │ +164 for ( size_type j=0 ; j < dimis; ++j) { │ │ │ │ │ +165 global[j]= P[H[i][j]]; // get the intersection face │ │ │ │ │ +166 } │ │ │ │ │ +167 │ │ │ │ │ +168 // intersection face + centroid = new element │ │ │ │ │ +169 global[dimis]=centroid; │ │ │ │ │ +170 │ │ │ │ │ +171 // create local representation of the intersection │ │ │ │ │ +172 for (size_type j = 0; j < n_intersectionnodes; ++j) { │ │ │ │ │ +173 g1local[j] = grid1Geometry.local(global[j]); │ │ │ │ │ +174 g2local[j] = grid2Geometry.local(global[j]); │ │ │ │ │ +175 } │ │ │ │ │ +176 │ │ │ │ │ +177 _i_n_t_e_r_s_e_c_t_i_o_n_s.emplace_back(grid1Index,grid2Index); │ │ │ │ │ +178 for (size_type j = 0; j < n_intersectionnodes; ++j) { │ │ │ │ │ +179 _i_n_t_e_r_s_e_c_t_i_o_n_s.back().corners0[0][j] = g1local[j]; │ │ │ │ │ +180 _i_n_t_e_r_s_e_c_t_i_o_n_s.back().corners1[0][j] = g2local[j]; │ │ │ │ │ +181 } │ │ │ │ │ +182 } │ │ │ │ │ +183 } │ │ │ │ │ +184 } │ │ │ │ │ +185} │ │ │ │ │ +186 │ │ │ │ │ +187} /* namespace Dune::GridGlue */ │ │ │ │ │ +188} /* namespace Dune */ │ │ │ │ │ +189 │ │ │ │ │ +190#endif // DUNE_GRIDGLUE_OVERLAPPINGMERGE_CC │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t │ │ │ │ │ -DDeeffiinniittiioonn intersectionlist.hh:134 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r │ │ │ │ │ -Abstract base for all classes that take extracted grids and build sets of │ │ │ │ │ -intersections. │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:27 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_p_a_r_e_n_t │ │ │ │ │ -unsigned int parent(unsigned int idx, unsigned int parId=0) const │ │ │ │ │ -get index of grid-n's parent simplex for given merged grid simplex │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_c_l_e_a_r │ │ │ │ │ -virtual void clear()=0 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_W_o_r_l_d_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< ctype, dimworld > WorldCoords │ │ │ │ │ -the coordinate type used in this interface │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_G_r_i_d_1_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< ctype, grid1Dim > Grid1Coords │ │ │ │ │ -the local coordinate type for the grid1 coordinates │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:31 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_c_o_u_n_t_e_r │ │ │ │ │ -unsigned int counter │ │ │ │ │ -Counts the number of times the computeIntersection method has been called. │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:114 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_p_a_r_e_n_t_L_o_c_a_l │ │ │ │ │ -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... │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:105 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_b_u_i_l_d │ │ │ │ │ -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 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_n_S_i_m_p_l_i_c_e_s │ │ │ │ │ -unsigned int nSimplices() const │ │ │ │ │ -get the number of simplices in the merged grid The indices are then in │ │ │ │ │ -0..nSimplices()-1 │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:64 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_i_n_t_e_r_s_e_c_t_i_o_n_L_i_s_t │ │ │ │ │ -virtual std::shared_ptr< IntersectionList > intersectionList() const =0 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_p_a_r_e_n_t_s │ │ │ │ │ -unsigned int parents(unsigned int idx) const │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:80 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_M_e_r_g_e_r_:_:_G_r_i_d_2_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< ctype, grid2Dim > Grid2Coords │ │ │ │ │ -the local coordinate type for the grid2 coordinates │ │ │ │ │ -DDeeffiinniittiioonn merger.hh:34 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... │ │ │ │ │ +> &reverse=!reversed) │ │ │ │ │ +Iterate over all intersections of a GridGlue. │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_C_o_m_p_u_t_a_t_i_o_n │ │ │ │ │ +Intersection computation method for two elements of arbitrary dimension. │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_C_o_m_p_u_t_a_t_i_o_n_:_:_c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_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,... │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.cc:14 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e_:_:_c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ │ +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. │ │ │ │ │ +DDeeffiinniittiioonn overlappingmerge.cc:34 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_i_m_p_l_e_x_M_e_t_h_o_d │ │ │ │ │ +DDeeffiinniittiioonn simplexintersection.cc:30 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: standardmerge.cc File Reference │ │ │ │ +dune-grid-glue: standardmerge.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,55 +70,85 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ Macros | │ │ │ │ Functions
│ │ │ │ -
standardmerge.cc File Reference
│ │ │ │ +
standardmerge.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include "config.h"
│ │ │ │ -#include "standardmerge.hh"
│ │ │ │ -
│ │ │ │ + │ │ │ │ +

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

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

Go to the source code of this file.

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

│ │ │ │ +Classes

class  Dune::GridGlue::StandardMerge< T, grid1Dim, grid2Dim, dimworld >
 Common base class for many merger implementations: produce pairs of entities that may intersect. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Macros

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

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

Macro Definition Documentation

│ │ │ │ +

Detailed Description

│ │ │ │ +

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

│ │ │ │ +

Macro Definition Documentation

│ │ │ │ │ │ │ │

◆ DECL

│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │
#define DECL#define DECL   extern
│ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ @@ -155,22 +185,22 @@ │ │ │ │ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ Value:
DECL template \
│ │ │ │ -
void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1_coords, \
│ │ │ │ +
void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1Coords, \
│ │ │ │
const std::vector<unsigned int>& grid1_elements, \
│ │ │ │
const std::vector<Dune::GeometryType>& grid1_element_types, \
│ │ │ │ -
const std::vector<Dune::FieldVector<T,C> >& grid2_coords, \
│ │ │ │ +
const std::vector<Dune::FieldVector<T,C> >& grid2Coords, \
│ │ │ │
const std::vector<unsigned int>& grid2_elements, \
│ │ │ │
const std::vector<Dune::GeometryType>& grid2_element_types \
│ │ │ │
)
│ │ │ │ -
#define DECL
Definition standardmerge.cc:12
│ │ │ │ +
#define DECL
Definition standardmerge.hh:827
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │