--- /srv/reproducible-results/rbuild-debian/r-b-build.IXoOGurl/b1/dune-grid-glue_2.9.0-3_amd64.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.IXoOGurl/b2/dune-grid-glue_2.9.0-3_amd64.changes ├── Files │ @@ -1,4 +1,4 @@ │ │ fdddf7d9ef42bda23950b2a469b45b0c 907724 debug optional libdune-grid-glue-dev-dbgsym_2.9.0-3_amd64.deb │ 7c41372d968ba78ea4eb059c7166eb21 106412 libdevel optional libdune-grid-glue-dev_2.9.0-3_amd64.deb │ - 3392af57af1ffc5dd4f29ee34711ec73 959500 doc optional libdune-grid-glue-doc_2.9.0-3_all.deb │ + 7a93303607750edcc1cdd5fe0874c505 959484 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 7388 2023-01-13 13:23:40.000000 control.tar.xz │ │ --rw-r--r-- 0 0 0 951920 2023-01-13 13:23:40.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 7408 2023-01-13 13:23:40.000000 control.tar.xz │ │ +-rw-r--r-- 0 0 0 951884 2023-01-13 13:23:40.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ │ │ │ ├── line order │ │ │ │ │ @@ -44,18 +44,18 @@ │ │ │ │ │ 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 │ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00080_source.html │ │ │ │ │ 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 │ ├── 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) 8112 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) 119797 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) 5797 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) 52527 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/a00005.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/a00005_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/a00008.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/a00008_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/a00011.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/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) 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) 5321 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) 16899 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) 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) 8136 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) 72681 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) 5980 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) 27621 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) 7675 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) 11025 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) 5360 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) 8500 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) 5388 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) 50226 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) 5453 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) 27383 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) 5321 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) 16899 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) 6157 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) 14373 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) 8112 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) 119797 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) 8136 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) 72681 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) 7675 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) 11025 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) 6619 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) 9138 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) 11613 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) 39771 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) 7370 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) 44830 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) 5980 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) 27621 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) 8222 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) 30066 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) 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) 5429 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) 44826 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) 5967 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) 37342 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) 6647 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) 36462 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) 6348 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) 45998 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) 5930 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) 19310 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) 10146 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) 4310 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) 55659 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) 11543 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) 239992 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) 4559 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) 63705 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) 6080 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) 59845 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) 5357 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) 22694 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) 5484 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) 36322 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) 12399 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) 149554 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) 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) 4310 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) 55659 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) 5930 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) 19310 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) 10146 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) 6647 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) 36462 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) 5357 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) 22694 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) 6348 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) 45998 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) 6080 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) 59845 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) 11543 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) 239992 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) 5484 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) 36322 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) 4559 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) 63705 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) 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 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html │ │ │ │ @@ -88,27 +88,27 @@ │ │ │ │ #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 <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/rangegenerators.hh"
│ │ │ │ #include "adapter/gridglue.cc"
│ │ │ │ -#include "adapter/intersection.hh"
│ │ │ │ -#include "adapter/intersectioniterator.hh"
│ │ │ │ -#include "adapter/intersectionindexset.hh"
│ │ │ │ +#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 │ │ │ │ @@ -96,15 +96,15 @@ │ │ │ │
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>
│ │ │ │ +
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"
│ │ │ │
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
│ │ │ │ -
intersection.hh
Model of the Intersection concept provided by GridGlue.
│ │ │ │ +
intersectionindexset.hh
│ │ │ │
gridglue.cc
│ │ │ │
gridgluecommunicate.hh
Describes the parallel communication interface class for Dune::GridGlue.
│ │ │ │ -
intersectionindexset.hh
│ │ │ │ -
intersectioniterator.hh
Implement iterators over GridGlue intersections.
│ │ │ │ -
rangegenerators.hh
│ │ │ │ -
merger.hh
│ │ │ │ +
intersectioniterator.hh
Implement iterators over GridGlue intersections.
│ │ │ │ +
rangegenerators.hh
│ │ │ │ +
intersection.hh
Model of the Intersection concept provided by GridGlue.
│ │ │ │ +
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 │ │ │ │ │ -_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 │ │ │ │ │ _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. │ │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_i_n_d_e_x_s_e_t_._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. │ │ │ │ │ _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. │ │ │ │ │ _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: intersection.hh File Reference │ │ │ │ +dune-grid-glue: gridgluevtkwriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,74 +71,47 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Macros
│ │ │ │ -
intersection.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
gridgluevtkwriter.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <algorithm>
│ │ │ │ -#include <optional>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include <dune/common/deprecated.hh>
│ │ │ │ -#include <dune/common/version.hh>
│ │ │ │ -#include <dune/geometry/affinegeometry.hh>
│ │ │ │ +
#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>
│ │ │ │
│ │ │ │

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::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...
class  Dune::GridGlue::GridGlueVtkWriter
 Write remote intersections to a vtk file for debugging purposes. 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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ +

Write all remote intersections to a vtk file for debugging.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,46 +1,33 @@ │ │ │ │ │ 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 │ │ │ │ │ +_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 │ │ │ │ │ #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_:_:_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_._._. │ │ │ │ │ +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 │ │ │ │ │   │ │ │ │ │ -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 │ │ │ │ │ +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/a00005_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersection.hh Source File │ │ │ │ +dune-grid-glue: gridgluevtkwriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,578 +74,318 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
intersection.hh
│ │ │ │ +
gridgluevtkwriter.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>
│ │ │ │ - │ │ │ │ +
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#define ONLY_SIMPLEX_INTERSECTIONS
│ │ │ │ -
25
│ │ │ │ -
26namespace Dune {
│ │ │ │ -
27 namespace GridGlue {
│ │ │ │ +
24#include <fstream>
│ │ │ │ +
25#include <iomanip>
│ │ │ │ +
26#include <type_traits>
│ │ │ │ +
27#include <vector>
│ │ │ │
28
│ │ │ │ -
29 // forward declaration
│ │ │ │ -
30 template<typename P0, typename P1>
│ │ │ │ -
31 class IntersectionIndexSet;
│ │ │ │ +
29#include <dune/common/classname.hh>
│ │ │ │ +
30#include <dune/geometry/type.hh>
│ │ │ │ +
31#include <dune/geometry/referenceelements.hh>
│ │ │ │
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>;
│ │ │ │ + │ │ │ │ +
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 using Grid0LocalGeometry [[deprecated("please use GridLocalGeometry<0> instead")]] = GridLocalGeometry<0>;
│ │ │ │ -
61 using Grid1LocalGeometry [[deprecated("please use GridLocalGeometry<1> instead")]] = GridLocalGeometry<1>;
│ │ │ │ +
60 const int domdimw = GridView::dimensionworld;
│ │ │ │ +
61 const int patchDim = Extractor::dim - Extractor::codim;
│ │ │ │
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>;
│ │ │ │ +
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 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]; }
│ │ │ │ -
│ │ │ │ -
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]; }
│ │ │ │ -
│ │ │ │ +
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 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);
│ │ │ │ +
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 /* 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;
│ │ │ │ +
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
│ │ │ │ -
121 std::vector< GridIndexType<side> > gridindices;
│ │ │ │ -
122
│ │ │ │ -
124 std::vector< std::optional< GridLocalGeometry<side> > > gridlocalgeom;
│ │ │ │ +
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
│ │ │ │ -
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;
│ │ │ │ +
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 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;
│ │ │ │ +
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 (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 }
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
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
│ │ │ │ - │ │ │ │ - │ │ │ │ +
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
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
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;
│ │ │ │ +
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
│ │ │ │ -
291 static constexpr auto mydim = Traits::mydim;
│ │ │ │ +
290 writeIntersections<Glue,1>(glue,
│ │ │ │ +
291 filenameTrunk + "-intersections-grid1.vtk");
│ │ │ │
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 }
│ │ │ │ +
293 }
│ │ │ │
│ │ │ │ -
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 };
│ │ │ │ +
294
│ │ │ │ +
295};
│ │ │ │
│ │ │ │ -
510
│ │ │ │ -
511
│ │ │ │ -
512 } // end namespace GridGlue
│ │ │ │ -
513} // end namespace Dune
│ │ │ │ -
514
│ │ │ │ -
515#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH
│ │ │ │ +
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
│ │ │ │ -
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.
│ │ │ │ +
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,752 +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 │ │ │ │ │ -intersection.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// -*- 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 │ │ │ │ │ -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> │ │ │ │ │ +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 │ │ │ │ │ -_2_4#define ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ │ -25 │ │ │ │ │ -26namespace _D_u_n_e { │ │ │ │ │ -27 namespace GridGlue { │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26#include │ │ │ │ │ +27#include │ │ │ │ │ 28 │ │ │ │ │ -29 // forward declaration │ │ │ │ │ -30 template │ │ │ │ │ -31 class IntersectionIndexSet; │ │ │ │ │ +29#include │ │ │ │ │ +30#include │ │ │ │ │ +31#include │ │ │ │ │ 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>; │ │ │ │ │ +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 │ │ │ │ │ -_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_>; │ │ │ │ │ +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 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_>; │ │ │ │ │ +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 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]; } │ │ │ │ │ +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_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); │ │ │ │ │ +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 │ │ │ │ │ -116 struct SideData { │ │ │ │ │ -118 bool gridlocal = false; │ │ │ │ │ +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 │ │ │ │ │ -121 std::vector< GridIndexType > gridindices; │ │ │ │ │ -122 │ │ │ │ │ -124 std::vector< std::optional< GridLocalGeometry > > gridlocalgeom; │ │ │ │ │ +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 │ │ │ │ │ -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; │ │ │ │ │ +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:: │ │ │ │ │ -template Codim<0>::Geometry::mydimension; │ │ │ │ │ -161 │ │ │ │ │ -162 // coordinates within the subentity that contains the remote intersection │ │ │ │ │ -163 std::array() >, nSimplexCorners> │ │ │ │ │ -corners_subEntity_local; │ │ │ │ │ +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() << " 1" << │ │ │ │ │ +std::endl; │ │ │ │ │ +163 fgrid << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ 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 } │ │ │ │ │ +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 │ │ │ │ │ -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; │ │ │ │ │ +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 │ │ │ │ │ -_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; │ │ │ │ │ +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 │ │ │ │ │ -_2_9_1 static constexpr auto _m_y_d_i_m = _T_r_a_i_t_s_:_:_m_y_d_i_m; │ │ │ │ │ +290 writeIntersections(glue, │ │ │ │ │ +291 filenameTrunk + "-intersections-grid1.vtk"); │ │ │ │ │ 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 │ │ │ │ │ +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 │ │ │ │ │ -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_:_:_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/a00008.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridgluevtkwriter.hh File Reference │ │ │ │ +dune-grid-glue: intersectionindexset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,46 +72,34 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
gridgluevtkwriter.hh File Reference
│ │ │ │ +
intersectionindexset.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ -

Write all remote intersections to a vtk file for debugging. │ │ │ │ -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>
│ │ │ │ +#include <dune/grid-glue/adapter/intersection.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::IntersectionIndexSet< P0, P1 >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ -

Write all remote intersections to a vtk file for debugging.

│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,32 +2,21 @@ │ │ │ │ │ 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 │ │ │ │ │ +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 │ │ │ │ │ -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_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 │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -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/a00008_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridgluevtkwriter.hh Source File │ │ │ │ +dune-grid-glue: intersectionindexset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,318 +74,87 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
gridgluevtkwriter.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/*
│ │ │ │ -
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
│ │ │ │ +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 {
│ │ │ │ +
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#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());
│ │ │ │ +
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 using GridView = typename Glue::template GridView<side>;
│ │ │ │ -
56 using Extractor = typename Glue::template GridPatch<side>;
│ │ │ │ +
55 } // end namespace GridGlue
│ │ │ │ +
56} // end namespace Dune
│ │ │ │
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
│ │ │ │ +
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
│ │ │ │ -
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
│ │ │ │ +
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
│ │ │ │ +
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,349 +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 │ │ │ │ │ -gridgluevtkwriter.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/* │ │ │ │ │ -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 │ │ │ │ │ +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 { │ │ │ │ │ +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 │ │ │ │ │ -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()); │ │ │ │ │ +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 │ │ │ │ │ -55 using GridView = typename Glue::template GridView; │ │ │ │ │ -56 using _E_x_t_r_a_c_t_o_r = typename Glue::template GridPatch; │ │ │ │ │ +55 } // end namespace GridGlue │ │ │ │ │ +56} // end namespace Dune │ │ │ │ │ 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 │ │ │ │ │ +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_:_:_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_:_:_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_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/a00011.html │ │ │ │ @@ -75,19 +75,19 @@ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │
gridglue.cc File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include "intersection.hh"
│ │ │ │ +
#include "intersection.hh"
│ │ │ │ #include <vector>
│ │ │ │ #include <iterator>
│ │ │ │ #include "../gridglue.hh"
│ │ │ │ -#include "../common/ringcomm.hh"
│ │ │ │ +#include "../common/ringcomm.hh"
│ │ │ │ #include <dune/common/unused.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html │ │ │ │ @@ -83,15 +83,15 @@ │ │ │ │
│ │ │ │ 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"
│ │ │ │ +
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
│ │ │ │ @@ -534,15 +534,15 @@ │ │ │ │
440 }
│ │ │ │
441 }
│ │ │ │
442}
│ │ │ │
│ │ │ │
443
│ │ │ │
444} // end namespace GridGlue
│ │ │ │
445} // end namespace Dune
│ │ │ │ -
Model of the Intersection concept provided by GridGlue.
│ │ │ │ +
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
│ │ │ │
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
│ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectionindexset.hh File Reference │ │ │ │ +dune-grid-glue: gridglueamirawriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,34 +72,41 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
intersectionindexset.hh File Reference
│ │ │ │ +
gridglueamirawriter.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/grid-glue/gridglue.hh>
│ │ │ │ -#include <dune/grid-glue/adapter/intersection.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.

│ │ │ │

│ │ │ │ Namespaces

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

│ │ │ │ Classes

class  Dune::GridGlue::IntersectionIndexSet< P0, P1 >
class  Dune::GridGlue::GridGlueAmiraWriter
 Write remote intersections to a AmiraMesh file for debugging purposes. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ +

Write all remote intersections to a AmiraMesh file.

│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,21 +2,27 @@ │ │ │ │ │ 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 │ │ │ │ │ -#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> │ │ │ │ │ +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_:_:_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_:_:_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 │ │ │ │ │   │ │ │ │ │ +********** 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/a00017_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectionindexset.hh Source File │ │ │ │ +dune-grid-glue: gridglueamirawriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,87 +74,166 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
intersectionindexset.hh
│ │ │ │ +
gridglueamirawriter.hh
│ │ │ │
│ │ │ │
│ │ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ │ +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
│ │ │ │ +
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 {
│ │ │ │ -
16 namespace GridGlue {
│ │ │ │ +
16namespace 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 public:
│ │ │ │ -
25
│ │ │ │ - │ │ │ │ -
29 typedef size_t SizeType;
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
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
│ │ │ │ -
33 template<int I, int O>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
35 {
│ │ │ │ -
36 return i.i_->index_;
│ │ │ │ -
37 }
│ │ │ │ -
│ │ │ │ +
31 std::ofstream fgrid;
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ -
41 SizeType size () const
│ │ │ │ -
42 {
│ │ │ │ -
43 return glue_->size();
│ │ │ │ -
44 }
│ │ │ │ -
│ │ │ │ +
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 private:
│ │ │ │ +
46 if (dim==3) {
│ │ │ │
47
│ │ │ │ - │ │ │ │ -
50 glue_(g) {}
│ │ │ │ -
51
│ │ │ │ -
52 const GridGlue * glue_;
│ │ │ │ -
53 };
│ │ │ │ -
│ │ │ │ -
54
│ │ │ │ -
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.
│ │ │ │ +
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";
│ │ │ │ +
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
│ │ │ │ -
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
│ │ │ │ -
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
│ │ │ │ +
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,105 +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 │ │ │ │ │ -intersectionindexset.hh │ │ │ │ │ +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// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see 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 │ │ │ │ │ -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 │ │ │ │ │ +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 { │ │ │ │ │ -16 namespace _G_r_i_d_G_l_u_e { │ │ │ │ │ +16namespace GridGlue { │ │ │ │ │ 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 │ │ │ │ │ -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; │ │ │ │ │ +_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 │ │ │ │ │ -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 } │ │ │ │ │ +31 std::ofstream fgrid; │ │ │ │ │ +32 │ │ │ │ │ +33 fgrid.open(filename.c_str()); │ │ │ │ │ +34 │ │ │ │ │ +35 using GridView = typename Glue::template GridView; │ │ │ │ │ +36 const int dim = GridView::dimension; │ │ │ │ │ +37 const int domdimw = GridView::dimensionworld; │ │ │ │ │ 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 } │ │ │ │ │ +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 private: │ │ │ │ │ +46 if (dim==3) { │ │ │ │ │ 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 │ │ │ │ │ -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. │ │ │ │ │ +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"; │ │ │ │ │ +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_:_:_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_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_:_:_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/a00020.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridglueamirawriter.hh File Reference │ │ │ │ +dune-grid-glue: intersectioniterator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,41 +72,39 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
gridglueamirawriter.hh File Reference
│ │ │ │ +
intersectioniterator.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

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

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

│ │ │ │ -
#include <fstream>
│ │ │ │ -#include <sstream>
│ │ │ │ -#include <type_traits>
│ │ │ │ +
#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::IntersectionIterator< P0, P1, inside, outside >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

Write all remote intersections to a AmiraMesh file.

│ │ │ │ +

Implement iterators over GridGlue intersections.

│ │ │ │ +
Author
Christian Engwer
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,27 +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 │ │ │ │ │ -gridglueamirawriter.hh File Reference │ │ │ │ │ -Write all remote intersections to a AmiraMesh file. _M_o_r_e_._._. │ │ │ │ │ -#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_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_._._. │ │ │ │ │ +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 AmiraMesh file. │ │ │ │ │ +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/a00020_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridglueamirawriter.hh Source File │ │ │ │ +dune-grid-glue: intersectioniterator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,166 +74,95 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
gridglueamirawriter.hh
│ │ │ │ +
intersectioniterator.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>
│ │ │ │ +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
│ │ │ │
14
│ │ │ │ -
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");
│ │ │ │ + │ │ │ │ +
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 std::ofstream fgrid;
│ │ │ │ -
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";
│ │ │ │ +
│ │ │ │ +
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 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";
│ │ │ │ +
│ │ │ │ +
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 // ////////////////////////////////////////////
│ │ │ │ -
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
│ │ │ │ +
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
│ │ │ │ -
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
│ │ │ │ +
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,165 +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 │ │ │ │ │ -gridglueamirawriter.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// 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 │ │ │ │ │ +12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ +13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH │ │ │ │ │ 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{ │ │ │ │ │ -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"); │ │ │ │ │ +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 │ │ │ │ │ -31 std::ofstream fgrid; │ │ │ │ │ -32 │ │ │ │ │ -33 fgrid.open(filename.c_str()); │ │ │ │ │ -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"; │ │ │ │ │ +_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 │ │ │ │ │ -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"; │ │ │ │ │ +_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 // //////////////////////////////////////////// │ │ │ │ │ -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 │ │ │ │ │ +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_:_:_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_:_:_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/a00023.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectioniterator.hh File Reference │ │ │ │ +dune-grid-glue: rangegenerators.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,40 +71,42 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
intersectioniterator.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
rangegenerators.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

│ │ │ │ -
#include <dune/grid-glue/gridglue.hh>
│ │ │ │ +
#include <dune/common/iteratorrange.hh>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

class  Dune::GridGlue::IntersectionIterator< P0, P1, inside, outside >
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.
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

Implement iterators over GridGlue intersections.

│ │ │ │ -
Author
Christian Engwer
│ │ │ │ -
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,26 +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 │ │ │ │ │ -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 | _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_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_:_:_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 │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Implement iterators over GridGlue intersections. │ │ │ │ │ - Author │ │ │ │ │ - Christian Engwer │ │ │ │ │ +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. │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: intersectioniterator.hh Source File │ │ │ │ +dune-grid-glue: rangegenerators.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,95 +74,78 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
intersectioniterator.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
│ │ │ │ -
12#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │ -
13#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
│ │ │ │ -
14
│ │ │ │ - │ │ │ │ -
16
│ │ │ │ -
17namespace Dune {
│ │ │ │ -
18 namespace GridGlue {
│ │ │ │ +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
│ │ │ │ -
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.
│ │ │ │ +
20 constexpr
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
22 { return {}; }
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ - │ │ │ │ -
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
│ │ │ │ +
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,99 +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 │ │ │ │ │ -intersectioniterator.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 │ │ │ │ │ -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 { │ │ │ │ │ +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 │ │ │ │ │ -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. │ │ │ │ │ +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 │ │ │ │ │ +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_:_:_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_:_:_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/a00026.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: rangegenerators.hh File Reference │ │ │ │ +dune-grid-glue: intersection.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,41 +72,73 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces | │ │ │ │ -Functions
│ │ │ │ -
rangegenerators.hh File Reference
│ │ │ │ +Macros
│ │ │ │ +
intersection.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <dune/common/iteratorrange.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

struct  Dune::GridGlue::Reverse< reverse >
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
 
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │

│ │ │ │ -Functions

template<... >
IteratorRange<... > Dune::GridGlue::intersections (const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
 Iterate over all intersections of a 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,27 +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 | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -rangegenerators.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +_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> │ │ │ │ │ _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_ _> │ │ │ │ │ + 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 │ │ │ │ │   │ │ │ │ │ -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. │ │ │ │ │ +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/a00026_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: rangegenerators.hh Source File │ │ │ │ +dune-grid-glue: intersection.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,78 +74,578 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
rangegenerators.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_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
│ │ │ │ - │ │ │ │ +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;
│ │ │ │
32
│ │ │ │ -
66template<...>
│ │ │ │ -
67IteratorRange<...>
│ │ │ │ -
68intersections(const GridGlue<...>& glue, const Reverse<...>& reverse = !reversed);
│ │ │ │ +
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>;
│ │ │ │
69
│ │ │ │ -
70#else
│ │ │ │ -
71
│ │ │ │ -
72namespace {
│ │ │ │ -
73const Reverse<true> reversed = {};
│ │ │ │ -
74} /* namespace */
│ │ │ │ +
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
│ │ │ │ -
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}
│ │ │ │ +
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#endif // DOXYGEN
│ │ │ │ -
85
│ │ │ │ -
86} /* namespace GridGlue */
│ │ │ │ -
87} /* namespace Dune */
│ │ │ │ -
88
│ │ │ │ -
89#endif
│ │ │ │ +
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.
│ │ │ │
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
│ │ │ │ -
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
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,88 +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 │ │ │ │ │ -rangegenerators.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_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; │ │ │ │ │ +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; │ │ │ │ │ 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); │ │ │ │ │ +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_>; │ │ │ │ │ 69 │ │ │ │ │ -70#else │ │ │ │ │ -71 │ │ │ │ │ -72namespace { │ │ │ │ │ -73const _R_e_v_e_r_s_e_<_t_r_u_e_> reversed = {}; │ │ │ │ │ -74} /* namespace */ │ │ │ │ │ +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 │ │ │ │ │ -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} │ │ │ │ │ +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#endif // DOXYGEN │ │ │ │ │ -85 │ │ │ │ │ -86} /* namespace GridGlue */ │ │ │ │ │ -87} /* namespace Dune */ │ │ │ │ │ -88 │ │ │ │ │ -89#endif │ │ │ │ │ +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. │ │ │ │ │ _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_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_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: projectionwriter_impl.hh File Reference │ │ │ │ +dune-grid-glue: projection_impl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,59 +72,47 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
projectionwriter_impl.hh File Reference
│ │ │ │ +
projection_impl.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <fstream>
│ │ │ │ +
#include <dune/common/fmatrix.hh>
│ │ │ │ +#include <cmath>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Namespaces

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

│ │ │ │ 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<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)
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,59 +2,43 @@ │ │ │ │ │ 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 │ │ │ │ │ +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_:_:_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 │ │ │ │ │ +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_:_:_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 │ │ │ │ │ + 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 │ │ │ │ │ -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) │ │ │ │ │ + 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 │ │ │ │ │ -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. │ │ │ │ │ + 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/a00029_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projectionwriter_impl.hh Source File │ │ │ │ +dune-grid-glue: projection_impl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,211 +74,464 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
projectionwriter_impl.hh
│ │ │ │ +
projection_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#include <fstream>
│ │ │ │ +
3#include <dune/common/fmatrix.hh>
│ │ │ │
4
│ │ │ │ -
5namespace Dune {
│ │ │ │ -
6namespace GridGlue {
│ │ │ │ -
7
│ │ │ │ -
│ │ │ │ -
8namespace ProjectionWriterImplementation {
│ │ │ │ +
5#include <cmath>
│ │ │ │ +
6
│ │ │ │ +
7namespace Dune {
│ │ │ │ +
8namespace GridGlue {
│ │ │ │
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}
│ │ │ │ -
│ │ │ │ -
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}
│ │ │ │ +
│ │ │ │ +
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}
│ │ │ │
│ │ │ │ -
41
│ │ │ │ -
42template<typename Coordinate, typename Corners>
│ │ │ │ +
32
│ │ │ │ +
42inline std::pair<unsigned, unsigned>
│ │ │ │
│ │ │ │ -
43void write_edge_intersection_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
│ │ │ │ +
43edgeToCorners(unsigned edge)
│ │ │ │
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}
│ │ │ │ +
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}
│ │ │ │
│ │ │ │ -
128
│ │ │ │ -
129template<typename Coordinate, typename Corners, typename Normals>
│ │ │ │ +
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>
│ │ │ │
│ │ │ │ -
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>
│ │ │ │ +
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
│ │ │ │ + │ │ │ │
│ │ │ │ -
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 */
│ │ │ │ +
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 */
│ │ │ │
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
│ │ │ │ +
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
│ │ │ │ -
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
│ │ │ │ +
Coordinate::field_type Field
Scalar type.
Definition projection.hh:61
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,238 +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 │ │ │ │ │ -projectionwriter_impl.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// 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 │ │ │ │ │ +3#include │ │ │ │ │ 4 │ │ │ │ │ -5namespace _D_u_n_e { │ │ │ │ │ -6namespace GridGlue { │ │ │ │ │ -7 │ │ │ │ │ -_8namespace ProjectionWriterImplementation { │ │ │ │ │ +5#include │ │ │ │ │ +6 │ │ │ │ │ +7namespace _D_u_n_e { │ │ │ │ │ +8namespace GridGlue { │ │ │ │ │ 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} │ │ │ │ │ -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; │ │ │ │ │ +_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 │ │ │ │ │ -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) │ │ │ │ │ +42inline std::pair │ │ │ │ │ +_4_3_e_d_g_e_T_o_C_o_r_n_e_r_s(unsigned edge) │ │ │ │ │ 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"; │ │ │ │ │ +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 │ │ │ │ │ -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 */ │ │ │ │ │ +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 */ │ │ │ │ │ _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_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_:_:_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_:_:_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/a00032.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/a00032_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/a00035.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: ringcomm.hh File Reference │ │ │ │ +dune-grid-glue: areawriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,77 +71,43 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ -Macros | │ │ │ │ Functions
│ │ │ │ -
ringcomm.hh File Reference
│ │ │ │ +
areawriter.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 <ostream>
│ │ │ │ +#include <string>
│ │ │ │ +#include "areawriter_impl.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Namespaces

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

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

Macro Definition Documentation

│ │ │ │ - │ │ │ │ -

◆ CheckMPIStatus

│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
#define CheckMPIStatus( A,
 
)   {}
│ │ │ │ -
│ │ │ │ -
Todo:
Implement MPI Status check with exception handling
│ │ │ │ - │ │ │ │ -
│ │ │ │ -
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,39 +1,32 @@ │ │ │ │ │ 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 │ │ │ │ │ +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_:_:_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)   {} │ │ │ │ │ +namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ 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 │ │ │ │ │ +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) │ │ │ │ │   │ │ │ │ │ -********** 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: ringcomm.hh Source File │ │ │ │ +dune-grid-glue: areawriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,309 +74,47 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
ringcomm.hh
│ │ │ │ +
areawriter.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
│ │ │ │ -
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
│ │ │ │ +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
│ │ │ │ +
5
│ │ │ │ +
6#include <ostream>
│ │ │ │ +
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
│ │ │ │ + │ │ │ │
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
│ │ │ │ +
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,308 +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 │ │ │ │ │ -ringcomm.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// -*- 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 │ │ │ │ │ -_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: projection_impl.hh File Reference │ │ │ │ +dune-grid-glue: projectionwriter_impl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,47 +72,59 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
projection_impl.hh File Reference
│ │ │ │ +
projectionwriter_impl.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <dune/common/fmatrix.hh>
│ │ │ │ -#include <cmath>
│ │ │ │ +
#include <fstream>
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Namespaces

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

│ │ │ │ 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<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 {} │ │ │ │ │ @@ -2,43 +2,59 @@ │ │ │ │ │ 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 │ │ │ │ │ +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_. │ │ │ │ │ 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 │ │ │ │ │ +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 │ │ │ │ │ - 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 │ │ │ │ │ +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 │ │ │ │ │ - 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) │ │ │ │ │ +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 │ │ │ │ │ - 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) │ │ │ │ │ +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/a00038_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projection_impl.hh Source File │ │ │ │ +dune-grid-glue: projectionwriter_impl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,464 +74,211 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
projection_impl.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#include <dune/common/fmatrix.hh>
│ │ │ │ +
3#include <fstream>
│ │ │ │
4
│ │ │ │ -
5#include <cmath>
│ │ │ │ -
6
│ │ │ │ -
7namespace Dune {
│ │ │ │ -
8namespace GridGlue {
│ │ │ │ +
5namespace Dune {
│ │ │ │ +
6namespace GridGlue {
│ │ │ │ +
7
│ │ │ │ +
│ │ │ │ +
8namespace ProjectionWriterImplementation {
│ │ │ │
9
│ │ │ │ -
│ │ │ │ -
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}
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
42inline std::pair<unsigned, unsigned>
│ │ │ │ +
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>
│ │ │ │
│ │ │ │ -
43edgeToCorners(unsigned edge)
│ │ │ │ +
43void write_edge_intersection_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
│ │ │ │
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}
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
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>
│ │ │ │ +
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>
│ │ │ │
│ │ │ │ -
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
│ │ │ │ - │ │ │ │ +
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>
│ │ │ │
│ │ │ │ -
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 */
│ │ │ │ +
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
│ │ │ │ -
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
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,480 +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_impl.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#include │ │ │ │ │ +3#include │ │ │ │ │ 4 │ │ │ │ │ -5#include │ │ │ │ │ -6 │ │ │ │ │ -7namespace _D_u_n_e { │ │ │ │ │ -8namespace GridGlue { │ │ │ │ │ +5namespace _D_u_n_e { │ │ │ │ │ +6namespace GridGlue { │ │ │ │ │ +7 │ │ │ │ │ +_8namespace ProjectionWriterImplementation { │ │ │ │ │ 9 │ │ │ │ │ -_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} │ │ │ │ │ +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 │ │ │ │ │ -42inline std::pair │ │ │ │ │ -_4_3_e_d_g_e_T_o_C_o_r_n_e_r_s(unsigned edge) │ │ │ │ │ +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 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} │ │ │ │ │ +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 │ │ │ │ │ -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 */ │ │ │ │ │ +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 */ │ │ │ │ │ _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_:_:_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_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: projection.hh File Reference │ │ │ │ +dune-grid-glue: crossproduct.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,41 +70,35 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
projection.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
crossproduct.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <array>
│ │ │ │ -#include <bitset>
│ │ │ │ -#include <tuple>
│ │ │ │ -#include "projection_impl.hh"
│ │ │ │ -
│ │ │ │ + │ │ │ │

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

│ │ │ │ +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
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,28 +1,24 @@ │ │ │ │ │ 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 │ │ │ │ │ +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_. │ │ │ │ │ -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 │ │ │ │ │   │ │ │ │ │ +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 │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: projection.hh Source File │ │ │ │ +dune-grid-glue: crossproduct.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,137 +74,48 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
projection.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#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │ +
3#ifndef DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH
│ │ │ │ +
4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1
│ │ │ │
5
│ │ │ │ -
6#include <array>
│ │ │ │ -
7#include <bitset>
│ │ │ │ -
8#include <tuple>
│ │ │ │ -
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;
│ │ │ │ -
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
│ │ │ │ - │ │ │ │ +
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
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
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
│ │ │ │ +
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,175 +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 │ │ │ │ │ -projection.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#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ +3#ifndef DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH │ │ │ │ │ +4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1 │ │ │ │ │ 5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8#include │ │ │ │ │ -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; │ │ │ │ │ -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 │ │ │ │ │ +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 │ │ │ │ │ _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 │ │ │ │ │ -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 │ │ │ │ │ +_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: areawriter_impl.hh File Reference │ │ │ │ +dune-grid-glue: ringcomm.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,57 +70,78 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces | │ │ │ │ +Macros | │ │ │ │ Functions
│ │ │ │ -
areawriter_impl.hh File Reference
│ │ │ │ +
ringcomm.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <fstream>
│ │ │ │ -#include <vector>
│ │ │ │ +
#include <mpi.h>
│ │ │ │ +#include <functional>
│ │ │ │ +#include <utility>
│ │ │ │ #include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/common/hybridutilities.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
namespace  Dune::Parallel
 
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +

│ │ │ │ +Macros

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

│ │ │ │ Functions

template<typename GridView >
void Dune::GridGlue::AreaWriterImplementation::write_facet_geometry (const GridView &gv, std::ostream &out)
 
template<int side, typename Glue >
void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, std::ostream &out)
 
template<int side, typename Glue >
void Dune::GridGlue::write_glue_area_vtk (const Glue &glue, const std::string &filename)
 
template<typename Glue >
void Dune::GridGlue::write_glue_areas_vtk (const Glue &glue, const std::string &base)
 
template<typename 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,43 +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 │ │ │ │ │ -_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 │ │ │ │ │ +_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 │ │ │ │ │ -#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_:_:_P_a_r_a_l_l_e_l │ │ │ │ │   │ │ │ │ │ -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 │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _C_h_e_c_k_M_P_I_S_t_a_t_u_s(A, B)   {} │ │ │ │ │   │ │ │ │ │ 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) │ │ │ │ │ -  │ │ │ │ │ +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/a00044_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: areawriter_impl.hh Source File │ │ │ │ +dune-grid-glue: ringcomm.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,183 +74,309 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
areawriter_impl.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#include <fstream>
│ │ │ │ -
4#include <vector>
│ │ │ │ -
5
│ │ │ │ -
6#include <dune/common/fvector.hh>
│ │ │ │ -
7#include <dune/geometry/type.hh>
│ │ │ │ -
8#include <dune/grid/common/mcmgmapper.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
│ │ │ │ +
8#define CheckMPIStatus(A,B) {}
│ │ │ │
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};
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
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}
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
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}
│ │ │ │ +
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}
│ │ │ │
│ │ │ │ -
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}
│ │ │ │ +
308
│ │ │ │ +
309} // end namespace Parallel
│ │ │ │
│ │ │ │ -
142
│ │ │ │ -
143} /* namespace GridGlue */
│ │ │ │ -
144} /* namespace Dune */
│ │ │ │ +
310} // end namespace Dune
│ │ │ │
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
│ │ │ │ +
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,184 +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 │ │ │ │ │ -areawriter_impl.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#include │ │ │ │ │ -4#include │ │ │ │ │ -5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8#include │ │ │ │ │ +5/* IMPLEMENTATION OF CLASS G R I D G L U E */ │ │ │ │ │ +6 │ │ │ │ │ +_8#define CheckMPIStatus(A,B) {} │ │ │ │ │ 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}; │ │ │ │ │ +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 │ │ │ │ │ -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 } │ │ │ │ │ +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 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 } │ │ │ │ │ +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} │ │ │ │ │ -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} │ │ │ │ │ +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 │ │ │ │ │ -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 */ │ │ │ │ │ +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: projectionwriter.hh File Reference │ │ │ │ +dune-grid-glue: projection.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,47 +70,41 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
projectionwriter.hh File Reference
│ │ │ │ +Classes | │ │ │ │ +Namespaces
│ │ │ │ +
projection.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ -
#include <iostream>
│ │ │ │ -#include <string>
│ │ │ │ -#include <dune/grid-glue/common/projection.hh>
│ │ │ │ -#include "projectionwriter_impl.hh"
│ │ │ │ +
#include <array>
│ │ │ │ +#include <bitset>
│ │ │ │ +#include <tuple>
│ │ │ │ +#include "projection_impl.hh"
│ │ │ │
│ │ │ │

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

│ │ │ │ -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.
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,37 +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 │ │ │ │ │ -_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 │ │ │ │ │ +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 │ │ │ │ │ + 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 │ │ │ │ │   │ │ │ │ │ -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. │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: projectionwriter.hh Source File │ │ │ │ +dune-grid-glue: projection.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,57 +74,137 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
projectionwriter.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#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH
│ │ │ │ +
3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │ +
4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH
│ │ │ │
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 <array>
│ │ │ │ +
7#include <bitset>
│ │ │ │ +
8#include <tuple>
│ │ │ │ +
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;
│ │ │ │ +
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
│ │ │ │ + │ │ │ │
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
│ │ │ │ +
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,62 +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 │ │ │ │ │ -projectionwriter.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#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH │ │ │ │ │ +3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ +4#define DUNE_GRIDGLUE_COMMON_PROJECTIONHELPER2_HH │ │ │ │ │ 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_w_r_i_t_e_r___i_m_p_l_._h_h │ │ │ │ │ -_p_r_o_j_e_c_t_i_o_n_._h_h │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8#include │ │ │ │ │ +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; │ │ │ │ │ +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 │ │ │ │ │ _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 │ │ │ │ │ +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/a00050.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: crossproduct.hh File Reference │ │ │ │ +dune-grid-glue: areawriter_impl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,35 +70,56 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ +Classes | │ │ │ │ Namespaces | │ │ │ │ Functions
│ │ │ │ -
crossproduct.hh File Reference
│ │ │ │ +
areawriter_impl.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ - │ │ │ │ +
#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<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 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,24 +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 │ │ │ │ │ -crossproduct.hh File Reference │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +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 │ │ │ │ │ -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_:_:_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/a00050_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: crossproduct.hh Source File │ │ │ │ +dune-grid-glue: areawriter_impl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,48 +74,183 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
crossproduct.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_CROSSPRODUCT_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1
│ │ │ │ +
3#include <fstream>
│ │ │ │ +
4#include <vector>
│ │ │ │
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)
│ │ │ │ +
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 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}
│ │ │ │ +
│ │ │ │ +
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} /* namespace GridGlue */
│ │ │ │ -
30} /* namespace Dune */
│ │ │ │ -
31
│ │ │ │ -
32#endif
│ │ │ │ +
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
│ │ │ │ -
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 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,49 +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 │ │ │ │ │ -crossproduct.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_CROSSPRODUCT_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_COMMON_CROSSPRODUCT_HH 1 │ │ │ │ │ +3#include │ │ │ │ │ +4#include │ │ │ │ │ 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) │ │ │ │ │ +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{ │ │ │ │ │ -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} │ │ │ │ │ +_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} /* namespace GridGlue */ │ │ │ │ │ -30} /* namespace Dune */ │ │ │ │ │ -31 │ │ │ │ │ -32#endif │ │ │ │ │ +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_:_:_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_:_:_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/a00053.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: codim0extractor.hh File Reference │ │ │ │ +dune-grid-glue: vtksurfacewriter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,42 +72,42 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
codim0extractor.hh File Reference
│ │ │ │ +
vtksurfacewriter.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Mesh grid extractor base class. │ │ │ │ +

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

│ │ │ │ -
#include <deque>
│ │ │ │ -#include <functional>
│ │ │ │ -#include <dune/common/deprecated.hh>
│ │ │ │ -#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ -#include "extractor.hh"
│ │ │ │ +
#include <fstream>
│ │ │ │ +#include <iomanip>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <cstring>
│ │ │ │ +#include "../adapter/gridgluevtkwriter.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

Mesh grid extractor base class.

│ │ │ │ +

helper class for graphical output of grids in generic representation

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,27 +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 │ │ │ │ │ -codim0extractor.hh File Reference │ │ │ │ │ -Mesh grid extractor base class. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_e_x_t_r_a_c_t_o_r_._h_h" │ │ │ │ │ +vtksurfacewriter.hh File Reference │ │ │ │ │ +helper class for graphical output of grids in generic representation _M_o_r_e_._._. │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include "_._._/_a_d_a_p_t_e_r_/_g_r_i_d_g_l_u_e_v_t_k_w_r_i_t_e_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_:_:_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_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │   │ │ │ │ │ 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. │ │ │ │ │ +helper class for graphical output of grids in generic representation │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: codim0extractor.hh Source File │ │ │ │ +dune-grid-glue: vtksurfacewriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,276 +74,258 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
codim0extractor.hh
│ │ │ │ +
vtksurfacewriter.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: VtkSurfaceWriter.hh
│ │ │ │
7 * Version: 1.0
│ │ │ │ -
8 * Created on: Jun 23, 2009
│ │ │ │ -
9 * Author: Oliver Sander, Christian Engwer
│ │ │ │ +
8 * Created on: Jan 16, 2009
│ │ │ │ +
9 * Author: Gerrit Buse
│ │ │ │
10 * ---------------------------------
│ │ │ │
11 * Project: dune-grid-glue
│ │ │ │ -
12 * Description: base class for grid extractors extracting surface grids
│ │ │ │ +
12 * Description: helper class for graphical output of grids in generic representation
│ │ │ │
13 *
│ │ │ │
14 */
│ │ │ │ -
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ -
21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ +
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH
│ │ │ │ +
21#define DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH
│ │ │ │
22
│ │ │ │ -
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{
│ │ │ │ +
23#include <fstream>
│ │ │ │ +
24#include <iomanip>
│ │ │ │ +
25#include <vector>
│ │ │ │ +
26#include <cstring>
│ │ │ │ +
27
│ │ │ │ +
28#include "../adapter/gridgluevtkwriter.hh"
│ │ │ │ +
29
│ │ │ │ +
30namespace Dune {
│ │ │ │ +
31
│ │ │ │ +
32 namespace GridGlue {
│ │ │ │ +
33
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
35{
│ │ │ │ +
36public:
│ │ │ │ +
37
│ │ │ │ +
38
│ │ │ │ +
│ │ │ │ +
39 VtkSurfaceWriter(const char* filename) : filename_(filename)
│ │ │ │ +
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;
│ │ │ │ - │ │ │ │ +
│ │ │ │ + │ │ │ │ +
43 {}
│ │ │ │ +
│ │ │ │ +
44
│ │ │ │ +
│ │ │ │ +
45 void setFilename(const char* name)
│ │ │ │ +
46 {
│ │ │ │ +
47 if (std::strlen(name) > 0)
│ │ │ │ +
48 this->filename_ = name;
│ │ │ │ +
49 }
│ │ │ │ +
│ │ │ │
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};
│ │ │ │ -
│ │ │ │ -
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.
│ │ │ │ +
51
│ │ │ │ +
52 template<typename K>
│ │ │ │ +
│ │ │ │ +
53 void writeSurface(const std::vector<K>& coords, const std::vector<unsigned int>& indices, int corners, int dim)
│ │ │ │ +
54 {
│ │ │ │ +
55 std::ofstream fos;
│ │ │ │ +
56 char buffer[64];
│ │ │ │ +
57 sprintf(buffer, "%s.vtk", this->filename_);
│ │ │ │ +
58 fos.open(buffer);
│ │ │ │ +
59 fos << std::setprecision(8) << std::setw(1);
│ │ │ │ +
60 // write preamble
│ │ │ │ +
61 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << std::endl;
│ │ │ │ +
62 this->writePoints(coords, dim, fos);
│ │ │ │ +
63 const int polycount = indices.size()/corners;
│ │ │ │ +
64 int corner_count[polycount];
│ │ │ │ +
65 for (int i = 0; i < polycount; ++i)
│ │ │ │ +
66 corner_count[i] = corners;
│ │ │ │ +
67 this->writePolygons(indices, corner_count, polycount, dim, fos);
│ │ │ │ +
68 fos.close();
│ │ │ │ +
69 }
│ │ │ │ +
│ │ │ │ +
70
│ │ │ │ +
71
│ │ │ │ +
72 template<typename K, typename T>
│ │ │ │ +
│ │ │ │ +
73 void writeSurfaceElementData(const std::vector<K>& coords, const std::vector<unsigned int>& indices, int corners, const std::vector<T>& data, const char* dataname, int dim)
│ │ │ │ +
74 {
│ │ │ │ +
75 std::ofstream fos;
│ │ │ │ +
76 char buffer[64];
│ │ │ │ +
77 sprintf(buffer, "%s.vtk", this->filename_);
│ │ │ │ +
78 fos.open(buffer);
│ │ │ │ +
79 fos << std::setprecision(8) << std::setw(1);
│ │ │ │ +
80 // write preamble
│ │ │ │ +
81 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << std::endl;
│ │ │ │ +
82 this->writePoints(coords, dim, fos);
│ │ │ │ +
83 const int polycount = indices.size()/corners;
│ │ │ │ +
84 int corner_count[polycount];
│ │ │ │ +
85 for (int i = 0; i < polycount; ++i)
│ │ │ │ +
86 corner_count[i] = corners;
│ │ │ │ +
87 this->writePolygons(indices, corner_count, polycount, dim, fos);
│ │ │ │ +
88 this->writeCellData(data, dataname, dim, fos);
│ │ │ │ +
89 fos.close();
│ │ │ │ +
90 }
│ │ │ │ +
│ │ │ │
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
│ │ │ │ -
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
│ │ │ │ -
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);
│ │ │ │ +
92
│ │ │ │ +
93 template<typename K, typename T>
│ │ │ │ +
│ │ │ │ +
94 void writeSurfaceVertexData(const std::vector<K>& coords, const std::vector<unsigned int>& indices, int corners, const std::vector<T>& data, const char* dataname, int dim)
│ │ │ │ +
95 {
│ │ │ │ +
96 std::ofstream fos;
│ │ │ │ +
97 char buffer[64];
│ │ │ │ +
98 sprintf(buffer, "%s.vtk", this->filename_);
│ │ │ │ +
99 fos.open(buffer);
│ │ │ │ +
100 fos << std::setprecision(8) << std::setw(1);
│ │ │ │ +
101 // write preamble
│ │ │ │ +
102 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << std::endl;
│ │ │ │ +
103 this->writePoints(coords, dim, fos);
│ │ │ │ +
104 const int polycount = indices.size()/corners;
│ │ │ │ +
105 int corner_count[polycount];
│ │ │ │ +
106 for (int i = 0; i < polycount; ++i)
│ │ │ │ +
107 corner_count[i] = corners;
│ │ │ │ +
108 this->writePolygons(indices, corner_count, polycount, dim, fos);
│ │ │ │ +
109 this->writePointData(data, dataname, dim, fos);
│ │ │ │ +
110 fos.close();
│ │ │ │ +
111 }
│ │ │ │ +
│ │ │ │ +
112
│ │ │ │ +
113protected:
│ │ │ │ +
114
│ │ │ │ +
115 template<typename K>
│ │ │ │ +
│ │ │ │ +
116 void writePoints(const std::vector<K>& coords, int dim, std::ofstream& fos)
│ │ │ │ +
117 {
│ │ │ │ +
118 fos << "DATASET POLYDATA\nPOINTS " << coords.size() << " " << TypeNames[Nametraits<K>::nameidx] << std::endl;
│ │ │ │ +
119 for (unsigned int i = 0; i < coords.size(); ++i)
│ │ │ │ +
120 {
│ │ │ │ +
121 fos << coords[i][0];
│ │ │ │ +
122 if (dim == 2)
│ │ │ │ +
123 fos << " " << coords[i][1] << " 0 \n" << coords[i][0] << " " << coords[i][1] << " 0.01" << std::endl;
│ │ │ │ +
124 else // dim == 3
│ │ │ │ +
125 fos << " " << coords[i][1] << " " << coords[i][2] << std::endl;
│ │ │ │ +
126 }
│ │ │ │ +
127 }
│ │ │ │ +
│ │ │ │
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 }
│ │ │ │ +
│ │ │ │ +
129 void writePolygons(const std::vector<unsigned int>& indices, const int* corners, int ncorners, int dim, std::ofstream& fos)
│ │ │ │ +
130 {
│ │ │ │ +
131 if (dim == 2)
│ │ │ │ +
132 {
│ │ │ │ +
133 fos << "POLYGONS " << indices.size()/2 << " " << 5*(indices.size() / 2) << std::endl;
│ │ │ │ +
134 for (unsigned int i = 0; i < indices.size(); i += 2)
│ │ │ │ +
135 fos << "4 " << 2*indices[i] << " " << 2*indices[i+1] << " " << 2*indices[i+1]+1 << " "<< 2*indices[i]+1 << std::endl;
│ │ │ │ +
136
│ │ │ │ +
137 // arbitrary shapes - ignored here!
│ │ │ │ +
138 // int sum = ncorners;
│ │ │ │ +
139 // for (int i = 0; i < ncorners; ++i)
│ │ │ │ +
140 // sum += (corners[i] > 2 ? corners[i] : 3);
│ │ │ │ +
141 //
│ │ │ │ +
142 // fos << "POLYGONS " << ncorners << " " << sum << std::endl;
│ │ │ │ +
143 // int index = 0;
│ │ │ │ +
144 // for (int i = 0; i < ncorners; ++i)
│ │ │ │ +
145 // {
│ │ │ │ +
146 // // write the first index twice if it is an egde
│ │ │ │ +
147 // // => triangle instead of edge - paraview can display it then
│ │ │ │ +
148 // if (corners[i] > 2)
│ │ │ │ +
149 // fos << corners[i];
│ │ │ │ +
150 // else
│ │ │ │ +
151 // fos << "3 " << indices[index];
│ │ │ │ +
152 //
│ │ │ │ +
153 // for (int j = 0; j < corners[i]; ++j)
│ │ │ │ +
154 // fos << " " << indices[index++];
│ │ │ │ +
155 // fos << std::endl;
│ │ │ │ +
156 // }
│ │ │ │ +
157 }
│ │ │ │ +
158 else
│ │ │ │ +
159 {
│ │ │ │ +
160 int sum = ncorners;
│ │ │ │ +
161 for (int i = 0; i < ncorners; ++i)
│ │ │ │ +
162 sum += corners[i];
│ │ │ │ +
163 fos << "POLYGONS " << ncorners << " " << sum << std::endl;
│ │ │ │ +
164 int index = 0;
│ │ │ │ +
165 for (int i = 0; i < ncorners; ++i)
│ │ │ │ +
166 {
│ │ │ │ +
167 fos << corners[i];
│ │ │ │ +
168 for (int j = 0; j < corners[i]; ++j)
│ │ │ │ +
169 fos << " " << indices[index++];
│ │ │ │ +
170 fos << std::endl;
│ │ │ │ +
171 }
│ │ │ │ +
172 }
│ │ │ │ +
173 }
│ │ │ │ +
│ │ │ │ +
174
│ │ │ │ +
175 template<typename T>
│ │ │ │ +
│ │ │ │ +
176 void writeCellData(const std::vector<T>& data, const char* dataname, int dim, std::ofstream& fos)
│ │ │ │ +
177 {
│ │ │ │ +
178 fos << "CELL_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl;
│ │ │ │ +
179 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits<T>::nameidx] << " 1" << std::endl;
│ │ │ │ +
180 fos << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ +
181 for (unsigned int i = 0; i < data.size(); ++i)
│ │ │ │ +
182 {
│ │ │ │ +
183 fos << data[i] << std::endl;
│ │ │ │ +
184 if (dim == 2)
│ │ │ │ +
185 fos << data[i] << std::endl;
│ │ │ │ +
186 }
│ │ │ │ +
187 }
│ │ │ │ +
│ │ │ │ +
188
│ │ │ │ +
189 template<typename T>
│ │ │ │ +
│ │ │ │ +
190 void writePointData(const std::vector<T>& data, const char* dataname, int dim, std::ofstream& fos)
│ │ │ │ +
191 {
│ │ │ │ +
192 fos << "POINT_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl;
│ │ │ │ +
193 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits<T>::nameidx] << " 1" << std::endl;
│ │ │ │ +
194 fos << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ +
195 for (unsigned int i = 0; i < data.size(); ++i)
│ │ │ │ +
196 {
│ │ │ │ +
197 fos << data[i] << std::endl;
│ │ │ │ +
198 if (dim == 2)
│ │ │ │ +
199 fos << data[i] << std::endl;
│ │ │ │ +
200 }
│ │ │ │ +
201 }
│ │ │ │ +
│ │ │ │ +
202
│ │ │ │ +
203
│ │ │ │ +
204private:
│ │ │ │ +
205 const char* filename_;
│ │ │ │ +
206};
│ │ │ │ +
│ │ │ │ +
207
│ │ │ │ +
208} // namespace GridGlue
│ │ │ │
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 }
│ │ │ │ -
233
│ │ │ │ -
234}
│ │ │ │ -
235
│ │ │ │ -
236} // namespace GridGlue
│ │ │ │ -
237
│ │ │ │ -
238} // namespace Dune
│ │ │ │ -
239
│ │ │ │ -
240#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ -
extractor base class
│ │ │ │ +
210} // namespace Dune
│ │ │ │ +
211
│ │ │ │ +
212#endif // DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH
│ │ │ │
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
│ │ │ │ -
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ -
int IndexType
Definition extractor.hh:77
│ │ │ │ -
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
│ │ │ │ - │ │ │ │ -
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
│ │ │ │ +
Definition vtksurfacewriter.hh:35
│ │ │ │ +
void writeCellData(const std::vector< T > &data, const char *dataname, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:176
│ │ │ │ +
void writePointData(const std::vector< T > &data, const char *dataname, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:190
│ │ │ │ +
void writeSurfaceVertexData(const std::vector< K > &coords, const std::vector< unsigned int > &indices, int corners, const std::vector< T > &data, const char *dataname, int dim)
Definition vtksurfacewriter.hh:94
│ │ │ │ +
void setFilename(const char *name)
Definition vtksurfacewriter.hh:45
│ │ │ │ +
void writeSurfaceElementData(const std::vector< K > &coords, const std::vector< unsigned int > &indices, int corners, const std::vector< T > &data, const char *dataname, int dim)
Definition vtksurfacewriter.hh:73
│ │ │ │ +
~VtkSurfaceWriter()
Definition vtksurfacewriter.hh:42
│ │ │ │ +
VtkSurfaceWriter(const char *filename)
Definition vtksurfacewriter.hh:39
│ │ │ │ +
void writeSurface(const std::vector< K > &coords, const std::vector< unsigned int > &indices, int corners, int dim)
Definition vtksurfacewriter.hh:53
│ │ │ │ +
void writePoints(const std::vector< K > &coords, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:116
│ │ │ │ +
void writePolygons(const std::vector< unsigned int > &indices, const int *corners, int ncorners, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:129
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,325 +1,280 @@ │ │ │ │ │ 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 │ │ │ │ │ -codim0extractor.hh │ │ │ │ │ +vtksurfacewriter.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: codim0extractor.hh │ │ │ │ │ +6 * Filename: VtkSurfaceWriter.hh │ │ │ │ │ 7 * Version: 1.0 │ │ │ │ │ -8 * Created on: Jun 23, 2009 │ │ │ │ │ -9 * Author: Oliver Sander, Christian Engwer │ │ │ │ │ +8 * Created on: Jan 16, 2009 │ │ │ │ │ +9 * Author: Gerrit Buse │ │ │ │ │ 10 * --------------------------------- │ │ │ │ │ 11 * Project: dune-grid-glue │ │ │ │ │ -12 * Description: base class for grid extractors extracting surface grids │ │ │ │ │ +12 * Description: helper class for graphical output of grids in generic │ │ │ │ │ +representation │ │ │ │ │ 13 * │ │ │ │ │ 14 */ │ │ │ │ │ -20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH │ │ │ │ │ -21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH │ │ │ │ │ +20#ifndef DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH │ │ │ │ │ +21#define DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH │ │ │ │ │ 22 │ │ │ │ │ -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{ │ │ │ │ │ +23#include │ │ │ │ │ +24#include │ │ │ │ │ +25#include │ │ │ │ │ +26#include │ │ │ │ │ +27 │ │ │ │ │ +28#include "../adapter/gridgluevtkwriter.hh" │ │ │ │ │ +29 │ │ │ │ │ +30namespace _D_u_n_e { │ │ │ │ │ +31 │ │ │ │ │ +32 namespace GridGlue { │ │ │ │ │ +33 │ │ │ │ │ +_3_4class _V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ +35{ │ │ │ │ │ +36public: │ │ │ │ │ +37 │ │ │ │ │ +38 │ │ │ │ │ +_3_9 _V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r(const char* filename) : filename_(filename) │ │ │ │ │ +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; │ │ │ │ │ +_4_2 _~_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r() │ │ │ │ │ +43 {} │ │ │ │ │ +44 │ │ │ │ │ +_4_5 void _s_e_t_F_i_l_e_n_a_m_e(const char* name) │ │ │ │ │ +46 { │ │ │ │ │ +47 if (std::strlen(name) > 0) │ │ │ │ │ +48 this->filename_ = name; │ │ │ │ │ +49 } │ │ │ │ │ 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 │ │ │ │ │ -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. │ │ │ │ │ +51 │ │ │ │ │ +52 template │ │ │ │ │ +_5_3 void _w_r_i_t_e_S_u_r_f_a_c_e(const std::vector& coords, const std::vector& indices, int corners, int dim) │ │ │ │ │ +54 { │ │ │ │ │ +55 std::ofstream fos; │ │ │ │ │ +56 char buffer[64]; │ │ │ │ │ +57 sprintf(buffer, "%s.vtk", this->filename_); │ │ │ │ │ +58 fos.open(buffer); │ │ │ │ │ +59 fos << std::setprecision(8) << std::setw(1); │ │ │ │ │ +60 // write preamble │ │ │ │ │ +61 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << │ │ │ │ │ +std::endl; │ │ │ │ │ +62 this->_w_r_i_t_e_P_o_i_n_t_s(coords, dim, fos); │ │ │ │ │ +63 const int polycount = indices.size()/corners; │ │ │ │ │ +64 int corner_count[polycount]; │ │ │ │ │ +65 for (int i = 0; i < polycount; ++i) │ │ │ │ │ +66 corner_count[i] = corners; │ │ │ │ │ +67 this->_w_r_i_t_e_P_o_l_y_g_o_n_s(indices, corner_count, polycount, dim, fos); │ │ │ │ │ +68 fos.close(); │ │ │ │ │ +69 } │ │ │ │ │ +70 │ │ │ │ │ +71 │ │ │ │ │ +72 template │ │ │ │ │ +_7_3 void _w_r_i_t_e_S_u_r_f_a_c_e_E_l_e_m_e_n_t_D_a_t_a(const std::vector& coords, const std:: │ │ │ │ │ +vector& indices, int corners, const std::vector& data, const │ │ │ │ │ +char* dataname, int dim) │ │ │ │ │ +74 { │ │ │ │ │ +75 std::ofstream fos; │ │ │ │ │ +76 char buffer[64]; │ │ │ │ │ +77 sprintf(buffer, "%s.vtk", this->filename_); │ │ │ │ │ +78 fos.open(buffer); │ │ │ │ │ +79 fos << std::setprecision(8) << std::setw(1); │ │ │ │ │ +80 // write preamble │ │ │ │ │ +81 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << │ │ │ │ │ +std::endl; │ │ │ │ │ +82 this->_w_r_i_t_e_P_o_i_n_t_s(coords, dim, fos); │ │ │ │ │ +83 const int polycount = indices.size()/corners; │ │ │ │ │ +84 int corner_count[polycount]; │ │ │ │ │ +85 for (int i = 0; i < polycount; ++i) │ │ │ │ │ +86 corner_count[i] = corners; │ │ │ │ │ +87 this->_w_r_i_t_e_P_o_l_y_g_o_n_s(indices, corner_count, polycount, dim, fos); │ │ │ │ │ +88 this->_w_r_i_t_e_C_e_l_l_D_a_t_a(data, dataname, dim, fos); │ │ │ │ │ +89 fos.close(); │ │ │ │ │ +90 } │ │ │ │ │ 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 │ │ │ │ │ -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 │ │ │ │ │ -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); │ │ │ │ │ +92 │ │ │ │ │ +93 template │ │ │ │ │ +_9_4 void _w_r_i_t_e_S_u_r_f_a_c_e_V_e_r_t_e_x_D_a_t_a(const std::vector& coords, const std:: │ │ │ │ │ +vector& indices, int corners, const std::vector& data, const │ │ │ │ │ +char* dataname, int dim) │ │ │ │ │ +95 { │ │ │ │ │ +96 std::ofstream fos; │ │ │ │ │ +97 char buffer[64]; │ │ │ │ │ +98 sprintf(buffer, "%s.vtk", this->filename_); │ │ │ │ │ +99 fos.open(buffer); │ │ │ │ │ +100 fos << std::setprecision(8) << std::setw(1); │ │ │ │ │ +101 // write preamble │ │ │ │ │ +102 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << │ │ │ │ │ +std::endl; │ │ │ │ │ +103 this->_w_r_i_t_e_P_o_i_n_t_s(coords, dim, fos); │ │ │ │ │ +104 const int polycount = indices.size()/corners; │ │ │ │ │ +105 int corner_count[polycount]; │ │ │ │ │ +106 for (int i = 0; i < polycount; ++i) │ │ │ │ │ +107 corner_count[i] = corners; │ │ │ │ │ +108 this->_w_r_i_t_e_P_o_l_y_g_o_n_s(indices, corner_count, polycount, dim, fos); │ │ │ │ │ +109 this->_w_r_i_t_e_P_o_i_n_t_D_a_t_a(data, dataname, dim, fos); │ │ │ │ │ +110 fos.close(); │ │ │ │ │ +111 } │ │ │ │ │ +112 │ │ │ │ │ +113protected: │ │ │ │ │ +114 │ │ │ │ │ +115 template │ │ │ │ │ +_1_1_6 void _w_r_i_t_e_P_o_i_n_t_s(const std::vector& coords, int dim, std::ofstream& fos) │ │ │ │ │ +117 { │ │ │ │ │ +118 fos << "DATASET POLYDATA\nPOINTS " << coords.size() << " " << TypeNames │ │ │ │ │ +[Nametraits::nameidx] << std::endl; │ │ │ │ │ +119 for (unsigned int i = 0; i < coords.size(); ++i) │ │ │ │ │ +120 { │ │ │ │ │ +121 fos << coords[i][0]; │ │ │ │ │ +122 if (dim == 2) │ │ │ │ │ +123 fos << " " << coords[i][1] << " 0 \n" << coords[i][0] << " " << coords[i] │ │ │ │ │ +[1] << " 0.01" << std::endl; │ │ │ │ │ +124 else // dim == 3 │ │ │ │ │ +125 fos << " " << coords[i][1] << " " << coords[i][2] << std::endl; │ │ │ │ │ +126 } │ │ │ │ │ +127 } │ │ │ │ │ 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 │ │ │ │ │ -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()) │ │ │ │ │ +_1_2_9 void _w_r_i_t_e_P_o_l_y_g_o_n_s(const std::vector& indices, const int* │ │ │ │ │ +corners, int ncorners, int dim, std::ofstream& fos) │ │ │ │ │ +130 { │ │ │ │ │ +131 if (dim == 2) │ │ │ │ │ +132 { │ │ │ │ │ +133 fos << "POLYGONS " << indices.size()/2 << " " << 5*(indices.size() / 2) << │ │ │ │ │ +std::endl; │ │ │ │ │ +134 for (unsigned int i = 0; i < indices.size(); i += 2) │ │ │ │ │ +135 fos << "4 " << 2*indices[i] << " " << 2*indices[i+1] << " " << 2*indices │ │ │ │ │ +[i+1]+1 << " "<< 2*indices[i]+1 << std::endl; │ │ │ │ │ +136 │ │ │ │ │ +137 // arbitrary shapes - ignored here! │ │ │ │ │ +138 // int sum = ncorners; │ │ │ │ │ +139 // for (int i = 0; i < ncorners; ++i) │ │ │ │ │ +140 // sum += (corners[i] > 2 ? corners[i] : 3); │ │ │ │ │ +141 // │ │ │ │ │ +142 // fos << "POLYGONS " << ncorners << " " << sum << std::endl; │ │ │ │ │ +143 // int index = 0; │ │ │ │ │ +144 // for (int i = 0; i < ncorners; ++i) │ │ │ │ │ +145 // { │ │ │ │ │ +146 // // write the first index twice if it is an egde │ │ │ │ │ +147 // // => triangle instead of edge - paraview can display it then │ │ │ │ │ +148 // if (corners[i] > 2) │ │ │ │ │ +149 // fos << corners[i]; │ │ │ │ │ +150 // else │ │ │ │ │ +151 // fos << "3 " << indices[index]; │ │ │ │ │ +152 // │ │ │ │ │ +153 // for (int j = 0; j < corners[i]; ++j) │ │ │ │ │ +154 // fos << " " << indices[index++]; │ │ │ │ │ +155 // fos << std::endl; │ │ │ │ │ +156 // } │ │ │ │ │ +157 } │ │ │ │ │ +158 else │ │ │ │ │ +159 { │ │ │ │ │ +160 int sum = ncorners; │ │ │ │ │ +161 for (int i = 0; i < ncorners; ++i) │ │ │ │ │ +162 sum += corners[i]; │ │ │ │ │ +163 fos << "POLYGONS " << ncorners << " " << sum << std::endl; │ │ │ │ │ +164 int index = 0; │ │ │ │ │ +165 for (int i = 0; i < ncorners; ++i) │ │ │ │ │ +166 { │ │ │ │ │ +167 fos << corners[i]; │ │ │ │ │ +168 for (int j = 0; j < corners[i]; ++j) │ │ │ │ │ +169 fos << " " << indices[index++]; │ │ │ │ │ +170 fos << std::endl; │ │ │ │ │ +171 } │ │ │ │ │ +172 } │ │ │ │ │ +173 } │ │ │ │ │ +174 │ │ │ │ │ +175 template │ │ │ │ │ +_1_7_6 void _w_r_i_t_e_C_e_l_l_D_a_t_a(const std::vector& data, const char* dataname, int │ │ │ │ │ +dim, std::ofstream& fos) │ │ │ │ │ +177 { │ │ │ │ │ +178 fos << "CELL_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl; │ │ │ │ │ +179 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits::nameidx] │ │ │ │ │ +<< " 1" << std::endl; │ │ │ │ │ +180 fos << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ +181 for (unsigned int i = 0; i < data.size(); ++i) │ │ │ │ │ 182 { │ │ │ │ │ -183 for (int i = 0; i < (1< │ │ │ │ │ +_1_9_0 void _w_r_i_t_e_P_o_i_n_t_D_a_t_a(const std::vector& data, const char* dataname, int │ │ │ │ │ +dim, std::ofstream& fos) │ │ │ │ │ +191 { │ │ │ │ │ +192 fos << "POINT_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl; │ │ │ │ │ +193 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits::nameidx] │ │ │ │ │ +<< " 1" << std::endl; │ │ │ │ │ +194 fos << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ +195 for (unsigned int i = 0; i < data.size(); ++i) │ │ │ │ │ +196 { │ │ │ │ │ +197 fos << data[i] << std::endl; │ │ │ │ │ +198 if (dim == 2) │ │ │ │ │ +199 fos << data[i] << std::endl; │ │ │ │ │ +200 } │ │ │ │ │ +201 } │ │ │ │ │ +202 │ │ │ │ │ +203 │ │ │ │ │ +204private: │ │ │ │ │ +205 const char* filename_; │ │ │ │ │ +206}; │ │ │ │ │ +207 │ │ │ │ │ +208} // namespace GridGlue │ │ │ │ │ 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 } │ │ │ │ │ -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 │ │ │ │ │ +210} // namespace Dune │ │ │ │ │ +211 │ │ │ │ │ +212#endif // DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH │ │ │ │ │ _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_<_ _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_:_:_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_,_ _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_:_:_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_:_:_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_<_ _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_:_:_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_:_:_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_:_:_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_:_:_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_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:35 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_C_e_l_l_D_a_t_a │ │ │ │ │ +void writeCellData(const std::vector< T > &data, const char *dataname, int dim, │ │ │ │ │ +std::ofstream &fos) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:176 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_P_o_i_n_t_D_a_t_a │ │ │ │ │ +void writePointData(const std::vector< T > &data, const char *dataname, int │ │ │ │ │ +dim, std::ofstream &fos) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:190 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_S_u_r_f_a_c_e_V_e_r_t_e_x_D_a_t_a │ │ │ │ │ +void writeSurfaceVertexData(const std::vector< K > &coords, const std::vector< │ │ │ │ │ +unsigned int > &indices, int corners, const std::vector< T > &data, const char │ │ │ │ │ +*dataname, int dim) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:94 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_s_e_t_F_i_l_e_n_a_m_e │ │ │ │ │ +void setFilename(const char *name) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:45 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_S_u_r_f_a_c_e_E_l_e_m_e_n_t_D_a_t_a │ │ │ │ │ +void writeSurfaceElementData(const std::vector< K > &coords, const std::vector< │ │ │ │ │ +unsigned int > &indices, int corners, const std::vector< T > &data, const char │ │ │ │ │ +*dataname, int dim) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:73 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_~_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ +~VtkSurfaceWriter() │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:42 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ +VtkSurfaceWriter(const char *filename) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:39 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_S_u_r_f_a_c_e │ │ │ │ │ +void writeSurface(const std::vector< K > &coords, const std::vector< unsigned │ │ │ │ │ +int > &indices, int corners, int dim) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:53 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_P_o_i_n_t_s │ │ │ │ │ +void writePoints(const std::vector< K > &coords, int dim, std::ofstream &fos) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:116 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_P_o_l_y_g_o_n_s │ │ │ │ │ +void writePolygons(const std::vector< unsigned int > &indices, const int │ │ │ │ │ +*corners, int ncorners, int dim, std::ofstream &fos) │ │ │ │ │ +DDeeffiinniittiioonn vtksurfacewriter.hh:129 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html │ │ │ │ @@ -84,15 +84,15 @@ │ │ │ │ More...

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

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html │ │ │ │ @@ -102,15 +102,15 @@ │ │ │ │
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>
│ │ │ │
│ │ │ │ @@ -444,15 +444,15 @@ │ │ │ │
384}
│ │ │ │
385
│ │ │ │
386} // namespace GridGlue
│ │ │ │
387
│ │ │ │
388} // namespace Dune
│ │ │ │
389
│ │ │ │
390#endif // DUNE_GRIDGLUE_EXTRACTORS_CODIM1EXTRACTOR_HH
│ │ │ │ - │ │ │ │ + │ │ │ │
extractor base class
│ │ │ │
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
│ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: vtksurfacewriter.hh File Reference │ │ │ │ +dune-grid-glue: codim0extractor.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,42 +72,42 @@ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ Namespaces
│ │ │ │ -
vtksurfacewriter.hh File Reference
│ │ │ │ +
codim0extractor.hh File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

helper class for graphical output of grids in generic representation │ │ │ │ +

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

│ │ │ │ -
#include <fstream>
│ │ │ │ -#include <iomanip>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <cstring>
│ │ │ │ -#include "../adapter/gridgluevtkwriter.hh"
│ │ │ │ +
#include <deque>
│ │ │ │ +#include <functional>
│ │ │ │ +#include <dune/common/deprecated.hh>
│ │ │ │ +#include <dune/grid/common/mcmgmapper.hh>
│ │ │ │ +#include "extractor.hh"
│ │ │ │
│ │ │ │

Go to the source code of this file.

│ │ │ │

│ │ │ │ Classes

class  Dune::GridGlue::Codim1Extractor< GV >
 
│ │ │ │ │ │ │ │ - │ │ │ │ + │ │ │ │ │ │ │ │

│ │ │ │ Classes

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

│ │ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │ │

Detailed Description

│ │ │ │ -

helper class for graphical output of grids in generic representation

│ │ │ │ +

Mesh grid extractor base class.

│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -2,27 +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 │ │ │ │ │ -vtksurfacewriter.hh File Reference │ │ │ │ │ -helper class for graphical output of grids in generic representation _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include "_._._/_a_d_a_p_t_e_r_/_g_r_i_d_g_l_u_e_v_t_k_w_r_i_t_e_r_._h_h" │ │ │ │ │ +codim0extractor.hh File Reference │ │ │ │ │ +Mesh grid extractor base class. _M_o_r_e_._._. │ │ │ │ │ +#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_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ +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 ********** │ │ │ │ │ -helper class for graphical output of grids in generic representation │ │ │ │ │ +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: vtksurfacewriter.hh Source File │ │ │ │ +dune-grid-glue: codim0extractor.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,258 +74,276 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
vtksurfacewriter.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: VtkSurfaceWriter.hh
│ │ │ │ +
6 * Filename: codim0extractor.hh
│ │ │ │
7 * Version: 1.0
│ │ │ │ -
8 * Created on: Jan 16, 2009
│ │ │ │ -
9 * Author: Gerrit Buse
│ │ │ │ +
8 * Created on: Jun 23, 2009
│ │ │ │ +
9 * Author: Oliver Sander, Christian Engwer
│ │ │ │
10 * ---------------------------------
│ │ │ │
11 * Project: dune-grid-glue
│ │ │ │ -
12 * Description: helper class for graphical output of grids in generic representation
│ │ │ │ +
12 * Description: base class for grid extractors extracting surface grids
│ │ │ │
13 *
│ │ │ │
14 */
│ │ │ │ -
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH
│ │ │ │ -
21#define DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH
│ │ │ │ +
20#ifndef DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │ +
21#define DUNE_GRIDGLUE_EXTRACTORS_CODIM0EXTRACTOR_HH
│ │ │ │
22
│ │ │ │ -
23#include <fstream>
│ │ │ │ -
24#include <iomanip>
│ │ │ │ -
25#include <vector>
│ │ │ │ -
26#include <cstring>
│ │ │ │ -
27
│ │ │ │ -
28#include "../adapter/gridgluevtkwriter.hh"
│ │ │ │ -
29
│ │ │ │ -
30namespace Dune {
│ │ │ │ -
31
│ │ │ │ -
32 namespace GridGlue {
│ │ │ │ -
33
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
35{
│ │ │ │ -
36public:
│ │ │ │ -
37
│ │ │ │ -
38
│ │ │ │ -
│ │ │ │ -
39 VtkSurfaceWriter(const char* filename) : filename_(filename)
│ │ │ │ -
40 {}
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
43 {}
│ │ │ │ -
│ │ │ │ -
44
│ │ │ │ -
│ │ │ │ -
45 void setFilename(const char* name)
│ │ │ │ -
46 {
│ │ │ │ -
47 if (std::strlen(name) > 0)
│ │ │ │ -
48 this->filename_ = name;
│ │ │ │ -
49 }
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ -
52 template<typename K>
│ │ │ │ -
│ │ │ │ -
53 void writeSurface(const std::vector<K>& coords, const std::vector<unsigned int>& indices, int corners, int dim)
│ │ │ │ -
54 {
│ │ │ │ -
55 std::ofstream fos;
│ │ │ │ -
56 char buffer[64];
│ │ │ │ -
57 sprintf(buffer, "%s.vtk", this->filename_);
│ │ │ │ -
58 fos.open(buffer);
│ │ │ │ -
59 fos << std::setprecision(8) << std::setw(1);
│ │ │ │ -
60 // write preamble
│ │ │ │ -
61 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << std::endl;
│ │ │ │ -
62 this->writePoints(coords, dim, fos);
│ │ │ │ -
63 const int polycount = indices.size()/corners;
│ │ │ │ -
64 int corner_count[polycount];
│ │ │ │ -
65 for (int i = 0; i < polycount; ++i)
│ │ │ │ -
66 corner_count[i] = corners;
│ │ │ │ -
67 this->writePolygons(indices, corner_count, polycount, dim, fos);
│ │ │ │ -
68 fos.close();
│ │ │ │ -
69 }
│ │ │ │ -
│ │ │ │ -
70
│ │ │ │ -
71
│ │ │ │ -
72 template<typename K, typename T>
│ │ │ │ -
│ │ │ │ -
73 void writeSurfaceElementData(const std::vector<K>& coords, const std::vector<unsigned int>& indices, int corners, const std::vector<T>& data, const char* dataname, int dim)
│ │ │ │ -
74 {
│ │ │ │ -
75 std::ofstream fos;
│ │ │ │ -
76 char buffer[64];
│ │ │ │ -
77 sprintf(buffer, "%s.vtk", this->filename_);
│ │ │ │ -
78 fos.open(buffer);
│ │ │ │ -
79 fos << std::setprecision(8) << std::setw(1);
│ │ │ │ -
80 // write preamble
│ │ │ │ -
81 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << std::endl;
│ │ │ │ -
82 this->writePoints(coords, dim, fos);
│ │ │ │ -
83 const int polycount = indices.size()/corners;
│ │ │ │ -
84 int corner_count[polycount];
│ │ │ │ -
85 for (int i = 0; i < polycount; ++i)
│ │ │ │ -
86 corner_count[i] = corners;
│ │ │ │ -
87 this->writePolygons(indices, corner_count, polycount, dim, fos);
│ │ │ │ -
88 this->writeCellData(data, dataname, dim, fos);
│ │ │ │ -
89 fos.close();
│ │ │ │ -
90 }
│ │ │ │ -
│ │ │ │ +
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};
│ │ │ │ +
│ │ │ │ +
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
│ │ │ │ -
93 template<typename K, typename T>
│ │ │ │ -
│ │ │ │ -
94 void writeSurfaceVertexData(const std::vector<K>& coords, const std::vector<unsigned int>& indices, int corners, const std::vector<T>& data, const char* dataname, int dim)
│ │ │ │ -
95 {
│ │ │ │ -
96 std::ofstream fos;
│ │ │ │ -
97 char buffer[64];
│ │ │ │ -
98 sprintf(buffer, "%s.vtk", this->filename_);
│ │ │ │ -
99 fos.open(buffer);
│ │ │ │ -
100 fos << std::setprecision(8) << std::setw(1);
│ │ │ │ -
101 // write preamble
│ │ │ │ -
102 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << std::endl;
│ │ │ │ -
103 this->writePoints(coords, dim, fos);
│ │ │ │ -
104 const int polycount = indices.size()/corners;
│ │ │ │ -
105 int corner_count[polycount];
│ │ │ │ -
106 for (int i = 0; i < polycount; ++i)
│ │ │ │ -
107 corner_count[i] = corners;
│ │ │ │ -
108 this->writePolygons(indices, corner_count, polycount, dim, fos);
│ │ │ │ -
109 this->writePointData(data, dataname, dim, fos);
│ │ │ │ -
110 fos.close();
│ │ │ │ -
111 }
│ │ │ │ -
│ │ │ │ -
112
│ │ │ │ -
113protected:
│ │ │ │ -
114
│ │ │ │ -
115 template<typename K>
│ │ │ │ -
│ │ │ │ -
116 void writePoints(const std::vector<K>& coords, int dim, std::ofstream& fos)
│ │ │ │ -
117 {
│ │ │ │ -
118 fos << "DATASET POLYDATA\nPOINTS " << coords.size() << " " << TypeNames[Nametraits<K>::nameidx] << std::endl;
│ │ │ │ -
119 for (unsigned int i = 0; i < coords.size(); ++i)
│ │ │ │ -
120 {
│ │ │ │ -
121 fos << coords[i][0];
│ │ │ │ -
122 if (dim == 2)
│ │ │ │ -
123 fos << " " << coords[i][1] << " 0 \n" << coords[i][0] << " " << coords[i][1] << " 0.01" << std::endl;
│ │ │ │ -
124 else // dim == 3
│ │ │ │ -
125 fos << " " << coords[i][1] << " " << coords[i][2] << std::endl;
│ │ │ │ -
126 }
│ │ │ │ -
127 }
│ │ │ │ -
│ │ │ │ +
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
│ │ │ │ +
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
│ │ │ │ +
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 void writePolygons(const std::vector<unsigned int>& indices, const int* corners, int ncorners, int dim, std::ofstream& fos)
│ │ │ │ -
130 {
│ │ │ │ -
131 if (dim == 2)
│ │ │ │ -
132 {
│ │ │ │ -
133 fos << "POLYGONS " << indices.size()/2 << " " << 5*(indices.size() / 2) << std::endl;
│ │ │ │ -
134 for (unsigned int i = 0; i < indices.size(); i += 2)
│ │ │ │ -
135 fos << "4 " << 2*indices[i] << " " << 2*indices[i+1] << " " << 2*indices[i+1]+1 << " "<< 2*indices[i]+1 << std::endl;
│ │ │ │ -
136
│ │ │ │ -
137 // arbitrary shapes - ignored here!
│ │ │ │ -
138 // int sum = ncorners;
│ │ │ │ -
139 // for (int i = 0; i < ncorners; ++i)
│ │ │ │ -
140 // sum += (corners[i] > 2 ? corners[i] : 3);
│ │ │ │ -
141 //
│ │ │ │ -
142 // fos << "POLYGONS " << ncorners << " " << sum << std::endl;
│ │ │ │ -
143 // int index = 0;
│ │ │ │ -
144 // for (int i = 0; i < ncorners; ++i)
│ │ │ │ -
145 // {
│ │ │ │ -
146 // // write the first index twice if it is an egde
│ │ │ │ -
147 // // => triangle instead of edge - paraview can display it then
│ │ │ │ -
148 // if (corners[i] > 2)
│ │ │ │ -
149 // fos << corners[i];
│ │ │ │ -
150 // else
│ │ │ │ -
151 // fos << "3 " << indices[index];
│ │ │ │ -
152 //
│ │ │ │ -
153 // for (int j = 0; j < corners[i]; ++j)
│ │ │ │ -
154 // fos << " " << indices[index++];
│ │ │ │ -
155 // fos << std::endl;
│ │ │ │ -
156 // }
│ │ │ │ -
157 }
│ │ │ │ -
158 else
│ │ │ │ -
159 {
│ │ │ │ -
160 int sum = ncorners;
│ │ │ │ -
161 for (int i = 0; i < ncorners; ++i)
│ │ │ │ -
162 sum += corners[i];
│ │ │ │ -
163 fos << "POLYGONS " << ncorners << " " << sum << std::endl;
│ │ │ │ -
164 int index = 0;
│ │ │ │ -
165 for (int i = 0; i < ncorners; ++i)
│ │ │ │ -
166 {
│ │ │ │ -
167 fos << corners[i];
│ │ │ │ -
168 for (int j = 0; j < corners[i]; ++j)
│ │ │ │ -
169 fos << " " << indices[index++];
│ │ │ │ -
170 fos << std::endl;
│ │ │ │ -
171 }
│ │ │ │ -
172 }
│ │ │ │ -
173 }
│ │ │ │ -
│ │ │ │ -
174
│ │ │ │ -
175 template<typename T>
│ │ │ │ -
│ │ │ │ -
176 void writeCellData(const std::vector<T>& data, const char* dataname, int dim, std::ofstream& fos)
│ │ │ │ -
177 {
│ │ │ │ -
178 fos << "CELL_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl;
│ │ │ │ -
179 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits<T>::nameidx] << " 1" << std::endl;
│ │ │ │ -
180 fos << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ -
181 for (unsigned int i = 0; i < data.size(); ++i)
│ │ │ │ -
182 {
│ │ │ │ -
183 fos << data[i] << std::endl;
│ │ │ │ -
184 if (dim == 2)
│ │ │ │ -
185 fos << data[i] << std::endl;
│ │ │ │ -
186 }
│ │ │ │ -
187 }
│ │ │ │ -
│ │ │ │ -
188
│ │ │ │ -
189 template<typename T>
│ │ │ │ -
│ │ │ │ -
190 void writePointData(const std::vector<T>& data, const char* dataname, int dim, std::ofstream& fos)
│ │ │ │ -
191 {
│ │ │ │ -
192 fos << "POINT_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl;
│ │ │ │ -
193 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits<T>::nameidx] << " 1" << std::endl;
│ │ │ │ -
194 fos << "LOOKUP_TABLE default" << std::endl;
│ │ │ │ -
195 for (unsigned int i = 0; i < data.size(); ++i)
│ │ │ │ -
196 {
│ │ │ │ -
197 fos << data[i] << std::endl;
│ │ │ │ -
198 if (dim == 2)
│ │ │ │ -
199 fos << data[i] << std::endl;
│ │ │ │ -
200 }
│ │ │ │ -
201 }
│ │ │ │ -
│ │ │ │ -
202
│ │ │ │ -
203
│ │ │ │ -
204private:
│ │ │ │ -
205 const char* filename_;
│ │ │ │ -
206};
│ │ │ │ -
│ │ │ │ -
207
│ │ │ │ -
208} // namespace GridGlue
│ │ │ │ +
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} // namespace Dune
│ │ │ │ -
211
│ │ │ │ -
212#endif // DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH
│ │ │ │ +
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 }
│ │ │ │ +
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 vtksurfacewriter.hh:35
│ │ │ │ -
void writeCellData(const std::vector< T > &data, const char *dataname, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:176
│ │ │ │ -
void writePointData(const std::vector< T > &data, const char *dataname, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:190
│ │ │ │ -
void writeSurfaceVertexData(const std::vector< K > &coords, const std::vector< unsigned int > &indices, int corners, const std::vector< T > &data, const char *dataname, int dim)
Definition vtksurfacewriter.hh:94
│ │ │ │ -
void setFilename(const char *name)
Definition vtksurfacewriter.hh:45
│ │ │ │ -
void writeSurfaceElementData(const std::vector< K > &coords, const std::vector< unsigned int > &indices, int corners, const std::vector< T > &data, const char *dataname, int dim)
Definition vtksurfacewriter.hh:73
│ │ │ │ -
~VtkSurfaceWriter()
Definition vtksurfacewriter.hh:42
│ │ │ │ -
VtkSurfaceWriter(const char *filename)
Definition vtksurfacewriter.hh:39
│ │ │ │ -
void writeSurface(const std::vector< K > &coords, const std::vector< unsigned int > &indices, int corners, int dim)
Definition vtksurfacewriter.hh:53
│ │ │ │ -
void writePoints(const std::vector< K > &coords, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:116
│ │ │ │ -
void writePolygons(const std::vector< unsigned int > &indices, const int *corners, int ncorners, int dim, std::ofstream &fos)
Definition vtksurfacewriter.hh:129
│ │ │ │ +
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
│ │ │ │ +
static constexpr auto dimworld
Definition extractor.hh:50
│ │ │ │ +
int IndexType
Definition extractor.hh:77
│ │ │ │ +
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
│ │ │ │ + │ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,280 +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 │ │ │ │ │ -vtksurfacewriter.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: VtkSurfaceWriter.hh │ │ │ │ │ +6 * Filename: codim0extractor.hh │ │ │ │ │ 7 * Version: 1.0 │ │ │ │ │ -8 * Created on: Jan 16, 2009 │ │ │ │ │ -9 * Author: Gerrit Buse │ │ │ │ │ +8 * Created on: Jun 23, 2009 │ │ │ │ │ +9 * Author: Oliver Sander, Christian Engwer │ │ │ │ │ 10 * --------------------------------- │ │ │ │ │ 11 * Project: dune-grid-glue │ │ │ │ │ -12 * Description: helper class for graphical output of grids in generic │ │ │ │ │ -representation │ │ │ │ │ +12 * Description: base class for grid extractors extracting surface grids │ │ │ │ │ 13 * │ │ │ │ │ 14 */ │ │ │ │ │ -20#ifndef DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_HH │ │ │ │ │ -21#define DUNE_GRIDGLUE_EXTRACTORS_VTKSURFACEWRITER_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 │ │ │ │ │ -28#include "../adapter/gridgluevtkwriter.hh" │ │ │ │ │ -29 │ │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ │ -31 │ │ │ │ │ -32 namespace GridGlue { │ │ │ │ │ -33 │ │ │ │ │ -_3_4class _V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ -35{ │ │ │ │ │ -36public: │ │ │ │ │ -37 │ │ │ │ │ -38 │ │ │ │ │ -_3_9 _V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r(const char* filename) : filename_(filename) │ │ │ │ │ -40 {} │ │ │ │ │ +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 │ │ │ │ │ -_4_2 _~_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r() │ │ │ │ │ -43 {} │ │ │ │ │ -44 │ │ │ │ │ -_4_5 void _s_e_t_F_i_l_e_n_a_m_e(const char* name) │ │ │ │ │ -46 { │ │ │ │ │ -47 if (std::strlen(name) > 0) │ │ │ │ │ -48 this->filename_ = name; │ │ │ │ │ -49 } │ │ │ │ │ +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 │ │ │ │ │ -51 │ │ │ │ │ -52 template │ │ │ │ │ -_5_3 void _w_r_i_t_e_S_u_r_f_a_c_e(const std::vector& coords, const std::vector& indices, int corners, int dim) │ │ │ │ │ -54 { │ │ │ │ │ -55 std::ofstream fos; │ │ │ │ │ -56 char buffer[64]; │ │ │ │ │ -57 sprintf(buffer, "%s.vtk", this->filename_); │ │ │ │ │ -58 fos.open(buffer); │ │ │ │ │ -59 fos << std::setprecision(8) << std::setw(1); │ │ │ │ │ -60 // write preamble │ │ │ │ │ -61 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << │ │ │ │ │ -std::endl; │ │ │ │ │ -62 this->_w_r_i_t_e_P_o_i_n_t_s(coords, dim, fos); │ │ │ │ │ -63 const int polycount = indices.size()/corners; │ │ │ │ │ -64 int corner_count[polycount]; │ │ │ │ │ -65 for (int i = 0; i < polycount; ++i) │ │ │ │ │ -66 corner_count[i] = corners; │ │ │ │ │ -67 this->_w_r_i_t_e_P_o_l_y_g_o_n_s(indices, corner_count, polycount, dim, fos); │ │ │ │ │ -68 fos.close(); │ │ │ │ │ -69 } │ │ │ │ │ -70 │ │ │ │ │ -71 │ │ │ │ │ -72 template │ │ │ │ │ -_7_3 void _w_r_i_t_e_S_u_r_f_a_c_e_E_l_e_m_e_n_t_D_a_t_a(const std::vector& coords, const std:: │ │ │ │ │ -vector& indices, int corners, const std::vector& data, const │ │ │ │ │ -char* dataname, int dim) │ │ │ │ │ -74 { │ │ │ │ │ -75 std::ofstream fos; │ │ │ │ │ -76 char buffer[64]; │ │ │ │ │ -77 sprintf(buffer, "%s.vtk", this->filename_); │ │ │ │ │ -78 fos.open(buffer); │ │ │ │ │ -79 fos << std::setprecision(8) << std::setw(1); │ │ │ │ │ -80 // write preamble │ │ │ │ │ -81 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << │ │ │ │ │ -std::endl; │ │ │ │ │ -82 this->_w_r_i_t_e_P_o_i_n_t_s(coords, dim, fos); │ │ │ │ │ -83 const int polycount = indices.size()/corners; │ │ │ │ │ -84 int corner_count[polycount]; │ │ │ │ │ -85 for (int i = 0; i < polycount; ++i) │ │ │ │ │ -86 corner_count[i] = corners; │ │ │ │ │ -87 this->_w_r_i_t_e_P_o_l_y_g_o_n_s(indices, corner_count, polycount, dim, fos); │ │ │ │ │ -88 this->_w_r_i_t_e_C_e_l_l_D_a_t_a(data, dataname, dim, fos); │ │ │ │ │ -89 fos.close(); │ │ │ │ │ -90 } │ │ │ │ │ +_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 │ │ │ │ │ +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 │ │ │ │ │ -93 template │ │ │ │ │ -_9_4 void _w_r_i_t_e_S_u_r_f_a_c_e_V_e_r_t_e_x_D_a_t_a(const std::vector& coords, const std:: │ │ │ │ │ -vector& indices, int corners, const std::vector& data, const │ │ │ │ │ -char* dataname, int dim) │ │ │ │ │ -95 { │ │ │ │ │ -96 std::ofstream fos; │ │ │ │ │ -97 char buffer[64]; │ │ │ │ │ -98 sprintf(buffer, "%s.vtk", this->filename_); │ │ │ │ │ -99 fos.open(buffer); │ │ │ │ │ -100 fos << std::setprecision(8) << std::setw(1); │ │ │ │ │ -101 // write preamble │ │ │ │ │ -102 fos << "# vtk DataFile Version 2.0\nFilename: " << buffer << "\nASCII" << │ │ │ │ │ -std::endl; │ │ │ │ │ -103 this->_w_r_i_t_e_P_o_i_n_t_s(coords, dim, fos); │ │ │ │ │ -104 const int polycount = indices.size()/corners; │ │ │ │ │ -105 int corner_count[polycount]; │ │ │ │ │ -106 for (int i = 0; i < polycount; ++i) │ │ │ │ │ -107 corner_count[i] = corners; │ │ │ │ │ -108 this->_w_r_i_t_e_P_o_l_y_g_o_n_s(indices, corner_count, polycount, dim, fos); │ │ │ │ │ -109 this->_w_r_i_t_e_P_o_i_n_t_D_a_t_a(data, dataname, dim, fos); │ │ │ │ │ -110 fos.close(); │ │ │ │ │ -111 } │ │ │ │ │ -112 │ │ │ │ │ -113protected: │ │ │ │ │ -114 │ │ │ │ │ -115 template │ │ │ │ │ -_1_1_6 void _w_r_i_t_e_P_o_i_n_t_s(const std::vector& coords, int dim, std::ofstream& fos) │ │ │ │ │ -117 { │ │ │ │ │ -118 fos << "DATASET POLYDATA\nPOINTS " << coords.size() << " " << TypeNames │ │ │ │ │ -[Nametraits::nameidx] << std::endl; │ │ │ │ │ -119 for (unsigned int i = 0; i < coords.size(); ++i) │ │ │ │ │ -120 { │ │ │ │ │ -121 fos << coords[i][0]; │ │ │ │ │ -122 if (dim == 2) │ │ │ │ │ -123 fos << " " << coords[i][1] << " 0 \n" << coords[i][0] << " " << coords[i] │ │ │ │ │ -[1] << " 0.01" << std::endl; │ │ │ │ │ -124 else // dim == 3 │ │ │ │ │ -125 fos << " " << coords[i][1] << " " << coords[i][2] << std::endl; │ │ │ │ │ -126 } │ │ │ │ │ -127 } │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ +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 │ │ │ │ │ -_1_2_9 void _w_r_i_t_e_P_o_l_y_g_o_n_s(const std::vector& indices, const int* │ │ │ │ │ -corners, int ncorners, int dim, std::ofstream& fos) │ │ │ │ │ -130 { │ │ │ │ │ -131 if (dim == 2) │ │ │ │ │ -132 { │ │ │ │ │ -133 fos << "POLYGONS " << indices.size()/2 << " " << 5*(indices.size() / 2) << │ │ │ │ │ -std::endl; │ │ │ │ │ -134 for (unsigned int i = 0; i < indices.size(); i += 2) │ │ │ │ │ -135 fos << "4 " << 2*indices[i] << " " << 2*indices[i+1] << " " << 2*indices │ │ │ │ │ -[i+1]+1 << " "<< 2*indices[i]+1 << std::endl; │ │ │ │ │ -136 │ │ │ │ │ -137 // arbitrary shapes - ignored here! │ │ │ │ │ -138 // int sum = ncorners; │ │ │ │ │ -139 // for (int i = 0; i < ncorners; ++i) │ │ │ │ │ -140 // sum += (corners[i] > 2 ? corners[i] : 3); │ │ │ │ │ -141 // │ │ │ │ │ -142 // fos << "POLYGONS " << ncorners << " " << sum << std::endl; │ │ │ │ │ -143 // int index = 0; │ │ │ │ │ -144 // for (int i = 0; i < ncorners; ++i) │ │ │ │ │ -145 // { │ │ │ │ │ -146 // // write the first index twice if it is an egde │ │ │ │ │ -147 // // => triangle instead of edge - paraview can display it then │ │ │ │ │ -148 // if (corners[i] > 2) │ │ │ │ │ -149 // fos << corners[i]; │ │ │ │ │ -150 // else │ │ │ │ │ -151 // fos << "3 " << indices[index]; │ │ │ │ │ -152 // │ │ │ │ │ -153 // for (int j = 0; j < corners[i]; ++j) │ │ │ │ │ -154 // fos << " " << indices[index++]; │ │ │ │ │ -155 // fos << std::endl; │ │ │ │ │ -156 // } │ │ │ │ │ -157 } │ │ │ │ │ -158 else │ │ │ │ │ -159 { │ │ │ │ │ -160 int sum = ncorners; │ │ │ │ │ -161 for (int i = 0; i < ncorners; ++i) │ │ │ │ │ -162 sum += corners[i]; │ │ │ │ │ -163 fos << "POLYGONS " << ncorners << " " << sum << std::endl; │ │ │ │ │ -164 int index = 0; │ │ │ │ │ -165 for (int i = 0; i < ncorners; ++i) │ │ │ │ │ -166 { │ │ │ │ │ -167 fos << corners[i]; │ │ │ │ │ -168 for (int j = 0; j < corners[i]; ++j) │ │ │ │ │ -169 fos << " " << indices[index++]; │ │ │ │ │ -170 fos << std::endl; │ │ │ │ │ -171 } │ │ │ │ │ -172 } │ │ │ │ │ -173 } │ │ │ │ │ -174 │ │ │ │ │ -175 template │ │ │ │ │ -_1_7_6 void _w_r_i_t_e_C_e_l_l_D_a_t_a(const std::vector& data, const char* dataname, int │ │ │ │ │ -dim, std::ofstream& fos) │ │ │ │ │ -177 { │ │ │ │ │ -178 fos << "CELL_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl; │ │ │ │ │ -179 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits::nameidx] │ │ │ │ │ -<< " 1" << std::endl; │ │ │ │ │ -180 fos << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ -181 for (unsigned int i = 0; i < data.size(); ++i) │ │ │ │ │ +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 │ │ │ │ │ +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 fos << data[i] << std::endl; │ │ │ │ │ -184 if (dim == 2) │ │ │ │ │ -185 fos << data[i] << std::endl; │ │ │ │ │ -186 } │ │ │ │ │ -187 } │ │ │ │ │ -188 │ │ │ │ │ -189 template │ │ │ │ │ -_1_9_0 void _w_r_i_t_e_P_o_i_n_t_D_a_t_a(const std::vector& data, const char* dataname, int │ │ │ │ │ -dim, std::ofstream& fos) │ │ │ │ │ -191 { │ │ │ │ │ -192 fos << "POINT_DATA " << data.size()*(dim == 2 ? 2 : 1) << std::endl; │ │ │ │ │ -193 fos << "SCALARS " << dataname << " " << TypeNames[Nametraits::nameidx] │ │ │ │ │ -<< " 1" << std::endl; │ │ │ │ │ -194 fos << "LOOKUP_TABLE default" << std::endl; │ │ │ │ │ -195 for (unsigned int i = 0; i < data.size(); ++i) │ │ │ │ │ -196 { │ │ │ │ │ -197 fos << data[i] << std::endl; │ │ │ │ │ -198 if (dim == 2) │ │ │ │ │ -199 fos << data[i] << std::endl; │ │ │ │ │ -200 } │ │ │ │ │ -201 } │ │ │ │ │ -202 │ │ │ │ │ -203 │ │ │ │ │ -204private: │ │ │ │ │ -205 const char* filename_; │ │ │ │ │ -206}; │ │ │ │ │ -207 │ │ │ │ │ -208} // namespace GridGlue │ │ │ │ │ +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 │ │ │ │ │ +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_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:35 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_C_e_l_l_D_a_t_a │ │ │ │ │ -void writeCellData(const std::vector< T > &data, const char *dataname, int dim, │ │ │ │ │ -std::ofstream &fos) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:176 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_P_o_i_n_t_D_a_t_a │ │ │ │ │ -void writePointData(const std::vector< T > &data, const char *dataname, int │ │ │ │ │ -dim, std::ofstream &fos) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:190 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_S_u_r_f_a_c_e_V_e_r_t_e_x_D_a_t_a │ │ │ │ │ -void writeSurfaceVertexData(const std::vector< K > &coords, const std::vector< │ │ │ │ │ -unsigned int > &indices, int corners, const std::vector< T > &data, const char │ │ │ │ │ -*dataname, int dim) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:94 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_s_e_t_F_i_l_e_n_a_m_e │ │ │ │ │ -void setFilename(const char *name) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:45 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_S_u_r_f_a_c_e_E_l_e_m_e_n_t_D_a_t_a │ │ │ │ │ -void writeSurfaceElementData(const std::vector< K > &coords, const std::vector< │ │ │ │ │ -unsigned int > &indices, int corners, const std::vector< T > &data, const char │ │ │ │ │ -*dataname, int dim) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:73 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_~_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ -~VtkSurfaceWriter() │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:42 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r │ │ │ │ │ -VtkSurfaceWriter(const char *filename) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:39 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_S_u_r_f_a_c_e │ │ │ │ │ -void writeSurface(const std::vector< K > &coords, const std::vector< unsigned │ │ │ │ │ -int > &indices, int corners, int dim) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:53 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_P_o_i_n_t_s │ │ │ │ │ -void writePoints(const std::vector< K > &coords, int dim, std::ofstream &fos) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:116 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_V_t_k_S_u_r_f_a_c_e_W_r_i_t_e_r_:_:_w_r_i_t_e_P_o_l_y_g_o_n_s │ │ │ │ │ -void writePolygons(const std::vector< unsigned int > &indices, const int │ │ │ │ │ -*corners, int ncorners, int dim, std::ofstream &fos) │ │ │ │ │ -DDeeffiinniittiioonn vtksurfacewriter.hh:129 │ │ │ │ │ +_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_<_ _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_:_:_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_,_ _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_:_:_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_:_:_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_<_ _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_:_:_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_:_:_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_:_:_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_:_:_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: conformingmerge.hh File Reference │ │ │ │ +dune-grid-glue: computeintersection.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,48 +70,28 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ Namespaces
│ │ │ │ -
conformingmerge.hh File Reference
│ │ │ │ +
computeintersection.cc File Reference
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ -

Implementation of the Merger concept for conforming interfaces. │ │ │ │ -More...

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

Go to the source code of this file.

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

│ │ │ │ -Classes

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

│ │ │ │ Namespaces

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

Detailed Description

│ │ │ │ -

Implementation of the Merger concept for conforming interfaces.

│ │ │ │ -
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,32 +1,17 @@ │ │ │ │ │ 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 │ │ │ │ │ -conformingmerge.hh File Reference │ │ │ │ │ -Implementation of the Merger concept for conforming interfaces. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h> │ │ │ │ │ +_N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +computeintersection.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_:_:_C_o_n_f_o_r_m_i_n_g_M_e_r_g_e_<_ _d_i_m_,_ _d_i_m_w_o_r_l_d_,_ _T_ _> │ │ │ │ │ -  Implementation of the _M_e_r_g_e_r concept for conforming interfaces. _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 ********** │ │ │ │ │ -Implementation of the Merger concept for conforming interfaces. │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: conformingmerge.hh Source File │ │ │ │ +dune-grid-glue: computeintersection.cc Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,220 +74,356 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │ -
conformingmerge.hh
│ │ │ │ +
computeintersection.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/*
│ │ │ │ -
6 * Filename: conformingmerge.hh
│ │ │ │ -
7 * Version: 1.0
│ │ │ │ -
8 * Created on: Sep 14, 2009
│ │ │ │ -
9 * Author: Oliver Sander
│ │ │ │ -
10 * ---------------------------------
│ │ │ │ -
11 * Project: dune-grid-glue
│ │ │ │ -
12 * Description: implementation of the Merger concept for conforming interfaces
│ │ │ │ -
13 *
│ │ │ │ -
14 */
│ │ │ │ -
21#ifndef DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
│ │ │ │ -
22#define DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
│ │ │ │ -
23
│ │ │ │ -
24#include <iomanip>
│ │ │ │ -
25#include <vector>
│ │ │ │ -
26#include <algorithm>
│ │ │ │ -
27#include <bitset>
│ │ │ │ -
28
│ │ │ │ -
29#include <dune/common/fmatrix.hh>
│ │ │ │ -
30#include <dune/common/fvector.hh>
│ │ │ │ -
31
│ │ │ │ -
32#include <dune/geometry/referenceelements.hh>
│ │ │ │ -
33
│ │ │ │ - │ │ │ │ -
35
│ │ │ │ -
36namespace Dune {
│ │ │ │ -
37
│ │ │ │ -
38 namespace GridGlue {
│ │ │ │ -
39
│ │ │ │ -
46template<int dim, int dimworld, typename T = double>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
48 : public StandardMerge<T,dim,dim,dimworld>
│ │ │ │ -
49{
│ │ │ │ -
50
│ │ │ │ -
51public:
│ │ │ │ -
52
│ │ │ │ -
53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
│ │ │ │ -
54
│ │ │ │ -
56 typedef T ctype;
│ │ │ │ -
57
│ │ │ │ -
59 typedef Dune::FieldVector<T, dimworld> WorldCoords;
│ │ │ │ -
60
│ │ │ │ -
62 typedef Dune::FieldVector<T, dim> LocalCoords;
│ │ │ │ -
63
│ │ │ │ -
64private:
│ │ │ │ +
5
│ │ │ │ +
6namespace Dune {
│ │ │ │ +
7namespace GridGlue {
│ │ │ │ +
8
│ │ │ │ +
9//****************************************************************************************
│ │ │ │ +
10// PUBLIC
│ │ │ │ +
11//****************************************************************************************
│ │ │ │ +
12
│ │ │ │ +
13template<class CM>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
15 const std::vector<V>& Y,
│ │ │ │ +
16 std::vector<std::vector<int> >& SX,
│ │ │ │ +
17 std::vector<std::vector<int> >& SY,
│ │ │ │ +
18 std::vector<V>& P) {
│ │ │ │ +
19
│ │ │ │ +
20 std::vector<std::vector<unsigned int> > subElementsX, subElementsY;
│ │ │ │ +
21 std::vector<std::vector<int> > faceIdsX, faceIdsY;
│ │ │ │ +
22 std::vector<V> subElementX(CM::grid1Dimension+1), subElementY(CM::grid2Dimension+1), sP;
│ │ │ │ +
23 std::vector<std::vector<int> > sSX, sSY;
│ │ │ │ +
24
│ │ │ │ +
25 CM::grid1_subdivisions(X,subElementsX,faceIdsX);
│ │ │ │ +
26 CM::grid2_subdivisions(Y,subElementsY,faceIdsY);
│ │ │ │ +
27
│ │ │ │ +
28 bool intersectionFound = false;
│ │ │ │ +
29
│ │ │ │ +
30 for (unsigned int i = 0; i < subElementsX.size(); ++i) { // iterate over all X subelements
│ │ │ │ +
31 for (unsigned int ki = 0; ki < subElementsX[i].size(); ++ki) // define the X subelement
│ │ │ │ +
32 subElementX[ki] = X[subElementsX[i][ki]];
│ │ │ │ +
33 for (unsigned int j = 0; j < subElementsY.size(); ++j) { // iterate over all Y subelemetns
│ │ │ │ +
34 for (unsigned int kj = 0; kj < subElementsY[j].size(); ++kj) // define the Y subleement
│ │ │ │ +
35 subElementY[kj] = Y[subElementsY[j][kj]];
│ │ │ │ +
36
│ │ │ │ +
37 sP.clear();
│ │ │ │ +
38
│ │ │ │ +
39 // compute the intersection
│ │ │ │ +
40 bool b = CM::computeIntersectionPoints(subElementX,subElementY,sSX,sSY,sP);
│ │ │ │ +
41 intersectionFound = intersectionFound || b;
│ │ │ │ +
42
│ │ │ │ +
43 // only insert points on outer faces
│ │ │ │ +
44 for (unsigned int ki = 0; ki < sSX.size(); ++ki) { // iterate over all faces
│ │ │ │ +
45 if (faceIdsX[i][ki] >= 0) {
│ │ │ │ +
46 for (unsigned int kii = 0; kii < sSX[ki].size(); ++kii) {
│ │ │ │ +
47 int k = insertPoint(sP[sSX[ki][kii]],P); // determine index in P
│ │ │ │ +
48 SX[faceIdsX[i][ki]].push_back(k);
│ │ │ │ +
49 }
│ │ │ │ +
50 }
│ │ │ │ +
51 }
│ │ │ │ +
52 for (unsigned int kj = 0; kj < sSY.size(); ++kj) { // iterate over all faces
│ │ │ │ +
53 if (faceIdsY[j][kj] >= 0) {
│ │ │ │ +
54 for (unsigned int kjj = 0; kjj < sSY[kj].size(); ++kjj) {
│ │ │ │ +
55 int k = insertPoint(sP[sSY[kj][kjj]],P); // determine index in P
│ │ │ │ +
56 SY[faceIdsY[j][kj]].push_back(k);
│ │ │ │ +
57 }
│ │ │ │ +
58 }
│ │ │ │ +
59 }
│ │ │ │ +
60 }
│ │ │ │ +
61 }
│ │ │ │ +
62
│ │ │ │ +
63 return intersectionFound;
│ │ │ │ +
64}
│ │ │ │ +
│ │ │ │
65
│ │ │ │ -
66 /* M E M B E R V A R I A B L E S */
│ │ │ │ -
67
│ │ │ │ -
69 T tolerance_;
│ │ │ │ -
70
│ │ │ │ -
71 typedef typename StandardMerge<T,dim,dim,dimworld>::SimplicialIntersection SimplicialIntersection;
│ │ │ │ -
72
│ │ │ │ -
77 void computeIntersections(const Dune::GeometryType& grid1ElementType,
│ │ │ │ -
78 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
│ │ │ │ -
79 std::bitset<(1<<dim)>& neighborIntersects1,
│ │ │ │ -
80 unsigned int grid1Index,
│ │ │ │ -
81 const Dune::GeometryType& grid2ElementType,
│ │ │ │ -
82 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
│ │ │ │ -
83 std::bitset<(1<<dim)>& neighborIntersects2,
│ │ │ │ -
84 unsigned int grid2Index,
│ │ │ │ -
85 std::vector<SimplicialIntersection>& intersections);
│ │ │ │ +
66//****************************************************************************************
│ │ │ │ +
67// PRIVATE
│ │ │ │ +
68//****************************************************************************************
│ │ │ │ +
69
│ │ │ │ +
70template<class CM>
│ │ │ │ +
71void IntersectionComputation<CM>::orderPoints_(std::integral_constant<int,3>,
│ │ │ │ +
72 std::integral_constant<int,3>,
│ │ │ │ +
73 const V& centroid,
│ │ │ │ +
74 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
75 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
76 const std::vector<V>& P,
│ │ │ │ +
77 std::vector<std::vector<int> >& H)
│ │ │ │ +
78{
│ │ │ │ +
79 int n_facesX = SX.size();
│ │ │ │ +
80 int n_facesY = SY.size();
│ │ │ │ +
81 int m;
│ │ │ │ +
82
│ │ │ │ +
83 std::vector<int> no,id,temp ;
│ │ │ │ +
84 std::vector<V> p ;
│ │ │ │ +
85 std::vector<std::vector<int> > tempH;
│ │ │ │
86
│ │ │ │ -
87public:
│ │ │ │ -
88
│ │ │ │ -
89 static constexpr T default_tolerance = 1e-4;
│ │ │ │ -
90
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
92 tolerance_(tolerance)
│ │ │ │ -
93 {}
│ │ │ │ -
│ │ │ │ -
94};
│ │ │ │ -
│ │ │ │ -
95
│ │ │ │ -
96template<int dim, int dimworld, typename T>
│ │ │ │ - │ │ │ │ -
98
│ │ │ │ -
99template<int dim, int dimworld, typename T>
│ │ │ │ -
100void ConformingMerge<dim, dimworld, T>::computeIntersections(const Dune::GeometryType& grid1ElementType,
│ │ │ │ -
101 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
│ │ │ │ -
102 std::bitset<(1<<dim)>& neighborIntersects1,
│ │ │ │ -
103 unsigned int grid1Index,
│ │ │ │ -
104 const Dune::GeometryType& grid2ElementType,
│ │ │ │ -
105 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
│ │ │ │ -
106 std::bitset<(1<<dim)>& neighborIntersects2,
│ │ │ │ -
107 unsigned int grid2Index,
│ │ │ │ -
108 std::vector<SimplicialIntersection>& intersections)
│ │ │ │ -
109{
│ │ │ │ -
110 this->counter++;
│ │ │ │ -
111
│ │ │ │ -
112 // A few consistency checks
│ │ │ │ -
113 assert((unsigned int)(Dune::ReferenceElements<T,dim>::general(grid1ElementType).size(dim)) == grid1ElementCorners.size());
│ │ │ │ -
114 assert((unsigned int)(Dune::ReferenceElements<T,dim>::general(grid2ElementType).size(dim)) == grid2ElementCorners.size());
│ │ │ │ -
115 // any intersection we may find will be the entire elements.
│ │ │ │ -
116 neighborIntersects1.reset();
│ │ │ │ -
117 neighborIntersects2.reset();
│ │ │ │ -
118
│ │ │ │ -
119 // the intersection is either conforming or empty, hence the GeometryTypes have to match
│ │ │ │ -
120 if (grid1ElementType != grid2ElementType)
│ │ │ │ -
121 return;
│ │ │ │ -
122
│ │ │ │ -
123 // ////////////////////////////////////////////////////////////
│ │ │ │ -
124 // Find correspondences between the different corners
│ │ │ │ -
125 // ////////////////////////////////////////////////////////////
│ │ │ │ -
126 std::vector<int> other(grid1ElementCorners.size(), -1);
│ │ │ │ -
127
│ │ │ │ -
128 for (unsigned int i=0; i<grid1ElementCorners.size(); i++) {
│ │ │ │ -
129
│ │ │ │ -
130 for (unsigned int j=0; j<grid2ElementCorners.size(); j++) {
│ │ │ │ -
131
│ │ │ │ -
132 if ( (grid1ElementCorners[i]-grid2ElementCorners[j]).two_norm() < tolerance_ ) {
│ │ │ │ -
133
│ │ │ │ -
134 other[i] = j;
│ │ │ │ -
135 break;
│ │ │ │ -
136
│ │ │ │ -
137 }
│ │ │ │ -
138
│ │ │ │ -
139 }
│ │ │ │ -
140
│ │ │ │ -
141 // No corresponding grid2 vertex found for this grid1 vertex
│ │ │ │ -
142 if (other[i] == -1)
│ │ │ │ -
143 return;
│ │ │ │ -
144
│ │ │ │ -
145 }
│ │ │ │ -
146
│ │ │ │ -
147 // ////////////////////////////////////////////////////////////
│ │ │ │ -
148 // Set up the new remote intersection
│ │ │ │ -
149 // ////////////////////////////////////////////////////////////
│ │ │ │ -
150
│ │ │ │ -
151 const auto& refElement = Dune::ReferenceElements<T,dim>::general(grid1ElementType);
│ │ │ │ -
152
│ │ │ │ -
154 if (grid1ElementType.isSimplex()) {
│ │ │ │ -
155
│ │ │ │ -
156 intersections.emplace_back(grid1Index, grid2Index);
│ │ │ │ +
87 std::vector<int> faceOrderingX(n_facesX);
│ │ │ │ +
88 std::vector<int> faceOrderingY(n_facesY);
│ │ │ │ +
89
│ │ │ │ +
90 if (n_facesX==3) {
│ │ │ │ +
91 faceOrderingX[0] = 0; faceOrderingX[1] = 2; faceOrderingX[2] = 1;
│ │ │ │ +
92 } else {
│ │ │ │ +
93 faceOrderingX[0] = 0; faceOrderingX[1] = 3; faceOrderingX[2] = 2; faceOrderingX[3] = 1;
│ │ │ │ +
94 }
│ │ │ │ +
95 if (n_facesY==3) {
│ │ │ │ +
96 faceOrderingY[0] = 0; faceOrderingY[1] = 2; faceOrderingY[2] = 1;
│ │ │ │ +
97 } else {
│ │ │ │ +
98 faceOrderingY[0] = 0; faceOrderingY[1] = 3; faceOrderingY[2] = 2; faceOrderingY[3] = 1;
│ │ │ │ +
99 }
│ │ │ │ +
100
│ │ │ │ +
101 if (P.size() > 3) {
│ │ │ │ +
102 for (int i = 0; i < n_facesX; ++i) { // loop on faces of X
│ │ │ │ +
103 if (SX[i].size() > 0) {
│ │ │ │ +
104 no = SX[faceOrderingX[i]];
│ │ │ │ +
105 removeDuplicates(no);
│ │ │ │ +
106 m = no.size() ;
│ │ │ │ +
107 if ((m>=3) && newFace3D(no,tempH)) // don't compute degenerate polygons and check if face is new
│ │ │ │ +
108 {
│ │ │ │ +
109 for ( int l=0; l<m; ++l)
│ │ │ │ +
110 p.push_back(P[no[l]]);
│ │ │ │ +
111 orderPointsCC(std::integral_constant<int,3>(), centroid,id,p); // order points counter-clock-wise
│ │ │ │ +
112 for ( int l=0; l<m; ++l)
│ │ │ │ +
113 temp.push_back(no[id[l]]) ;
│ │ │ │ +
114 tempH.push_back(temp) ;
│ │ │ │ +
115 temp.clear();
│ │ │ │ +
116 p.clear();
│ │ │ │ +
117 id.clear(); // clean
│ │ │ │ +
118 }
│ │ │ │ +
119 no.clear() ; // clean
│ │ │ │ +
120 }
│ │ │ │ +
121 }
│ │ │ │ +
122 for (int i = 0; i < n_facesY; ++i) { // loop on faces of Y
│ │ │ │ +
123 if (SY[i].size() > 0) {
│ │ │ │ +
124 no = SY[faceOrderingY[i]];
│ │ │ │ +
125 removeDuplicates(no);
│ │ │ │ +
126 m = no.size() ;
│ │ │ │ +
127 if ((m>=3) && newFace3D(no,tempH)) // don't compute degenerate polygons and check if face is new
│ │ │ │ +
128 {
│ │ │ │ +
129 for ( int l=0; l<m; ++l)
│ │ │ │ +
130 p.push_back(P[no[l]]) ;
│ │ │ │ +
131 orderPointsCC(std::integral_constant<int,3>(),centroid,id,p); // order points counter-clock-wise
│ │ │ │ +
132 for ( int l=0; l<m; ++l)
│ │ │ │ +
133 temp.push_back(no[id[l]]) ;
│ │ │ │ +
134 tempH.push_back(temp) ;
│ │ │ │ +
135 temp.clear();
│ │ │ │ +
136 p.clear();
│ │ │ │ +
137 id.clear(); // clean
│ │ │ │ +
138 }
│ │ │ │ +
139 no.clear() ; // clean
│ │ │ │ +
140 }
│ │ │ │ +
141 }
│ │ │ │ +
142 }
│ │ │ │ +
143
│ │ │ │ +
144 for (int i = 0; i < tempH.size(); ++i) {
│ │ │ │ +
145 int hs = tempH[i].size();
│ │ │ │ +
146 if (hs >= 3) {
│ │ │ │ +
147 for (int j = 1; j <= hs-2;++j) {
│ │ │ │ +
148 temp.clear();
│ │ │ │ +
149 temp.push_back(tempH[i][0]);
│ │ │ │ +
150 for (int k = 0; k < 2; ++k)
│ │ │ │ +
151 temp.push_back(tempH[i][j+k]);
│ │ │ │ +
152 H.push_back(temp);
│ │ │ │ +
153 }
│ │ │ │ +
154 }
│ │ │ │ +
155 }
│ │ │ │ +
156}
│ │ │ │
157
│ │ │ │ -
158 for (int i=0; i<refElement.size(dim); i++) {
│ │ │ │ -
159 intersections.back().corners0[0][i] = refElement.position(i,dim);
│ │ │ │ -
160 intersections.back().corners1[0][i] = refElement.position(other[i],dim);
│ │ │ │ -
161 }
│ │ │ │ -
162
│ │ │ │ -
163 } else if (dim == 2 && grid1ElementType.isQuadrilateral()) {
│ │ │ │ -
164
│ │ │ │ -
165 // split the quadrilateral into two triangles
│ │ │ │ -
166 const unsigned int subVertices[2][3] = {{0,1,3}, {0,3,2}};
│ │ │ │ -
167
│ │ │ │ -
168 for (int i=0; i<2; i++) {
│ │ │ │ +
158template<class CM>
│ │ │ │ +
159void IntersectionComputation<CM>::orderPoints_(std::integral_constant<int,2>,
│ │ │ │ +
160 std::integral_constant<int,2>,
│ │ │ │ +
161 const V& centroid,
│ │ │ │ +
162 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
163 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
164 const std::vector<V>& P,
│ │ │ │ +
165 std::vector<std::vector<int> >& H)
│ │ │ │ +
166{
│ │ │ │ +
167 H.clear();
│ │ │ │ +
168 std::vector<int> id, temp(2);
│ │ │ │
169
│ │ │ │ -
170 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index);
│ │ │ │ +
170 orderPointsCC(std::integral_constant<int,2>(),centroid,id,P);
│ │ │ │
171
│ │ │ │ -
172 for (int j=0; j<dim+1; j++) {
│ │ │ │ -
173 newSimplicialIntersection.corners0[0][j] = refElement.position(subVertices[i][j],dim);
│ │ │ │ -
174 newSimplicialIntersection.corners1[0][j] = refElement.position(subVertices[i][other[j]],dim);
│ │ │ │ -
175 }
│ │ │ │ -
176
│ │ │ │ -
177 intersections.push_back(newSimplicialIntersection);
│ │ │ │ +
172 for (std::size_t i = 0; i < id.size();++i) {
│ │ │ │ +
173 temp[0] = id[i];
│ │ │ │ +
174 temp[1] = id[(i+1)%(id.size())];
│ │ │ │ +
175 H.push_back(temp);
│ │ │ │ +
176 }
│ │ │ │ +
177}
│ │ │ │
178
│ │ │ │ -
179 }
│ │ │ │ -
180
│ │ │ │ -
181 } else if (grid1ElementType.isHexahedron()) {
│ │ │ │ -
182
│ │ │ │ -
183 // split the hexahedron into five tetrahedra
│ │ │ │ -
184 // This can be removed if ever we allow Intersections that are not simplices
│ │ │ │ -
185 const unsigned int subVertices[5][4] = {{0,1,3,5}, {0,3,2,6}, {4,5,0,6}, {6,7,6,3}, {6,0,5,3}};
│ │ │ │ -
186
│ │ │ │ -
187 for (int i=0; i<5; i++) {
│ │ │ │ -
188
│ │ │ │ -
189 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index);
│ │ │ │ +
179template<class CM>
│ │ │ │ +
180void IntersectionComputation<CM>::orderPoints_(std::integral_constant<int,2>,
│ │ │ │ +
181 std::integral_constant<int,3>,
│ │ │ │ +
182 const V& centroid,
│ │ │ │ +
183 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
184 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
185 const std::vector<V>& P,
│ │ │ │ +
186 std::vector<std::vector<int> >& H)
│ │ │ │ +
187{
│ │ │ │ +
188 H.clear();
│ │ │ │ +
189 std::vector<int> id, temp(2);
│ │ │ │
190
│ │ │ │ -
191 for (int j=0; j<dim+1; j++) {
│ │ │ │ -
192 newSimplicialIntersection.corners0[0][j] = refElement.position(subVertices[i][j],dim);
│ │ │ │ -
193 newSimplicialIntersection.corners1[0][j] = refElement.position(subVertices[i][other[j]],dim);
│ │ │ │ -
194 }
│ │ │ │ -
195
│ │ │ │ -
196 intersections.push_back(newSimplicialIntersection);
│ │ │ │ -
197
│ │ │ │ -
198 }
│ │ │ │ +
191 orderPointsCC(std::integral_constant<int,3>(),centroid,id,P);
│ │ │ │ +
192
│ │ │ │ +
193 for (int i = 0; i < id.size();++i) {
│ │ │ │ +
194 temp[0] = id[i];
│ │ │ │ +
195 temp[1] = id[(i+1)%(id.size())];
│ │ │ │ +
196 H.push_back(temp);
│ │ │ │ +
197 }
│ │ │ │ +
198}
│ │ │ │
199
│ │ │ │ -
200 } else
│ │ │ │ -
201 DUNE_THROW(Dune::GridError, "Unsupported element type");
│ │ │ │ -
202
│ │ │ │ -
203}
│ │ │ │ -
204
│ │ │ │ -
205} // namespace GridGlue
│ │ │ │ -
206
│ │ │ │ -
207} // namespace Dune
│ │ │ │ -
208
│ │ │ │ -
209#endif // DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH
│ │ │ │ -
Common base class for many merger implementations: produce pairs of entities that may intersect.
│ │ │ │ +
200template<class CM>
│ │ │ │ +
201void IntersectionComputation<CM>::removeDuplicates(std::vector<int> & p)
│ │ │ │ +
202{
│ │ │ │ +
203 sort(p.begin(),p.end());
│ │ │ │ +
204 std::vector<int>::iterator it = std::unique(p.begin(),p.end());
│ │ │ │ +
205 p.erase(it,p.end());
│ │ │ │ +
206}
│ │ │ │ +
207
│ │ │ │ +
208template<class CM>
│ │ │ │ +
209bool IntersectionComputation<CM>::newFace3D(const std::vector<int>& id,
│ │ │ │ +
210 const std::vector<std::vector<int> >& H)
│ │ │ │ +
211{
│ │ │ │ +
212 // get size_type for all the vectors we are using
│ │ │ │ +
213 typedef typename std::vector<Empty>::size_type size_type;
│ │ │ │ +
214
│ │ │ │ +
215 int n = H.size() ;
│ │ │ │ +
216 int m = id.size() ;
│ │ │ │ +
217 std::vector<int> A ;
│ │ │ │ +
218 std::vector<int> B = id ;
│ │ │ │ +
219 sort(B.begin(),B.end()) ;
│ │ │ │ +
220 int i = 0 ;
│ │ │ │ +
221 bool b = true ;
│ │ │ │ +
222 double tp ;
│ │ │ │ +
223
│ │ │ │ +
224 while ( b && (i<n) )
│ │ │ │ +
225 {
│ │ │ │ +
226 if ((H[i].size())>=m)
│ │ │ │ +
227 {
│ │ │ │ +
228 A=H[i] ;
│ │ │ │ +
229 sort(A.begin(),A.end());
│ │ │ │ +
230 tp = 0 ;
│ │ │ │ +
231 for ( size_type j=0 ; j < m; j++)
│ │ │ │ +
232 tp += std::fabs(A[j]-B[j]) ;
│ │ │ │ +
233 b = (tp>0) ;
│ │ │ │ +
234 }
│ │ │ │ +
235
│ │ │ │ +
236 i += 1 ;
│ │ │ │ +
237 }
│ │ │ │ +
238
│ │ │ │ +
239 return b ;
│ │ │ │ +
240}
│ │ │ │ +
241
│ │ │ │ +
242
│ │ │ │ +
243template<class CM>
│ │ │ │ +
244void IntersectionComputation<CM>::orderPointsCC(std::integral_constant<int,3>,
│ │ │ │ +
245 const V& centroid,
│ │ │ │ +
246 std::vector<int>& id,
│ │ │ │ +
247 const std::vector<V>& P)
│ │ │ │ +
248{
│ │ │ │ +
249 typedef typename std::vector<Empty>::size_type size_type;
│ │ │ │ +
250
│ │ │ │ +
251 id.clear();
│ │ │ │ +
252
│ │ │ │ +
253 // get size_type for all the vectors we are using
│ │ │ │ +
254 V c,d1,d2,dr,dn,cross,d ;
│ │ │ │ +
255 std::vector<typename V::value_type> ai ;
│ │ │ │ +
256
│ │ │ │ +
257 d1 = P[1] - P[0] ; // two reference vectors
│ │ │ │ +
258 d2 = P[2] - P[0] ;
│ │ │ │ +
259
│ │ │ │ +
260 cross[0] = d1[1]*d2[2] - d1[2]*d2[1] ; // cross product
│ │ │ │ +
261 cross[1] = d1[2]*d2[0] - d1[0]*d2[2] ;
│ │ │ │ +
262 cross[2] = d1[0]*d2[1] - d1[1]*d2[0] ;
│ │ │ │ +
263
│ │ │ │ +
264 if (((centroid - P[0])*cross)<0) // good orientation ?
│ │ │ │ +
265 {
│ │ │ │ +
266 dr = d1 ;
│ │ │ │ +
267 dr /= dr.two_norm() ; // 'x-axis' unit vector
│ │ │ │ +
268 dn = dr ;
│ │ │ │ +
269 dn *= -(d2*dr) ;
│ │ │ │ +
270 dn += d2 ;
│ │ │ │ +
271 dn /= dn.two_norm() ; // 'y-axis' unit vector
│ │ │ │ +
272 }
│ │ │ │ +
273 else
│ │ │ │ +
274 {
│ │ │ │ +
275 dr = d2 ;
│ │ │ │ +
276 dr /= dr.two_norm() ; // 'y-axis' unit vector
│ │ │ │ +
277 dn = dr ;
│ │ │ │ +
278 dn *= -(d1*dr) ;
│ │ │ │ +
279 dn += d1 ;
│ │ │ │ +
280 dn /= dn.two_norm() ; // 'x-axis' unit vector
│ │ │ │ +
281 }
│ │ │ │ +
282
│ │ │ │ +
283 // definition of angles, using projection on the local reference, ie by scalarly multipliying by dr and dn resp.
│ │ │ │ +
284 for ( size_type j=1 ; j < P.size() ; j++)
│ │ │ │ +
285 {
│ │ │ │ +
286 ai.push_back(atan2((P[j]-P[0])*dn,(P[j]-P[0])*dr)) ;
│ │ │ │ +
287 id.push_back(j) ;
│ │ │ │ +
288 }
│ │ │ │ +
289
│ │ │ │ +
290 // sort according to increasing angles
│ │ │ │ +
291 for ( size_type j=1; j < ai.size(); j++) {
│ │ │ │ +
292 for ( size_type i=0; i < j; i++) {
│ │ │ │ +
293 if (ai[j]<ai[i]) {
│ │ │ │ +
294 std::swap<typename V::value_type>(ai[i],ai[j]) ;
│ │ │ │ +
295 std::swap<int>(id[i],id[j]) ;
│ │ │ │ +
296 }
│ │ │ │ +
297 }
│ │ │ │ +
298 }
│ │ │ │ +
299
│ │ │ │ +
300 id.insert(id.begin(),0);
│ │ │ │ +
301}
│ │ │ │ +
302
│ │ │ │ +
303template<class CM>
│ │ │ │ +
304void IntersectionComputation<CM>::orderPointsCC(std::integral_constant<int,2>,
│ │ │ │ +
305 const V& centroid,
│ │ │ │ +
306 std::vector<int>& id,
│ │ │ │ +
307 const std::vector<V>& P)
│ │ │ │ +
308{
│ │ │ │ +
309 typedef typename std::vector<Empty>::size_type size_type;
│ │ │ │ +
310
│ │ │ │ +
311 // get size_type for all the vectors we are using
│ │ │ │ +
312 typedef typename std::vector<Empty>::size_type size_type;
│ │ │ │ +
313
│ │ │ │ +
314 std::vector<typename V::value_type> ai(P.size());
│ │ │ │ +
315 id.resize(P.size());
│ │ │ │ +
316
│ │ │ │ +
317 // definition of angles
│ │ │ │ +
318 for ( size_type i=0; i < P.size(); i++) {
│ │ │ │ +
319 ai[i] = atan2(P[i][1]-centroid[1],P[i][0]-centroid[0]);
│ │ │ │ +
320 id[i] = i;
│ │ │ │ +
321 }
│ │ │ │ +
322
│ │ │ │ +
323 // sort according to increasing angles
│ │ │ │ +
324 for ( size_type j=1; j < ai.size(); j++) {
│ │ │ │ +
325 for ( size_type i=0; i < j; i++) if (ai[j]<ai[i]) {
│ │ │ │ +
326 std::swap<typename V::value_type>(ai[i],ai[j]);
│ │ │ │ +
327 std::swap<int>(id[i],id[j]);
│ │ │ │ +
328 }
│ │ │ │ +
329 }
│ │ │ │ +
330}
│ │ │ │ +
331
│ │ │ │ +
332} /* namespace Dune::GridGlue */
│ │ │ │ +
333} /* namespace Dune */
│ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
IteratorRange<... > intersections(const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
Iterate over all intersections of a GridGlue.
│ │ │ │ -
Implementation of the Merger concept for conforming interfaces.
Definition conformingmerge.hh:49
│ │ │ │ -
Dune::FieldVector< T, dim > LocalCoords
the coordinate type used in this interface
Definition conformingmerge.hh:62
│ │ │ │ -
Dune::FieldVector< T, dimworld > WorldCoords
the coordinate type used in this interface
Definition conformingmerge.hh:59
│ │ │ │ -
static constexpr T default_tolerance
Definition conformingmerge.hh:89
│ │ │ │ -
T ctype
the numeric type used in this interface
Definition conformingmerge.hh:56
│ │ │ │ -
ConformingMerge(T tolerance=default_tolerance)
Definition conformingmerge.hh:91
│ │ │ │ -
Common base class for many merger implementations: produce pairs of entities that may intersect.
Definition standardmerge.hh:58
│ │ │ │ -
typename IntersectionListProvider::SimplicialIntersection SimplicialIntersection
Definition standardmerge.hh:83
│ │ │ │ +
int insertPoint(const V p, std::vector< V > &P)
Definition computeintersection.hh:164
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,253 +1,382 @@ │ │ │ │ │ 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 │ │ │ │ │ -conformingmerge.hh │ │ │ │ │ +computeintersection.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/* │ │ │ │ │ -6 * Filename: conformingmerge.hh │ │ │ │ │ -7 * Version: 1.0 │ │ │ │ │ -8 * Created on: Sep 14, 2009 │ │ │ │ │ -9 * Author: Oliver Sander │ │ │ │ │ -10 * --------------------------------- │ │ │ │ │ -11 * Project: dune-grid-glue │ │ │ │ │ -12 * Description: implementation of the Merger concept for conforming │ │ │ │ │ -interfaces │ │ │ │ │ -13 * │ │ │ │ │ -14 */ │ │ │ │ │ -21#ifndef DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH │ │ │ │ │ -22#define DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH │ │ │ │ │ -23 │ │ │ │ │ -24#include │ │ │ │ │ -25#include │ │ │ │ │ -26#include │ │ │ │ │ -27#include │ │ │ │ │ -28 │ │ │ │ │ -29#include │ │ │ │ │ -30#include │ │ │ │ │ -31 │ │ │ │ │ -32#include │ │ │ │ │ -33 │ │ │ │ │ -34#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h> │ │ │ │ │ -35 │ │ │ │ │ -36namespace _D_u_n_e { │ │ │ │ │ -37 │ │ │ │ │ -38 namespace GridGlue { │ │ │ │ │ -39 │ │ │ │ │ -46template │ │ │ │ │ -_4_7class _C_o_n_f_o_r_m_i_n_g_M_e_r_g_e │ │ │ │ │ -48 : public _S_t_a_n_d_a_r_d_M_e_r_g_e │ │ │ │ │ -49{ │ │ │ │ │ -50 │ │ │ │ │ -51public: │ │ │ │ │ -52 │ │ │ │ │ -53 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */ │ │ │ │ │ -54 │ │ │ │ │ -_5_6 typedef T _c_t_y_p_e; │ │ │ │ │ -57 │ │ │ │ │ -_5_9 typedef Dune::FieldVector _W_o_r_l_d_C_o_o_r_d_s; │ │ │ │ │ -60 │ │ │ │ │ -_6_2 typedef Dune::FieldVector _L_o_c_a_l_C_o_o_r_d_s; │ │ │ │ │ -63 │ │ │ │ │ -64private: │ │ │ │ │ +5 │ │ │ │ │ +6namespace _D_u_n_e { │ │ │ │ │ +7namespace GridGlue { │ │ │ │ │ +8 │ │ │ │ │ +9// │ │ │ │ │ +**************************************************************************************** │ │ │ │ │ +10// PUBLIC │ │ │ │ │ +11// │ │ │ │ │ +**************************************************************************************** │ │ │ │ │ +12 │ │ │ │ │ +13template │ │ │ │ │ +_1_4bool _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(const std::vector& │ │ │ │ │ +X, │ │ │ │ │ +15 const std::vector& Y, │ │ │ │ │ +16 std::vector >& SX, │ │ │ │ │ +17 std::vector >& SY, │ │ │ │ │ +18 std::vector& P) { │ │ │ │ │ +19 │ │ │ │ │ +20 std::vector > subElementsX, subElementsY; │ │ │ │ │ +21 std::vector > faceIdsX, faceIdsY; │ │ │ │ │ +22 std::vector subElementX(CM::grid1Dimension+1), subElementY(CM:: │ │ │ │ │ +grid2Dimension+1), sP; │ │ │ │ │ +23 std::vector > sSX, sSY; │ │ │ │ │ +24 │ │ │ │ │ +25 CM::grid1_subdivisions(X,subElementsX,faceIdsX); │ │ │ │ │ +26 CM::grid2_subdivisions(Y,subElementsY,faceIdsY); │ │ │ │ │ +27 │ │ │ │ │ +28 bool intersectionFound = false; │ │ │ │ │ +29 │ │ │ │ │ +30 for (unsigned int i = 0; i < subElementsX.size(); ++i) { // iterate over all │ │ │ │ │ +X subelements │ │ │ │ │ +31 for (unsigned int ki = 0; ki < subElementsX[i].size(); ++ki) // define the X │ │ │ │ │ +subelement │ │ │ │ │ +32 subElementX[ki] = X[subElementsX[i][ki]]; │ │ │ │ │ +33 for (unsigned int j = 0; j < subElementsY.size(); ++j) { // iterate over all │ │ │ │ │ +Y subelemetns │ │ │ │ │ +34 for (unsigned int kj = 0; kj < subElementsY[j].size(); ++kj) // define the Y │ │ │ │ │ +subleement │ │ │ │ │ +35 subElementY[kj] = Y[subElementsY[j][kj]]; │ │ │ │ │ +36 │ │ │ │ │ +37 sP.clear(); │ │ │ │ │ +38 │ │ │ │ │ +39 // compute the intersection │ │ │ │ │ +40 bool b = CM::computeIntersectionPoints(subElementX,subElementY,sSX,sSY,sP); │ │ │ │ │ +41 intersectionFound = intersectionFound || b; │ │ │ │ │ +42 │ │ │ │ │ +43 // only insert points on outer faces │ │ │ │ │ +44 for (unsigned int ki = 0; ki < sSX.size(); ++ki) { // iterate over all faces │ │ │ │ │ +45 if (faceIdsX[i][ki] >= 0) { │ │ │ │ │ +46 for (unsigned int kii = 0; kii < sSX[ki].size(); ++kii) { │ │ │ │ │ +47 int k = _i_n_s_e_r_t_P_o_i_n_t(sP[sSX[ki][kii]],P); // determine index in P │ │ │ │ │ +48 SX[faceIdsX[i][ki]].push_back(k); │ │ │ │ │ +49 } │ │ │ │ │ +50 } │ │ │ │ │ +51 } │ │ │ │ │ +52 for (unsigned int kj = 0; kj < sSY.size(); ++kj) { // iterate over all faces │ │ │ │ │ +53 if (faceIdsY[j][kj] >= 0) { │ │ │ │ │ +54 for (unsigned int kjj = 0; kjj < sSY[kj].size(); ++kjj) { │ │ │ │ │ +55 int k = _i_n_s_e_r_t_P_o_i_n_t(sP[sSY[kj][kjj]],P); // determine index in P │ │ │ │ │ +56 SY[faceIdsY[j][kj]].push_back(k); │ │ │ │ │ +57 } │ │ │ │ │ +58 } │ │ │ │ │ +59 } │ │ │ │ │ +60 } │ │ │ │ │ +61 } │ │ │ │ │ +62 │ │ │ │ │ +63 return intersectionFound; │ │ │ │ │ +64} │ │ │ │ │ 65 │ │ │ │ │ -66 /* M E M B E R V A R I A B L E S */ │ │ │ │ │ -67 │ │ │ │ │ -69 T tolerance_; │ │ │ │ │ -70 │ │ │ │ │ -71 typedef typename _S_t_a_n_d_a_r_d_M_e_r_g_e_<_T_,_d_i_m_,_d_i_m_,_d_i_m_w_o_r_l_d_>_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -SimplicialIntersection; │ │ │ │ │ -72 │ │ │ │ │ -77 void computeIntersections(const Dune::GeometryType& grid1ElementType, │ │ │ │ │ -78 const std::vector >& grid1ElementCorners, │ │ │ │ │ -79 std::bitset<(1<& neighborIntersects1, │ │ │ │ │ -80 unsigned int grid1Index, │ │ │ │ │ -81 const Dune::GeometryType& grid2ElementType, │ │ │ │ │ -82 const std::vector >& grid2ElementCorners, │ │ │ │ │ -83 std::bitset<(1<& neighborIntersects2, │ │ │ │ │ -84 unsigned int grid2Index, │ │ │ │ │ -85 std::vector& intersections); │ │ │ │ │ +66// │ │ │ │ │ +**************************************************************************************** │ │ │ │ │ +67// PRIVATE │ │ │ │ │ +68// │ │ │ │ │ +**************************************************************************************** │ │ │ │ │ +69 │ │ │ │ │ +70template │ │ │ │ │ +71void _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_>_:_:_o_r_d_e_r_P_o_i_n_t_s__(std::integral_constant, │ │ │ │ │ +72 std::integral_constant, │ │ │ │ │ +73 const V& centroid, │ │ │ │ │ +74 const std::vector >& SX, │ │ │ │ │ +75 const std::vector >& SY, │ │ │ │ │ +76 const std::vector& P, │ │ │ │ │ +77 std::vector >& H) │ │ │ │ │ +78{ │ │ │ │ │ +79 int n_facesX = SX.size(); │ │ │ │ │ +80 int n_facesY = SY.size(); │ │ │ │ │ +81 int m; │ │ │ │ │ +82 │ │ │ │ │ +83 std::vector no,id,temp ; │ │ │ │ │ +84 std::vector p ; │ │ │ │ │ +85 std::vector > tempH; │ │ │ │ │ 86 │ │ │ │ │ -87public: │ │ │ │ │ -88 │ │ │ │ │ -_8_9 static constexpr T _d_e_f_a_u_l_t___t_o_l_e_r_a_n_c_e = 1e-4; │ │ │ │ │ -90 │ │ │ │ │ -_9_1 _C_o_n_f_o_r_m_i_n_g_M_e_r_g_e(T tolerance = _d_e_f_a_u_l_t___t_o_l_e_r_a_n_c_e) : │ │ │ │ │ -92 tolerance_(tolerance) │ │ │ │ │ -93 {} │ │ │ │ │ -94}; │ │ │ │ │ -95 │ │ │ │ │ -96template │ │ │ │ │ -97constexpr T _C_o_n_f_o_r_m_i_n_g_M_e_r_g_e_<_d_i_m_,_ _d_i_m_w_o_r_l_d_,_ _T_>_:_:_d_e_f_a_u_l_t___t_o_l_e_r_a_n_c_e; │ │ │ │ │ -98 │ │ │ │ │ -99template │ │ │ │ │ -100void ConformingMerge::computeIntersections(const Dune:: │ │ │ │ │ -GeometryType& grid1ElementType, │ │ │ │ │ -101 const std::vector >& grid1ElementCorners, │ │ │ │ │ -102 std::bitset<(1<& neighborIntersects1, │ │ │ │ │ -103 unsigned int grid1Index, │ │ │ │ │ -104 const Dune::GeometryType& grid2ElementType, │ │ │ │ │ -105 const std::vector >& grid2ElementCorners, │ │ │ │ │ -106 std::bitset<(1<& neighborIntersects2, │ │ │ │ │ -107 unsigned int grid2Index, │ │ │ │ │ -108 std::vector& _i_n_t_e_r_s_e_c_t_i_o_n_s) │ │ │ │ │ -109{ │ │ │ │ │ -110 this->counter++; │ │ │ │ │ -111 │ │ │ │ │ -112 // A few consistency checks │ │ │ │ │ -113 assert((unsigned int)(Dune::ReferenceElements::general │ │ │ │ │ -(grid1ElementType).size(dim)) == grid1ElementCorners.size()); │ │ │ │ │ -114 assert((unsigned int)(Dune::ReferenceElements::general │ │ │ │ │ -(grid2ElementType).size(dim)) == grid2ElementCorners.size()); │ │ │ │ │ -115 // any intersection we may find will be the entire elements. │ │ │ │ │ -116 neighborIntersects1.reset(); │ │ │ │ │ -117 neighborIntersects2.reset(); │ │ │ │ │ -118 │ │ │ │ │ -119 // the intersection is either conforming or empty, hence the GeometryTypes │ │ │ │ │ -have to match │ │ │ │ │ -120 if (grid1ElementType != grid2ElementType) │ │ │ │ │ -121 return; │ │ │ │ │ -122 │ │ │ │ │ -123 // //////////////////////////////////////////////////////////// │ │ │ │ │ -124 // Find correspondences between the different corners │ │ │ │ │ -125 // //////////////////////////////////////////////////////////// │ │ │ │ │ -126 std::vector other(grid1ElementCorners.size(), -1); │ │ │ │ │ -127 │ │ │ │ │ -128 for (unsigned int i=0; i::general │ │ │ │ │ -(grid1ElementType); │ │ │ │ │ -152 │ │ │ │ │ -154 if (grid1ElementType.isSimplex()) { │ │ │ │ │ -155 │ │ │ │ │ -156 _i_n_t_e_r_s_e_c_t_i_o_n_s.emplace_back(grid1Index, grid2Index); │ │ │ │ │ +87 std::vector faceOrderingX(n_facesX); │ │ │ │ │ +88 std::vector faceOrderingY(n_facesY); │ │ │ │ │ +89 │ │ │ │ │ +90 if (n_facesX==3) { │ │ │ │ │ +91 faceOrderingX[0] = 0; faceOrderingX[1] = 2; faceOrderingX[2] = 1; │ │ │ │ │ +92 } else { │ │ │ │ │ +93 faceOrderingX[0] = 0; faceOrderingX[1] = 3; faceOrderingX[2] = 2; │ │ │ │ │ +faceOrderingX[3] = 1; │ │ │ │ │ +94 } │ │ │ │ │ +95 if (n_facesY==3) { │ │ │ │ │ +96 faceOrderingY[0] = 0; faceOrderingY[1] = 2; faceOrderingY[2] = 1; │ │ │ │ │ +97 } else { │ │ │ │ │ +98 faceOrderingY[0] = 0; faceOrderingY[1] = 3; faceOrderingY[2] = 2; │ │ │ │ │ +faceOrderingY[3] = 1; │ │ │ │ │ +99 } │ │ │ │ │ +100 │ │ │ │ │ +101 if (P.size() > 3) { │ │ │ │ │ +102 for (int i = 0; i < n_facesX; ++i) { // loop on faces of X │ │ │ │ │ +103 if (SX[i].size() > 0) { │ │ │ │ │ +104 no = SX[faceOrderingX[i]]; │ │ │ │ │ +105 removeDuplicates(no); │ │ │ │ │ +106 m = no.size() ; │ │ │ │ │ +107 if ((m>=3) && newFace3D(no,tempH)) // don't compute degenerate polygons and │ │ │ │ │ +check if face is new │ │ │ │ │ +108 { │ │ │ │ │ +109 for ( int l=0; l(), centroid,id,p); // order │ │ │ │ │ +points counter-clock-wise │ │ │ │ │ +112 for ( int l=0; l 0) { │ │ │ │ │ +124 no = SY[faceOrderingY[i]]; │ │ │ │ │ +125 removeDuplicates(no); │ │ │ │ │ +126 m = no.size() ; │ │ │ │ │ +127 if ((m>=3) && newFace3D(no,tempH)) // don't compute degenerate polygons and │ │ │ │ │ +check if face is new │ │ │ │ │ +128 { │ │ │ │ │ +129 for ( int l=0; l(),centroid,id,p); // order │ │ │ │ │ +points counter-clock-wise │ │ │ │ │ +132 for ( int l=0; l= 3) { │ │ │ │ │ +147 for (int j = 1; j <= hs-2;++j) { │ │ │ │ │ +148 temp.clear(); │ │ │ │ │ +149 temp.push_back(tempH[i][0]); │ │ │ │ │ +150 for (int k = 0; k < 2; ++k) │ │ │ │ │ +151 temp.push_back(tempH[i][j+k]); │ │ │ │ │ +152 H.push_back(temp); │ │ │ │ │ +153 } │ │ │ │ │ +154 } │ │ │ │ │ +155 } │ │ │ │ │ +156} │ │ │ │ │ 157 │ │ │ │ │ -158 for (int i=0; i │ │ │ │ │ +159void IntersectionComputation::orderPoints_(std:: │ │ │ │ │ +integral_constant, │ │ │ │ │ +160 std::integral_constant, │ │ │ │ │ +161 const V& centroid, │ │ │ │ │ +162 const std::vector >& SX, │ │ │ │ │ +163 const std::vector >& SY, │ │ │ │ │ +164 const std::vector& P, │ │ │ │ │ +165 std::vector >& H) │ │ │ │ │ +166{ │ │ │ │ │ +167 H.clear(); │ │ │ │ │ +168 std::vector id, temp(2); │ │ │ │ │ 169 │ │ │ │ │ -170 SimplicialIntersection newSimplicialIntersection(grid1Index, grid2Index); │ │ │ │ │ +170 orderPointsCC(std::integral_constant(),centroid,id,P); │ │ │ │ │ 171 │ │ │ │ │ -172 for (int j=0; j │ │ │ │ │ +180void IntersectionComputation::orderPoints_(std:: │ │ │ │ │ +integral_constant, │ │ │ │ │ +181 std::integral_constant, │ │ │ │ │ +182 const V& centroid, │ │ │ │ │ +183 const std::vector >& SX, │ │ │ │ │ +184 const std::vector >& SY, │ │ │ │ │ +185 const std::vector& P, │ │ │ │ │ +186 std::vector >& H) │ │ │ │ │ +187{ │ │ │ │ │ +188 H.clear(); │ │ │ │ │ +189 std::vector id, temp(2); │ │ │ │ │ 190 │ │ │ │ │ -191 for (int j=0; j(),centroid,id,P); │ │ │ │ │ +192 │ │ │ │ │ +193 for (int i = 0; i < id.size();++i) { │ │ │ │ │ +194 temp[0] = id[i]; │ │ │ │ │ +195 temp[1] = id[(i+1)%(id.size())]; │ │ │ │ │ +196 H.push_back(temp); │ │ │ │ │ +197 } │ │ │ │ │ +198} │ │ │ │ │ 199 │ │ │ │ │ -200 } else │ │ │ │ │ -201 DUNE_THROW(Dune::GridError, "Unsupported element type"); │ │ │ │ │ -202 │ │ │ │ │ -203} │ │ │ │ │ -204 │ │ │ │ │ -205} // namespace GridGlue │ │ │ │ │ -206 │ │ │ │ │ -207} // namespace Dune │ │ │ │ │ -208 │ │ │ │ │ -209#endif // DUNE_GRIDGLUE_MERGING_CONFORMINGMERGE_HH │ │ │ │ │ -_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h │ │ │ │ │ -Common base class for many merger implementations: produce pairs of entities │ │ │ │ │ -that may intersect. │ │ │ │ │ +200template │ │ │ │ │ +201void IntersectionComputation::removeDuplicates(std::vector & p) │ │ │ │ │ +202{ │ │ │ │ │ +203 sort(p.begin(),p.end()); │ │ │ │ │ +204 std::vector::iterator it = std::unique(p.begin(),p.end()); │ │ │ │ │ +205 p.erase(it,p.end()); │ │ │ │ │ +206} │ │ │ │ │ +207 │ │ │ │ │ +208template │ │ │ │ │ +209bool IntersectionComputation::newFace3D(const std::vector& id, │ │ │ │ │ +210 const std::vector >& H) │ │ │ │ │ +211{ │ │ │ │ │ +212 // get size_type for all the vectors we are using │ │ │ │ │ +213 typedef typename std::vector::size_type size_type; │ │ │ │ │ +214 │ │ │ │ │ +215 int n = H.size() ; │ │ │ │ │ +216 int m = id.size() ; │ │ │ │ │ +217 std::vector A ; │ │ │ │ │ +218 std::vector B = id ; │ │ │ │ │ +219 sort(B.begin(),B.end()) ; │ │ │ │ │ +220 int i = 0 ; │ │ │ │ │ +221 bool b = true ; │ │ │ │ │ +222 double tp ; │ │ │ │ │ +223 │ │ │ │ │ +224 while ( b && (i=m) │ │ │ │ │ +227 { │ │ │ │ │ +228 A=H[i] ; │ │ │ │ │ +229 sort(A.begin(),A.end()); │ │ │ │ │ +230 tp = 0 ; │ │ │ │ │ +231 for ( size_type j=0 ; j < m; j++) │ │ │ │ │ +232 tp += std::fabs(A[j]-B[j]) ; │ │ │ │ │ +233 b = (tp>0) ; │ │ │ │ │ +234 } │ │ │ │ │ +235 │ │ │ │ │ +236 i += 1 ; │ │ │ │ │ +237 } │ │ │ │ │ +238 │ │ │ │ │ +239 return b ; │ │ │ │ │ +240} │ │ │ │ │ +241 │ │ │ │ │ +242 │ │ │ │ │ +243template │ │ │ │ │ +244void IntersectionComputation::orderPointsCC(std:: │ │ │ │ │ +integral_constant, │ │ │ │ │ +245 const V& centroid, │ │ │ │ │ +246 std::vector& id, │ │ │ │ │ +247 const std::vector& P) │ │ │ │ │ +248{ │ │ │ │ │ +249 typedef typename std::vector::size_type size_type; │ │ │ │ │ +250 │ │ │ │ │ +251 id.clear(); │ │ │ │ │ +252 │ │ │ │ │ +253 // get size_type for all the vectors we are using │ │ │ │ │ +254 V c,d1,d2,dr,dn,cross,d ; │ │ │ │ │ +255 std::vector ai ; │ │ │ │ │ +256 │ │ │ │ │ +257 d1 = P[1] - P[0] ; // two reference vectors │ │ │ │ │ +258 d2 = P[2] - P[0] ; │ │ │ │ │ +259 │ │ │ │ │ +260 cross[0] = d1[1]*d2[2] - d1[2]*d2[1] ; // cross product │ │ │ │ │ +261 cross[1] = d1[2]*d2[0] - d1[0]*d2[2] ; │ │ │ │ │ +262 cross[2] = d1[0]*d2[1] - d1[1]*d2[0] ; │ │ │ │ │ +263 │ │ │ │ │ +264 if (((centroid - P[0])*cross)<0) // good orientation ? │ │ │ │ │ +265 { │ │ │ │ │ +266 dr = d1 ; │ │ │ │ │ +267 dr /= dr.two_norm() ; // 'x-axis' unit vector │ │ │ │ │ +268 dn = dr ; │ │ │ │ │ +269 dn *= -(d2*dr) ; │ │ │ │ │ +270 dn += d2 ; │ │ │ │ │ +271 dn /= dn.two_norm() ; // 'y-axis' unit vector │ │ │ │ │ +272 } │ │ │ │ │ +273 else │ │ │ │ │ +274 { │ │ │ │ │ +275 dr = d2 ; │ │ │ │ │ +276 dr /= dr.two_norm() ; // 'y-axis' unit vector │ │ │ │ │ +277 dn = dr ; │ │ │ │ │ +278 dn *= -(d1*dr) ; │ │ │ │ │ +279 dn += d1 ; │ │ │ │ │ +280 dn /= dn.two_norm() ; // 'x-axis' unit vector │ │ │ │ │ +281 } │ │ │ │ │ +282 │ │ │ │ │ +283 // definition of angles, using projection on the local reference, ie by │ │ │ │ │ +scalarly multipliying by dr and dn resp. │ │ │ │ │ +284 for ( size_type j=1 ; j < P.size() ; j++) │ │ │ │ │ +285 { │ │ │ │ │ +286 ai.push_back(atan2((P[j]-P[0])*dn,(P[j]-P[0])*dr)) ; │ │ │ │ │ +287 id.push_back(j) ; │ │ │ │ │ +288 } │ │ │ │ │ +289 │ │ │ │ │ +290 // sort according to increasing angles │ │ │ │ │ +291 for ( size_type j=1; j < ai.size(); j++) { │ │ │ │ │ +292 for ( size_type i=0; i < j; i++) { │ │ │ │ │ +293 if (ai[j](ai[i],ai[j]) ; │ │ │ │ │ +295 std::swap(id[i],id[j]) ; │ │ │ │ │ +296 } │ │ │ │ │ +297 } │ │ │ │ │ +298 } │ │ │ │ │ +299 │ │ │ │ │ +300 id.insert(id.begin(),0); │ │ │ │ │ +301} │ │ │ │ │ +302 │ │ │ │ │ +303template │ │ │ │ │ +304void IntersectionComputation::orderPointsCC(std:: │ │ │ │ │ +integral_constant, │ │ │ │ │ +305 const V& centroid, │ │ │ │ │ +306 std::vector& id, │ │ │ │ │ +307 const std::vector& P) │ │ │ │ │ +308{ │ │ │ │ │ +309 typedef typename std::vector::size_type size_type; │ │ │ │ │ +310 │ │ │ │ │ +311 // get size_type for all the vectors we are using │ │ │ │ │ +312 typedef typename std::vector::size_type size_type; │ │ │ │ │ +313 │ │ │ │ │ +314 std::vector ai(P.size()); │ │ │ │ │ +315 id.resize(P.size()); │ │ │ │ │ +316 │ │ │ │ │ +317 // definition of angles │ │ │ │ │ +318 for ( size_type i=0; i < P.size(); i++) { │ │ │ │ │ +319 ai[i] = atan2(P[i][1]-centroid[1],P[i][0]-centroid[0]); │ │ │ │ │ +320 id[i] = i; │ │ │ │ │ +321 } │ │ │ │ │ +322 │ │ │ │ │ +323 // sort according to increasing angles │ │ │ │ │ +324 for ( size_type j=1; j < ai.size(); j++) { │ │ │ │ │ +325 for ( size_type i=0; i < j; i++) if (ai[j](ai[i],ai[j]); │ │ │ │ │ +327 std::swap(id[i],id[j]); │ │ │ │ │ +328 } │ │ │ │ │ +329 } │ │ │ │ │ +330} │ │ │ │ │ +331 │ │ │ │ │ +332} /* namespace Dune::GridGlue */ │ │ │ │ │ +333} /* namespace Dune */ │ │ │ │ │ _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_o_n_f_o_r_m_i_n_g_M_e_r_g_e │ │ │ │ │ -Implementation of the Merger concept for conforming interfaces. │ │ │ │ │ -DDeeffiinniittiioonn conformingmerge.hh:49 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_n_f_o_r_m_i_n_g_M_e_r_g_e_:_:_L_o_c_a_l_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< T, dim > LocalCoords │ │ │ │ │ -the coordinate type used in this interface │ │ │ │ │ -DDeeffiinniittiioonn conformingmerge.hh:62 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_n_f_o_r_m_i_n_g_M_e_r_g_e_:_:_W_o_r_l_d_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< T, dimworld > WorldCoords │ │ │ │ │ -the coordinate type used in this interface │ │ │ │ │ -DDeeffiinniittiioonn conformingmerge.hh:59 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_n_f_o_r_m_i_n_g_M_e_r_g_e_:_:_d_e_f_a_u_l_t___t_o_l_e_r_a_n_c_e │ │ │ │ │ -static constexpr T default_tolerance │ │ │ │ │ -DDeeffiinniittiioonn conformingmerge.hh:89 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_n_f_o_r_m_i_n_g_M_e_r_g_e_:_:_c_t_y_p_e │ │ │ │ │ -T ctype │ │ │ │ │ -the numeric type used in this interface │ │ │ │ │ -DDeeffiinniittiioonn conformingmerge.hh:56 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_n_f_o_r_m_i_n_g_M_e_r_g_e_:_:_C_o_n_f_o_r_m_i_n_g_M_e_r_g_e │ │ │ │ │ -ConformingMerge(T tolerance=default_tolerance) │ │ │ │ │ -DDeeffiinniittiioonn conformingmerge.hh:91 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_a_n_d_a_r_d_M_e_r_g_e │ │ │ │ │ -Common base class for many merger implementations: produce pairs of entities │ │ │ │ │ -that may intersect. │ │ │ │ │ -DDeeffiinniittiioonn standardmerge.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_a_n_d_a_r_d_M_e_r_g_e_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -typename IntersectionListProvider::SimplicialIntersection │ │ │ │ │ -SimplicialIntersection │ │ │ │ │ -DDeeffiinniittiioonn standardmerge.hh:83 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_s_e_r_t_P_o_i_n_t │ │ │ │ │ +int insertPoint(const V p, std::vector< V > &P) │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:164 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ 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: computeintersection.hh File Reference │ │ │ │ +dune-grid-glue: overlappingmerge.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,46 +71,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces | │ │ │ │ -Functions
│ │ │ │ -
computeintersection.hh File Reference
│ │ │ │ +Namespaces
│ │ │ │ +
overlappingmerge.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <dune/common/fvector.hh>
│ │ │ │ +
#include <iostream>
│ │ │ │ +#include <iomanip>
│ │ │ │ +#include <vector>
│ │ │ │ +#include <algorithm>
│ │ │ │ #include <dune/common/fmatrix.hh>
│ │ │ │ -#include "simplexintersection.cc"
│ │ │ │ -#include "computeintersection.cc"
│ │ │ │ +#include <dune/common/fvector.hh>
│ │ │ │ +#include <dune/geometry/referenceelements.hh>
│ │ │ │ +#include <dune/geometry/multilineargeometry.hh>
│ │ │ │ +#include <dune/grid/common/grid.hh>
│ │ │ │ +#include <dune/grid-glue/merging/standardmerge.hh>
│ │ │ │ +#include <dune/grid-glue/merging/computeintersection.hh>
│ │ │ │ +#include "overlappingmerge.cc"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

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

│ │ │ │ Namespaces

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

│ │ │ │ -Functions

template<class V >
int Dune::GridGlue::insertPoint (const V p, std::vector< V > &P)
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,32 +1,34 @@ │ │ │ │ │ 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 | _F_u_n_c_t_i_o_n_s │ │ │ │ │ -computeintersection.hh File Reference │ │ │ │ │ -#include │ │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ │ +overlappingmerge.hh File Reference │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ #include │ │ │ │ │ -#include "_s_i_m_p_l_e_x_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ -#include "_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include │ │ │ │ │ +#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h> │ │ │ │ │ +#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ +#include "_o_v_e_r_l_a_p_p_i_n_g_m_e_r_g_e_._c_c" │ │ │ │ │ _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_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_<_ _d_i_m_W_o_r_l_d_,_ _d_i_m_1_,_ _d_i_m_2_,_ _T_ _> │ │ │ │ │ -  │ │ │ │ │ -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_C_o_m_p_u_t_a_t_i_o_n_<_ _C_M_ _> │ │ │ │ │ -  _I_n_t_e_r_s_e_c_t_i_o_n computation method for two elements of arbitrary │ │ │ │ │ - dimension. _M_o_r_e_._._. │ │ │ │ │ +class   _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_<_ _d_i_m_1_,_ _d_i_m_2_,_ _d_i_m_w_o_r_l_d_,_ _T_ _> │ │ │ │ │ +  Computing overlapping grid intersections for grids of different │ │ │ │ │ + dimensions. _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 │ │ │ │ │ -int  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_s_e_r_t_P_o_i_n_t (const V p, std::vector< V > &P) │ │ │ │ │ -  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: computeintersection.hh Source File │ │ │ │ +dune-grid-glue: overlappingmerge.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,190 +74,102 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
computeintersection.hh
│ │ │ │ +
overlappingmerge.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_MERGING_COMPUTEINTERSECTION_HH
│ │ │ │ -
4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH
│ │ │ │ -
5
│ │ │ │ -
6#include <dune/common/fvector.hh>
│ │ │ │ -
7#include <dune/common/fmatrix.hh>
│ │ │ │ -
8
│ │ │ │ -
9namespace Dune {
│ │ │ │ -
10namespace GridGlue {
│ │ │ │ -
11
│ │ │ │ -
12template<int dimWorld, int dim1, int dim2, typename T = double>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
14public:
│ │ │ │ -
15 typedef FieldVector<T, dimWorld> Vector;
│ │ │ │ -
16 static const int grid1Dimension = dim1;
│ │ │ │ -
17 static const int grid2Dimension = dim2;
│ │ │ │ -
18 static const int intersectionDimension = (dim1 < dim2)?(dim1):(dim2);
│ │ │ │ -
19
│ │ │ │ -
20 static bool computeIntersectionPoints(const std::vector<Vector> X,
│ │ │ │ -
21 const std::vector<Vector> Y,
│ │ │ │ -
22 std::vector<std::vector<int> >& SX,
│ │ │ │ -
23 std::vector<std::vector<int> >& SY,
│ │ │ │ -
24 std::vector<Vector>& P);
│ │ │ │ -
25 static void grid1_subdivisions(const std::vector<Vector> elementCorners,
│ │ │ │ -
26 std::vector<std::vector<unsigned int> >& subElements,
│ │ │ │ -
27 std::vector<std::vector<int> >& faceIds);
│ │ │ │ -
28 static void grid2_subdivisions(const std::vector<Vector> elementCorners,
│ │ │ │ -
29 std::vector<std::vector<unsigned int> >& subElements,
│ │ │ │ -
30 std::vector<std::vector<int> >& faceIds);
│ │ │ │ -
31};
│ │ │ │ -
│ │ │ │ -
32
│ │ │ │ -
38template<class CM>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
40private:
│ │ │ │ -
41 typedef typename CM::Vector V;
│ │ │ │ -
42 const int dimWorld = V::dimension;
│ │ │ │ -
43 const int dim1 = CM::grid1Dimension;
│ │ │ │ -
44 const int dim2 = CM::grid2Dimension;
│ │ │ │ -
45public:
│ │ │ │ -
59 static bool computeIntersection(const std::vector<V>& X,
│ │ │ │ -
60 const std::vector<V>& Y,
│ │ │ │ -
61 std::vector<std::vector<int> >& SX,
│ │ │ │ -
62 std::vector<std::vector<int> >& SY,
│ │ │ │ -
63 std::vector<V>& P);
│ │ │ │ -
64
│ │ │ │ -
74 template<int isDim, int dW>
│ │ │ │ -
│ │ │ │ -
75 static void orderPoints(const V& centroid,
│ │ │ │ -
76 const std::vector<std::vector<int> >& SX,
│ │ │ │ -
77 const std::vector<std::vector<int> >& SY,
│ │ │ │ -
78 const std::vector<V>& P,
│ │ │ │ -
79 std::vector<std::vector<int> >& H)
│ │ │ │ -
80 {
│ │ │ │ -
81 if (isDim > 1)
│ │ │ │ -
82 orderPoints_(std::integral_constant<int,isDim>(),std::integral_constant<int,dW>(),
│ │ │ │ -
83 centroid, SX, SY, P,H);
│ │ │ │ -
84 }
│ │ │ │ -
│ │ │ │ -
85
│ │ │ │ -
86private:
│ │ │ │ -
87 static void orderPoints_(std::integral_constant<int,1>,
│ │ │ │ -
88 std::integral_constant<int,1>,
│ │ │ │ -
89 const V& centroid,
│ │ │ │ -
90 const std::vector<std::vector<int> >& SX,
│ │ │ │ -
91 const std::vector<std::vector<int> >& SY,
│ │ │ │ -
92 const std::vector<V>& P,
│ │ │ │ -
93 std::vector<std::vector<int> >& H) {}
│ │ │ │ -
94 static void orderPoints_(std::integral_constant<int,1>,
│ │ │ │ -
95 std::integral_constant<int,2>,
│ │ │ │ -
96 const V& centroid,
│ │ │ │ -
97 const std::vector<std::vector<int> >& SX,
│ │ │ │ -
98 const std::vector<std::vector<int> >& SY,
│ │ │ │ -
99 const std::vector<V>& P,
│ │ │ │ -
100 std::vector<std::vector<int> >& H) {}
│ │ │ │ -
101 static void orderPoints_(std::integral_constant<int,1>,
│ │ │ │ -
102 std::integral_constant<int,3>,
│ │ │ │ -
103 const V& centroid,
│ │ │ │ -
104 const std::vector<std::vector<int> >& SX,
│ │ │ │ -
105 const std::vector<std::vector<int> >& SY,
│ │ │ │ -
106 const std::vector<V>& P,
│ │ │ │ -
107 std::vector<std::vector<int> >& H) {}
│ │ │ │ -
108 static void orderPoints_(std::integral_constant<int,2>,
│ │ │ │ -
109 std::integral_constant<int,2>,
│ │ │ │ -
110 const V& centroid,
│ │ │ │ -
111 const std::vector<std::vector<int> >& SX,
│ │ │ │ -
112 const std::vector<std::vector<int> >& SY,
│ │ │ │ -
113 const std::vector<V>& P,
│ │ │ │ -
114 std::vector<std::vector<int> >& H);
│ │ │ │ -
115 static void orderPoints_(std::integral_constant<int,2>,
│ │ │ │ -
116 std::integral_constant<int,3>,
│ │ │ │ -
117 const V& centroid,
│ │ │ │ -
118 const std::vector<std::vector<int> >& SX,
│ │ │ │ -
119 const std::vector<std::vector<int> >& SY,
│ │ │ │ -
120 const std::vector<V>& P,
│ │ │ │ -
121 std::vector<std::vector<int> >& H);
│ │ │ │ -
122 static void orderPoints_(std::integral_constant<int,3>,
│ │ │ │ -
123 std::integral_constant<int,3>,
│ │ │ │ -
124 const V& centroid,
│ │ │ │ -
125 const std::vector<std::vector<int> >& SX,
│ │ │ │ -
126 const std::vector<std::vector<int> >& SY,
│ │ │ │ -
127 const std::vector<V>& P,
│ │ │ │ -
128 std::vector<std::vector<int> > & H);
│ │ │ │ -
129
│ │ │ │ -
137 static void orderPointsCC(std::integral_constant<int,2>,
│ │ │ │ -
138 const V& centroid,
│ │ │ │ -
139 std::vector<int> &id,
│ │ │ │ -
140 const std::vector<V>& P);
│ │ │ │ -
141 static void orderPointsCC(std::integral_constant<int,3>,
│ │ │ │ -
142 const V& centroid,
│ │ │ │ -
143 std::vector<int> &id,
│ │ │ │ -
144 const std::vector<V>& P);
│ │ │ │ -
145
│ │ │ │ -
150 static void removeDuplicates( std::vector<int> & p);
│ │ │ │ -
151
│ │ │ │ -
159 static bool newFace3D(const std::vector<int>& id,
│ │ │ │ -
160 const std::vector<std::vector<int> >& H);
│ │ │ │ -
161};
│ │ │ │ -
│ │ │ │ -
162
│ │ │ │ -
163template<class V>
│ │ │ │ -
│ │ │ │ -
164inline int insertPoint(const V p, std::vector<V>& P)
│ │ │ │ -
165{
│ │ │ │ -
166 double eps= 1e-8; // tolerance for identical nodes
│ │ │ │ -
167 std::size_t k=0 ;
│ │ │ │ -
168
│ │ │ │ -
169 if (P.size()>0) {
│ │ │ │ -
170
│ │ │ │ -
171 while ((k<P.size())&&
│ │ │ │ -
172 ((p - P[k]).infinity_norm()>eps*(P[k].infinity_norm()) &&
│ │ │ │ -
173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) &&
│ │ │ │ -
174 !(p.infinity_norm() < eps && P[k].infinity_norm() <eps &&
│ │ │ │ -
175 (p - P[k]).infinity_norm() < eps))
│ │ │ │ -
176 k++ ;
│ │ │ │ -
177
│ │ │ │ -
178 if (k>=P.size())
│ │ │ │ -
179 P.push_back(p) ; // new node is not contained in P
│ │ │ │ -
180
│ │ │ │ -
181 }
│ │ │ │ -
182 else
│ │ │ │ -
183 P.push_back(p);
│ │ │ │ -
184
│ │ │ │ -
185 return k ;
│ │ │ │ -
186}
│ │ │ │ -
│ │ │ │ -
187
│ │ │ │ -
188
│ │ │ │ -
189} /* namespace Dune::GridGlue */
│ │ │ │ -
190} /* namespace Dune */
│ │ │ │ -
191
│ │ │ │ -
192#include "simplexintersection.cc"
│ │ │ │ -
193#include "computeintersection.cc"
│ │ │ │ -
194
│ │ │ │ -
195#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#ifndef DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
│ │ │ │ +
6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
│ │ │ │ +
7
│ │ │ │ +
8#include <iostream>
│ │ │ │ +
9#include <iomanip>
│ │ │ │ +
10#include <vector>
│ │ │ │ +
11#include <algorithm>
│ │ │ │ +
12
│ │ │ │ +
13#include <dune/common/fmatrix.hh>
│ │ │ │ +
14#include <dune/common/fvector.hh>
│ │ │ │ +
15
│ │ │ │ +
16#include <dune/geometry/referenceelements.hh>
│ │ │ │ +
17#include <dune/geometry/multilineargeometry.hh>
│ │ │ │ +
18
│ │ │ │ +
19#include <dune/grid/common/grid.hh>
│ │ │ │ +
20
│ │ │ │ + │ │ │ │ + │ │ │ │ +
23
│ │ │ │ +
24namespace Dune {
│ │ │ │ +
25namespace GridGlue {
│ │ │ │ +
26
│ │ │ │ +
34template<int dim1, int dim2, int dimworld, typename T = double>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
36 : public StandardMerge<T,dim1,dim2,dimworld>
│ │ │ │ +
37{
│ │ │ │ +
38
│ │ │ │ +
39public:
│ │ │ │ +
40
│ │ │ │ +
41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
│ │ │ │ +
42
│ │ │ │ +
44 typedef T ctype;
│ │ │ │ +
45
│ │ │ │ +
47 typedef Dune::FieldVector<T, dimworld> WorldCoords;
│ │ │ │ +
48
│ │ │ │ +
50 //typedef Dune::FieldVector<T, dim> LocalCoords;
│ │ │ │ +
51
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
53 {}
│ │ │ │ +
│ │ │ │ +
54
│ │ │ │ +
55protected:
│ │ │ │ + │ │ │ │ +
57
│ │ │ │ +
69 void computeIntersections(const Dune::GeometryType& grid1ElementType,
│ │ │ │ +
70 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
│ │ │ │ +
71 std::bitset<(1<<dim1)>& neighborIntersects1,
│ │ │ │ +
72 unsigned int grid1Index,
│ │ │ │ +
73 const Dune::GeometryType& grid2ElementType,
│ │ │ │ +
74 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
│ │ │ │ +
75 std::bitset<(1<<dim2)>& neighborIntersects2,
│ │ │ │ +
76 unsigned int grid2Index,
│ │ │ │ +
77 std::vector<SimplicialIntersection>& intersections);
│ │ │ │ +
78
│ │ │ │ +
79private:
│ │ │ │ +
80 bool inPlane(std::vector<FieldVector<T,dimworld> >& points);
│ │ │ │ +
81
│ │ │ │ +
82};
│ │ │ │ +
│ │ │ │ +
83
│ │ │ │ +
84} /* namespace Dune::GridGlue */
│ │ │ │ +
85} /* namespace Dune */
│ │ │ │ +
86
│ │ │ │ +
87#include "overlappingmerge.cc"
│ │ │ │ +
88
│ │ │ │ +
89
│ │ │ │ +
90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
│ │ │ │ + │ │ │ │ +
Common base class for many merger implementations: produce pairs of entities that may intersect.
│ │ │ │ + │ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
int insertPoint(const V p, std::vector< V > &P)
Definition computeintersection.hh:164
│ │ │ │ -
Definition computeintersection.hh:13
│ │ │ │ -
static void grid2_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
│ │ │ │ -
static bool computeIntersectionPoints(const std::vector< Vector > X, const std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > > &SY, std::vector< Vector > &P)
│ │ │ │ -
FieldVector< T, dimWorld > Vector
Definition computeintersection.hh:15
│ │ │ │ -
static const int grid1Dimension
Definition computeintersection.hh:16
│ │ │ │ -
static void grid1_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
│ │ │ │ -
static const int grid2Dimension
Definition computeintersection.hh:17
│ │ │ │ -
static const int intersectionDimension
Definition computeintersection.hh:18
│ │ │ │ -
Intersection computation method for two elements of arbitrary dimension.
Definition computeintersection.hh:39
│ │ │ │ -
static void orderPoints(const V &centroid, const std::vector< std::vector< int > > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V > &P, std::vector< std::vector< int > > &H)
Order Points in the point list P face-wise such that a subsimplex subdivision can be constructed.
Definition computeintersection.hh:75
│ │ │ │ -
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
│ │ │ │ +
Computing overlapping grid intersections for grids of different dimensions.
Definition overlappingmerge.hh:37
│ │ │ │ +
StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection SimplicialIntersection
Definition overlappingmerge.hh:56
│ │ │ │ +
OverlappingMerge()
the coordinate type used in this interface
Definition overlappingmerge.hh:52
│ │ │ │ +
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
│ │ │ │ +
Dune::FieldVector< T, dimworld > WorldCoords
the coordinate type used in this interface
Definition overlappingmerge.hh:47
│ │ │ │ +
T ctype
the numeric type used in this interface
Definition overlappingmerge.hh:44
│ │ │ │ +
Common base class for many merger implementations: produce pairs of entities that may intersect.
Definition standardmerge.hh:58
│ │ │ │ +
typename IntersectionListProvider::SimplicialIntersection SimplicialIntersection
Definition standardmerge.hh:83
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,214 +1,127 @@ │ │ │ │ │ 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 │ │ │ │ │ -computeintersection.hh │ │ │ │ │ +overlappingmerge.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_MERGING_COMPUTEINTERSECTION_HH │ │ │ │ │ -4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH │ │ │ │ │ -5 │ │ │ │ │ -6#include │ │ │ │ │ -7#include │ │ │ │ │ -8 │ │ │ │ │ -9namespace _D_u_n_e { │ │ │ │ │ -10namespace GridGlue { │ │ │ │ │ -11 │ │ │ │ │ -12template │ │ │ │ │ -_1_3class _C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d { │ │ │ │ │ -14public: │ │ │ │ │ -_1_5 typedef FieldVector _V_e_c_t_o_r; │ │ │ │ │ -_1_6 static const int _g_r_i_d_1_D_i_m_e_n_s_i_o_n = dim1; │ │ │ │ │ -_1_7 static const int _g_r_i_d_2_D_i_m_e_n_s_i_o_n = dim2; │ │ │ │ │ -_1_8 static const int _i_n_t_e_r_s_e_c_t_i_o_n_D_i_m_e_n_s_i_o_n = (dim1 < dim2)?(dim1):(dim2); │ │ │ │ │ -19 │ │ │ │ │ -_2_0 static bool _c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_P_o_i_n_t_s(const std::vector X, │ │ │ │ │ -21 const std::vector Y, │ │ │ │ │ -22 std::vector >& SX, │ │ │ │ │ -23 std::vector >& SY, │ │ │ │ │ -24 std::vector& P); │ │ │ │ │ -_2_5 static void _g_r_i_d_1___s_u_b_d_i_v_i_s_i_o_n_s(const std::vector elementCorners, │ │ │ │ │ -26 std::vector >& subElements, │ │ │ │ │ -27 std::vector >& faceIds); │ │ │ │ │ -_2_8 static void _g_r_i_d_2___s_u_b_d_i_v_i_s_i_o_n_s(const std::vector elementCorners, │ │ │ │ │ -29 std::vector >& subElements, │ │ │ │ │ -30 std::vector >& faceIds); │ │ │ │ │ -31}; │ │ │ │ │ -32 │ │ │ │ │ -38template │ │ │ │ │ -_3_9class _I_n_t_e_r_s_e_c_t_i_o_n_C_o_m_p_u_t_a_t_i_o_n { │ │ │ │ │ -40private: │ │ │ │ │ -41 typedef typename CM::Vector V; │ │ │ │ │ -42 const int dimWorld = V::dimension; │ │ │ │ │ -43 const int dim1 = CM::grid1Dimension; │ │ │ │ │ -44 const int dim2 = CM::grid2Dimension; │ │ │ │ │ -45public: │ │ │ │ │ -59 static bool _c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n(const std::vector& X, │ │ │ │ │ -60 const std::vector& Y, │ │ │ │ │ -61 std::vector >& SX, │ │ │ │ │ -62 std::vector >& SY, │ │ │ │ │ -63 std::vector& P); │ │ │ │ │ -64 │ │ │ │ │ -74 template │ │ │ │ │ -_7_5 static void _o_r_d_e_r_P_o_i_n_t_s(const V& centroid, │ │ │ │ │ -76 const std::vector >& SX, │ │ │ │ │ -77 const std::vector >& SY, │ │ │ │ │ -78 const std::vector& P, │ │ │ │ │ -79 std::vector >& H) │ │ │ │ │ -80 { │ │ │ │ │ -81 if (isDim > 1) │ │ │ │ │ -82 orderPoints_(std::integral_constant(),std:: │ │ │ │ │ -integral_constant(), │ │ │ │ │ -83 centroid, SX, SY, P,H); │ │ │ │ │ -84 } │ │ │ │ │ -85 │ │ │ │ │ -86private: │ │ │ │ │ -87 static void orderPoints_(std::integral_constant, │ │ │ │ │ -88 std::integral_constant, │ │ │ │ │ -89 const V& centroid, │ │ │ │ │ -90 const std::vector >& SX, │ │ │ │ │ -91 const std::vector >& SY, │ │ │ │ │ -92 const std::vector& P, │ │ │ │ │ -93 std::vector >& H) {} │ │ │ │ │ -94 static void orderPoints_(std::integral_constant, │ │ │ │ │ -95 std::integral_constant, │ │ │ │ │ -96 const V& centroid, │ │ │ │ │ -97 const std::vector >& SX, │ │ │ │ │ -98 const std::vector >& SY, │ │ │ │ │ -99 const std::vector& P, │ │ │ │ │ -100 std::vector >& H) {} │ │ │ │ │ -101 static void orderPoints_(std::integral_constant, │ │ │ │ │ -102 std::integral_constant, │ │ │ │ │ -103 const V& centroid, │ │ │ │ │ -104 const std::vector >& SX, │ │ │ │ │ -105 const std::vector >& SY, │ │ │ │ │ -106 const std::vector& P, │ │ │ │ │ -107 std::vector >& H) {} │ │ │ │ │ -108 static void orderPoints_(std::integral_constant, │ │ │ │ │ -109 std::integral_constant, │ │ │ │ │ -110 const V& centroid, │ │ │ │ │ -111 const std::vector >& SX, │ │ │ │ │ -112 const std::vector >& SY, │ │ │ │ │ -113 const std::vector& P, │ │ │ │ │ -114 std::vector >& H); │ │ │ │ │ -115 static void orderPoints_(std::integral_constant, │ │ │ │ │ -116 std::integral_constant, │ │ │ │ │ -117 const V& centroid, │ │ │ │ │ -118 const std::vector >& SX, │ │ │ │ │ -119 const std::vector >& SY, │ │ │ │ │ -120 const std::vector& P, │ │ │ │ │ -121 std::vector >& H); │ │ │ │ │ -122 static void orderPoints_(std::integral_constant, │ │ │ │ │ -123 std::integral_constant, │ │ │ │ │ -124 const V& centroid, │ │ │ │ │ -125 const std::vector >& SX, │ │ │ │ │ -126 const std::vector >& SY, │ │ │ │ │ -127 const std::vector& P, │ │ │ │ │ -128 std::vector > & H); │ │ │ │ │ -129 │ │ │ │ │ -137 static void orderPointsCC(std::integral_constant, │ │ │ │ │ -138 const V& centroid, │ │ │ │ │ -139 std::vector &id, │ │ │ │ │ -140 const std::vector& P); │ │ │ │ │ -141 static void orderPointsCC(std::integral_constant, │ │ │ │ │ -142 const V& centroid, │ │ │ │ │ -143 std::vector &id, │ │ │ │ │ -144 const std::vector& P); │ │ │ │ │ -145 │ │ │ │ │ -150 static void removeDuplicates( std::vector & p); │ │ │ │ │ -151 │ │ │ │ │ -159 static bool newFace3D(const std::vector& id, │ │ │ │ │ -160 const std::vector >& H); │ │ │ │ │ -161}; │ │ │ │ │ -162 │ │ │ │ │ -163template │ │ │ │ │ -_1_6_4inline int _i_n_s_e_r_t_P_o_i_n_t(const V p, std::vector& P) │ │ │ │ │ -165{ │ │ │ │ │ -166 double eps= 1e-8; // tolerance for identical nodes │ │ │ │ │ -167 std::size_t k=0 ; │ │ │ │ │ -168 │ │ │ │ │ -169 if (P.size()>0) { │ │ │ │ │ -170 │ │ │ │ │ -171 while ((keps*(P[k].infinity_norm()) && │ │ │ │ │ -173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) && │ │ │ │ │ -174 !(p.infinity_norm() < eps && P[k].infinity_norm() =P.size()) │ │ │ │ │ -179 P.push_back(p) ; // new node is not contained in P │ │ │ │ │ -180 │ │ │ │ │ -181 } │ │ │ │ │ -182 else │ │ │ │ │ -183 P.push_back(p); │ │ │ │ │ -184 │ │ │ │ │ -185 return k ; │ │ │ │ │ -186} │ │ │ │ │ -187 │ │ │ │ │ -188 │ │ │ │ │ -189} /* namespace Dune::GridGlue */ │ │ │ │ │ -190} /* namespace Dune */ │ │ │ │ │ -191 │ │ │ │ │ -192#include "_s_i_m_p_l_e_x_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ -193#include "_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ -194 │ │ │ │ │ -195#endif │ │ │ │ │ -_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._c_c │ │ │ │ │ -_s_i_m_p_l_e_x_i_n_t_e_r_s_e_c_t_i_o_n_._c_c │ │ │ │ │ +5#ifndef DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH │ │ │ │ │ +6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH │ │ │ │ │ +7 │ │ │ │ │ +8#include │ │ │ │ │ +9#include │ │ │ │ │ +10#include │ │ │ │ │ +11#include │ │ │ │ │ +12 │ │ │ │ │ +13#include │ │ │ │ │ +14#include │ │ │ │ │ +15 │ │ │ │ │ +16#include │ │ │ │ │ +17#include │ │ │ │ │ +18 │ │ │ │ │ +19#include │ │ │ │ │ +20 │ │ │ │ │ +21#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h> │ │ │ │ │ +22#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ +23 │ │ │ │ │ +24namespace _D_u_n_e { │ │ │ │ │ +25namespace GridGlue { │ │ │ │ │ +26 │ │ │ │ │ +34template │ │ │ │ │ +_3_5class _O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e │ │ │ │ │ +36 : public _S_t_a_n_d_a_r_d_M_e_r_g_e │ │ │ │ │ +37{ │ │ │ │ │ +38 │ │ │ │ │ +39public: │ │ │ │ │ +40 │ │ │ │ │ +41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */ │ │ │ │ │ +42 │ │ │ │ │ +_4_4 typedef T _c_t_y_p_e; │ │ │ │ │ +45 │ │ │ │ │ +_4_7 typedef Dune::FieldVector _W_o_r_l_d_C_o_o_r_d_s; │ │ │ │ │ +48 │ │ │ │ │ +50 //typedef Dune::FieldVector LocalCoords; │ │ │ │ │ +51 │ │ │ │ │ +_5_2 _O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e() │ │ │ │ │ +53 {} │ │ │ │ │ +54 │ │ │ │ │ +55protected: │ │ │ │ │ +_5_6 typedef typename _S_t_a_n_d_a_r_d_M_e_r_g_e_<_T_,_d_i_m_1_,_d_i_m_2_,_d_i_m_w_o_r_l_d_>_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ +57 │ │ │ │ │ +69 void _c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_s(const Dune::GeometryType& grid1ElementType, │ │ │ │ │ +70 const std::vector >& grid1ElementCorners, │ │ │ │ │ +71 std::bitset<(1<& neighborIntersects1, │ │ │ │ │ +72 unsigned int grid1Index, │ │ │ │ │ +73 const Dune::GeometryType& grid2ElementType, │ │ │ │ │ +74 const std::vector >& grid2ElementCorners, │ │ │ │ │ +75 std::bitset<(1<& neighborIntersects2, │ │ │ │ │ +76 unsigned int grid2Index, │ │ │ │ │ +77 std::vector& intersections); │ │ │ │ │ +78 │ │ │ │ │ +79private: │ │ │ │ │ +80 bool inPlane(std::vector >& points); │ │ │ │ │ +81 │ │ │ │ │ +82}; │ │ │ │ │ +83 │ │ │ │ │ +84} /* namespace Dune::GridGlue */ │ │ │ │ │ +85} /* namespace Dune */ │ │ │ │ │ +86 │ │ │ │ │ +87#include "_o_v_e_r_l_a_p_p_i_n_g_m_e_r_g_e_._c_c" │ │ │ │ │ +88 │ │ │ │ │ +89 │ │ │ │ │ +90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH │ │ │ │ │ +_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ +_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h │ │ │ │ │ +Common base class for many merger implementations: produce pairs of entities │ │ │ │ │ +that may intersect. │ │ │ │ │ +_o_v_e_r_l_a_p_p_i_n_g_m_e_r_g_e_._c_c │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_s_e_r_t_P_o_i_n_t │ │ │ │ │ -int insertPoint(const V p, std::vector< V > &P) │ │ │ │ │ -DDeeffiinniittiioonn computeintersection.hh:164 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d │ │ │ │ │ -DDeeffiinniittiioonn computeintersection.hh:13 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_2___s_u_b_d_i_v_i_s_i_o_n_s │ │ │ │ │ -static void grid2_subdivisions(const std::vector< Vector > elementCorners, │ │ │ │ │ -std::vector< std::vector< unsigned int > > &subElements, std::vector< std:: │ │ │ │ │ -vector< int > > &faceIds) │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_P_o_i_n_t_s │ │ │ │ │ -static bool computeIntersectionPoints(const std::vector< Vector > X, const │ │ │ │ │ -std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector< │ │ │ │ │ -std::vector< int > > &SY, std::vector< Vector > &P) │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_V_e_c_t_o_r │ │ │ │ │ -FieldVector< T, dimWorld > Vector │ │ │ │ │ -DDeeffiinniittiioonn computeintersection.hh:15 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_1_D_i_m_e_n_s_i_o_n │ │ │ │ │ -static const int grid1Dimension │ │ │ │ │ -DDeeffiinniittiioonn computeintersection.hh:16 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_1___s_u_b_d_i_v_i_s_i_o_n_s │ │ │ │ │ -static void grid1_subdivisions(const std::vector< Vector > elementCorners, │ │ │ │ │ -std::vector< std::vector< unsigned int > > &subElements, std::vector< std:: │ │ │ │ │ -vector< int > > &faceIds) │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_2_D_i_m_e_n_s_i_o_n │ │ │ │ │ -static const int grid2Dimension │ │ │ │ │ -DDeeffiinniittiioonn computeintersection.hh:17 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_i_n_t_e_r_s_e_c_t_i_o_n_D_i_m_e_n_s_i_o_n │ │ │ │ │ -static const int intersectionDimension │ │ │ │ │ -DDeeffiinniittiioonn computeintersection.hh:18 │ │ │ │ │ -_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_:_:_o_r_d_e_r_P_o_i_n_t_s │ │ │ │ │ -static void orderPoints(const V ¢roid, const std::vector< std::vector< int │ │ │ │ │ -> > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V > │ │ │ │ │ -&P, std::vector< std::vector< int > > &H) │ │ │ │ │ -Order Points in the point list P face-wise such that a subsimplex subdivision │ │ │ │ │ -can be constructed. │ │ │ │ │ -DDeeffiinniittiioonn computeintersection.hh:75 │ │ │ │ │ -_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 │ │ │ │ │ +Computing overlapping grid intersections for grids of different dimensions. │ │ │ │ │ +DDeeffiinniittiioonn overlappingmerge.hh:37 │ │ │ │ │ +_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_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection │ │ │ │ │ +SimplicialIntersection │ │ │ │ │ +DDeeffiinniittiioonn overlappingmerge.hh:56 │ │ │ │ │ +_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_:_:_O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e │ │ │ │ │ +OverlappingMerge() │ │ │ │ │ +the coordinate type used in this interface │ │ │ │ │ +DDeeffiinniittiioonn overlappingmerge.hh:52 │ │ │ │ │ +_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_:_:_O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e_:_:_W_o_r_l_d_C_o_o_r_d_s │ │ │ │ │ +Dune::FieldVector< T, dimworld > WorldCoords │ │ │ │ │ +the coordinate type used in this interface │ │ │ │ │ +DDeeffiinniittiioonn overlappingmerge.hh:47 │ │ │ │ │ +_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_t_y_p_e │ │ │ │ │ +T ctype │ │ │ │ │ +the numeric type used in this interface │ │ │ │ │ +DDeeffiinniittiioonn overlappingmerge.hh:44 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_a_n_d_a_r_d_M_e_r_g_e │ │ │ │ │ +Common base class for many merger implementations: produce pairs of entities │ │ │ │ │ +that may intersect. │ │ │ │ │ +DDeeffiinniittiioonn standardmerge.hh:58 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_a_n_d_a_r_d_M_e_r_g_e_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ +typename IntersectionListProvider::SimplicialIntersection │ │ │ │ │ +SimplicialIntersection │ │ │ │ │ +DDeeffiinniittiioonn standardmerge.hh:83 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: contactmerge.hh File Reference │ │ │ │ +dune-grid-glue: standardmerge.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,56 +70,110 @@ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │
│ │ │ │ -Classes | │ │ │ │ -Namespaces
│ │ │ │ -
contactmerge.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Macros | │ │ │ │ +Functions
│ │ │ │ +
standardmerge.cc File Reference
│ │ │ │ │ │ │ │
│ │ │ │ - │ │ │ │ -

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

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

Go to the source code of this file.

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

│ │ │ │ -Classes

class  Dune::GridGlue::ContactMerge< dimworld, T >
 Merge two codimension-1 surfaces that may be a positive distance apart. More...
 
│ │ │ │ +
#include "config.h"
│ │ │ │ +#include "standardmerge.hh"
│ │ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ │ Namespaces

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

│ │ │ │ +Macros

#define DECL
 
#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)
 
│ │ │ │ -

Detailed Description

│ │ │ │ -

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

│ │ │ │ -
│ │ │ │ +

Macro Definition Documentation

│ │ │ │ + │ │ │ │ +

◆ DECL

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define DECL
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ +

◆ STANDARD_MERGE_INSTANTIATE

│ │ │ │ + │ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
#define STANDARD_MERGE_INSTANTIATE( T,
 A,
 B,
 
)
│ │ │ │ +
│ │ │ │ +Value:
DECL template \
│ │ │ │ +
void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1_coords, \
│ │ │ │ +
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<unsigned int>& grid2_elements, \
│ │ │ │ +
const std::vector<Dune::GeometryType>& grid2_element_types \
│ │ │ │ +
)
│ │ │ │ +
#define DECL
Definition standardmerge.cc:12
│ │ │ │ +
│ │ │ │ +
│ │ │ │ +
│ │ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,41 +1,52 @@ │ │ │ │ │ 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 │ │ │ │ │ -contactmerge.hh File Reference │ │ │ │ │ -Merge two grid boundary surfaces that may be a positive distance apart. _M_o_r_e_._._. │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ │ -#include "_c_o_n_t_a_c_t_m_e_r_g_e_._c_c" │ │ │ │ │ -_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_n_t_a_c_t_M_e_r_g_e_<_ _d_i_m_w_o_r_l_d_,_ _T_ _> │ │ │ │ │ -  Merge two codimension-1 surfaces that may be a positive distance apart. │ │ │ │ │ - _M_o_r_e_._._. │ │ │ │ │ -  │ │ │ │ │ +_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 │ │ │ │ │ +standardmerge.cc File Reference │ │ │ │ │ +#include "config.h" │ │ │ │ │ +#include "_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h" │ │ │ │ │ NNaammeessppaacceess │ │ │ │ │ namespace   _D_u_n_e │ │ │ │ │   │ │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ │   │ │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ │ -Merge two grid boundary surfaces that may be a positive distance apart. │ │ │ │ │ +MMaaccrrooss │ │ │ │ │ +#define  _D_E_C_L │ │ │ │ │ +  │ │ │ │ │ +#define  _S_T_A_N_D_A_R_D___M_E_R_G_E___I_N_S_T_A_N_T_I_A_T_E(T, A, B, C) │ │ │ │ │ +  │ │ │ │ │ +FFuunnccttiioonnss │ │ │ │ │ +  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_T_A_N_D_A_R_D___M_E_R_G_E___I_N_S_T_A_N_T_I_A_T_E (double, 1, 1, 1) │ │ │ │ │ +  │ │ │ │ │ +  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_T_A_N_D_A_R_D___M_E_R_G_E___I_N_S_T_A_N_T_I_A_T_E (double, 2, 2, 2) │ │ │ │ │ +  │ │ │ │ │ +  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_T_A_N_D_A_R_D___M_E_R_G_E___I_N_S_T_A_N_T_I_A_T_E (double, 3, 3, 3) │ │ │ │ │ +  │ │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ │ +********** _?◆_? DDEECCLL ********** │ │ │ │ │ +#define DECL │ │ │ │ │ +********** _?◆_? SSTTAANNDDAARRDD__MMEERRGGEE__IINNSSTTAANNTTIIAATTEE ********** │ │ │ │ │ +#define STANDARD_MERGE_INSTANTIATE (   T, │ │ │ │ │ +   A, │ │ │ │ │ +   B, │ │ │ │ │ +   C  │ │ │ │ │ + ) │ │ │ │ │ +VVaalluuee:: │ │ │ │ │ +_D_E_C_L template \ │ │ │ │ │ +void StandardMerge::build(const std::vector >& │ │ │ │ │ +grid1_coords, \ │ │ │ │ │ +const std::vector& grid1_elements, \ │ │ │ │ │ +const std::vector& grid1_element_types, \ │ │ │ │ │ +const std::vector >& grid2_coords, \ │ │ │ │ │ +const std::vector& grid2_elements, \ │ │ │ │ │ +const std::vector& grid2_element_types \ │ │ │ │ │ +) │ │ │ │ │ +_D_E_C_L │ │ │ │ │ +#define DECL │ │ │ │ │ +DDeeffiinniittiioonn standardmerge.cc:12 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: overlappingmerge.hh File Reference │ │ │ │ +dune-grid-glue: computeintersection.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,45 +71,46 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ Classes | │ │ │ │ -Namespaces
│ │ │ │ -
overlappingmerge.hh File Reference
│ │ │ │ +Namespaces | │ │ │ │ +Functions
│ │ │ │ +
computeintersection.hh File Reference
│ │ │ │ │ │ │ │
│ │ │ │ -
#include <iostream>
│ │ │ │ -#include <iomanip>
│ │ │ │ -#include <vector>
│ │ │ │ -#include <algorithm>
│ │ │ │ +
#include <dune/common/fvector.hh>
│ │ │ │ #include <dune/common/fmatrix.hh>
│ │ │ │ -#include <dune/common/fvector.hh>
│ │ │ │ -#include <dune/geometry/referenceelements.hh>
│ │ │ │ -#include <dune/geometry/multilineargeometry.hh>
│ │ │ │ -#include <dune/grid/common/grid.hh>
│ │ │ │ -#include <dune/grid-glue/merging/standardmerge.hh>
│ │ │ │ -#include <dune/grid-glue/merging/computeintersection.hh>
│ │ │ │ -#include "overlappingmerge.cc"
│ │ │ │ +#include "simplexintersection.cc"
│ │ │ │ +#include "computeintersection.cc"
│ │ │ │
│ │ │ │

Go to the source code of this file.

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

│ │ │ │ Classes

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

│ │ │ │ Namespaces

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

│ │ │ │ +Functions

template<class V >
int Dune::GridGlue::insertPoint (const V p, std::vector< V > &P)
 
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,34 +1,32 @@ │ │ │ │ │ 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 │ │ │ │ │ -overlappingmerge.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 | _F_u_n_c_t_i_o_n_s │ │ │ │ │ +computeintersection.hh File Reference │ │ │ │ │ #include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h> │ │ │ │ │ -#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ -#include "_o_v_e_r_l_a_p_p_i_n_g_m_e_r_g_e_._c_c" │ │ │ │ │ +#include │ │ │ │ │ +#include "_s_i_m_p_l_e_x_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ +#include "_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ _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_:_:_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_ _> │ │ │ │ │ -  Computing overlapping grid intersections for grids of different │ │ │ │ │ - dimensions. _M_o_r_e_._._. │ │ │ │ │ +class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_<_ _d_i_m_W_o_r_l_d_,_ _d_i_m_1_,_ _d_i_m_2_,_ _T_ _> │ │ │ │ │ +  │ │ │ │ │ +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_C_o_m_p_u_t_a_t_i_o_n_<_ _C_M_ _> │ │ │ │ │ +  _I_n_t_e_r_s_e_c_t_i_o_n computation method for two elements of arbitrary │ │ │ │ │ + dimension. _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 │ │ │ │ │ +int  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_s_e_r_t_P_o_i_n_t (const V p, std::vector< V > &P) │ │ │ │ │ +  │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html │ │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: overlappingmerge.hh Source File │ │ │ │ +dune-grid-glue: computeintersection.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,102 +74,190 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ │
│ │ │ │ -
overlappingmerge.hh
│ │ │ │ +
computeintersection.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_MERGING_OVERLAPPINGMERGE_HH
│ │ │ │ -
6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
│ │ │ │ -
7
│ │ │ │ -
8#include <iostream>
│ │ │ │ -
9#include <iomanip>
│ │ │ │ -
10#include <vector>
│ │ │ │ -
11#include <algorithm>
│ │ │ │ -
12
│ │ │ │ -
13#include <dune/common/fmatrix.hh>
│ │ │ │ -
14#include <dune/common/fvector.hh>
│ │ │ │ -
15
│ │ │ │ -
16#include <dune/geometry/referenceelements.hh>
│ │ │ │ -
17#include <dune/geometry/multilineargeometry.hh>
│ │ │ │ -
18
│ │ │ │ -
19#include <dune/grid/common/grid.hh>
│ │ │ │ -
20
│ │ │ │ - │ │ │ │ - │ │ │ │ -
23
│ │ │ │ -
24namespace Dune {
│ │ │ │ -
25namespace GridGlue {
│ │ │ │ -
26
│ │ │ │ -
34template<int dim1, int dim2, int dimworld, typename T = double>
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
36 : public StandardMerge<T,dim1,dim2,dimworld>
│ │ │ │ -
37{
│ │ │ │ -
38
│ │ │ │ -
39public:
│ │ │ │ -
40
│ │ │ │ -
41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */
│ │ │ │ -
42
│ │ │ │ -
44 typedef T ctype;
│ │ │ │ -
45
│ │ │ │ -
47 typedef Dune::FieldVector<T, dimworld> WorldCoords;
│ │ │ │ -
48
│ │ │ │ -
50 //typedef Dune::FieldVector<T, dim> LocalCoords;
│ │ │ │ -
51
│ │ │ │ -
│ │ │ │ - │ │ │ │ -
53 {}
│ │ │ │ -
│ │ │ │ -
54
│ │ │ │ -
55protected:
│ │ │ │ - │ │ │ │ -
57
│ │ │ │ -
69 void computeIntersections(const Dune::GeometryType& grid1ElementType,
│ │ │ │ -
70 const std::vector<Dune::FieldVector<T,dimworld> >& grid1ElementCorners,
│ │ │ │ -
71 std::bitset<(1<<dim1)>& neighborIntersects1,
│ │ │ │ -
72 unsigned int grid1Index,
│ │ │ │ -
73 const Dune::GeometryType& grid2ElementType,
│ │ │ │ -
74 const std::vector<Dune::FieldVector<T,dimworld> >& grid2ElementCorners,
│ │ │ │ -
75 std::bitset<(1<<dim2)>& neighborIntersects2,
│ │ │ │ -
76 unsigned int grid2Index,
│ │ │ │ -
77 std::vector<SimplicialIntersection>& intersections);
│ │ │ │ -
78
│ │ │ │ -
79private:
│ │ │ │ -
80 bool inPlane(std::vector<FieldVector<T,dimworld> >& points);
│ │ │ │ -
81
│ │ │ │ -
82};
│ │ │ │ -
│ │ │ │ -
83
│ │ │ │ -
84} /* namespace Dune::GridGlue */
│ │ │ │ -
85} /* namespace Dune */
│ │ │ │ -
86
│ │ │ │ -
87#include "overlappingmerge.cc"
│ │ │ │ -
88
│ │ │ │ -
89
│ │ │ │ -
90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH
│ │ │ │ - │ │ │ │ - │ │ │ │ -
Common base class for many merger implementations: produce pairs of entities that may intersect.
│ │ │ │ +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_MERGING_COMPUTEINTERSECTION_HH
│ │ │ │ +
4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH
│ │ │ │ +
5
│ │ │ │ +
6#include <dune/common/fvector.hh>
│ │ │ │ +
7#include <dune/common/fmatrix.hh>
│ │ │ │ +
8
│ │ │ │ +
9namespace Dune {
│ │ │ │ +
10namespace GridGlue {
│ │ │ │ +
11
│ │ │ │ +
12template<int dimWorld, int dim1, int dim2, typename T = double>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
14public:
│ │ │ │ +
15 typedef FieldVector<T, dimWorld> Vector;
│ │ │ │ +
16 static const int grid1Dimension = dim1;
│ │ │ │ +
17 static const int grid2Dimension = dim2;
│ │ │ │ +
18 static const int intersectionDimension = (dim1 < dim2)?(dim1):(dim2);
│ │ │ │ +
19
│ │ │ │ +
20 static bool computeIntersectionPoints(const std::vector<Vector> X,
│ │ │ │ +
21 const std::vector<Vector> Y,
│ │ │ │ +
22 std::vector<std::vector<int> >& SX,
│ │ │ │ +
23 std::vector<std::vector<int> >& SY,
│ │ │ │ +
24 std::vector<Vector>& P);
│ │ │ │ +
25 static void grid1_subdivisions(const std::vector<Vector> elementCorners,
│ │ │ │ +
26 std::vector<std::vector<unsigned int> >& subElements,
│ │ │ │ +
27 std::vector<std::vector<int> >& faceIds);
│ │ │ │ +
28 static void grid2_subdivisions(const std::vector<Vector> elementCorners,
│ │ │ │ +
29 std::vector<std::vector<unsigned int> >& subElements,
│ │ │ │ +
30 std::vector<std::vector<int> >& faceIds);
│ │ │ │ +
31};
│ │ │ │ +
│ │ │ │ +
32
│ │ │ │ +
38template<class CM>
│ │ │ │ +
│ │ │ │ + │ │ │ │ +
40private:
│ │ │ │ +
41 typedef typename CM::Vector V;
│ │ │ │ +
42 const int dimWorld = V::dimension;
│ │ │ │ +
43 const int dim1 = CM::grid1Dimension;
│ │ │ │ +
44 const int dim2 = CM::grid2Dimension;
│ │ │ │ +
45public:
│ │ │ │ +
59 static bool computeIntersection(const std::vector<V>& X,
│ │ │ │ +
60 const std::vector<V>& Y,
│ │ │ │ +
61 std::vector<std::vector<int> >& SX,
│ │ │ │ +
62 std::vector<std::vector<int> >& SY,
│ │ │ │ +
63 std::vector<V>& P);
│ │ │ │ +
64
│ │ │ │ +
74 template<int isDim, int dW>
│ │ │ │ +
│ │ │ │ +
75 static void orderPoints(const V& centroid,
│ │ │ │ +
76 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
77 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
78 const std::vector<V>& P,
│ │ │ │ +
79 std::vector<std::vector<int> >& H)
│ │ │ │ +
80 {
│ │ │ │ +
81 if (isDim > 1)
│ │ │ │ +
82 orderPoints_(std::integral_constant<int,isDim>(),std::integral_constant<int,dW>(),
│ │ │ │ +
83 centroid, SX, SY, P,H);
│ │ │ │ +
84 }
│ │ │ │ +
│ │ │ │ +
85
│ │ │ │ +
86private:
│ │ │ │ +
87 static void orderPoints_(std::integral_constant<int,1>,
│ │ │ │ +
88 std::integral_constant<int,1>,
│ │ │ │ +
89 const V& centroid,
│ │ │ │ +
90 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
91 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
92 const std::vector<V>& P,
│ │ │ │ +
93 std::vector<std::vector<int> >& H) {}
│ │ │ │ +
94 static void orderPoints_(std::integral_constant<int,1>,
│ │ │ │ +
95 std::integral_constant<int,2>,
│ │ │ │ +
96 const V& centroid,
│ │ │ │ +
97 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
98 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
99 const std::vector<V>& P,
│ │ │ │ +
100 std::vector<std::vector<int> >& H) {}
│ │ │ │ +
101 static void orderPoints_(std::integral_constant<int,1>,
│ │ │ │ +
102 std::integral_constant<int,3>,
│ │ │ │ +
103 const V& centroid,
│ │ │ │ +
104 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
105 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
106 const std::vector<V>& P,
│ │ │ │ +
107 std::vector<std::vector<int> >& H) {}
│ │ │ │ +
108 static void orderPoints_(std::integral_constant<int,2>,
│ │ │ │ +
109 std::integral_constant<int,2>,
│ │ │ │ +
110 const V& centroid,
│ │ │ │ +
111 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
112 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
113 const std::vector<V>& P,
│ │ │ │ +
114 std::vector<std::vector<int> >& H);
│ │ │ │ +
115 static void orderPoints_(std::integral_constant<int,2>,
│ │ │ │ +
116 std::integral_constant<int,3>,
│ │ │ │ +
117 const V& centroid,
│ │ │ │ +
118 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
119 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
120 const std::vector<V>& P,
│ │ │ │ +
121 std::vector<std::vector<int> >& H);
│ │ │ │ +
122 static void orderPoints_(std::integral_constant<int,3>,
│ │ │ │ +
123 std::integral_constant<int,3>,
│ │ │ │ +
124 const V& centroid,
│ │ │ │ +
125 const std::vector<std::vector<int> >& SX,
│ │ │ │ +
126 const std::vector<std::vector<int> >& SY,
│ │ │ │ +
127 const std::vector<V>& P,
│ │ │ │ +
128 std::vector<std::vector<int> > & H);
│ │ │ │ +
129
│ │ │ │ +
137 static void orderPointsCC(std::integral_constant<int,2>,
│ │ │ │ +
138 const V& centroid,
│ │ │ │ +
139 std::vector<int> &id,
│ │ │ │ +
140 const std::vector<V>& P);
│ │ │ │ +
141 static void orderPointsCC(std::integral_constant<int,3>,
│ │ │ │ +
142 const V& centroid,
│ │ │ │ +
143 std::vector<int> &id,
│ │ │ │ +
144 const std::vector<V>& P);
│ │ │ │ +
145
│ │ │ │ +
150 static void removeDuplicates( std::vector<int> & p);
│ │ │ │ +
151
│ │ │ │ +
159 static bool newFace3D(const std::vector<int>& id,
│ │ │ │ +
160 const std::vector<std::vector<int> >& H);
│ │ │ │ +
161};
│ │ │ │ +
│ │ │ │ +
162
│ │ │ │ +
163template<class V>
│ │ │ │ +
│ │ │ │ +
164inline int insertPoint(const V p, std::vector<V>& P)
│ │ │ │ +
165{
│ │ │ │ +
166 double eps= 1e-8; // tolerance for identical nodes
│ │ │ │ +
167 std::size_t k=0 ;
│ │ │ │ +
168
│ │ │ │ +
169 if (P.size()>0) {
│ │ │ │ +
170
│ │ │ │ +
171 while ((k<P.size())&&
│ │ │ │ +
172 ((p - P[k]).infinity_norm()>eps*(P[k].infinity_norm()) &&
│ │ │ │ +
173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) &&
│ │ │ │ +
174 !(p.infinity_norm() < eps && P[k].infinity_norm() <eps &&
│ │ │ │ +
175 (p - P[k]).infinity_norm() < eps))
│ │ │ │ +
176 k++ ;
│ │ │ │ +
177
│ │ │ │ +
178 if (k>=P.size())
│ │ │ │ +
179 P.push_back(p) ; // new node is not contained in P
│ │ │ │ +
180
│ │ │ │ +
181 }
│ │ │ │ +
182 else
│ │ │ │ +
183 P.push_back(p);
│ │ │ │ +
184
│ │ │ │ +
185 return k ;
│ │ │ │ +
186}
│ │ │ │ +
│ │ │ │ +
187
│ │ │ │ +
188
│ │ │ │ +
189} /* namespace Dune::GridGlue */
│ │ │ │ +
190} /* namespace Dune */
│ │ │ │ +
191
│ │ │ │ +
192#include "simplexintersection.cc"
│ │ │ │ +
193#include "computeintersection.cc"
│ │ │ │ +
194
│ │ │ │ +
195#endif
│ │ │ │ + │ │ │ │ + │ │ │ │
Definition gridglue.hh:37
│ │ │ │ -
Computing overlapping grid intersections for grids of different dimensions.
Definition overlappingmerge.hh:37
│ │ │ │ -
StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection SimplicialIntersection
Definition overlappingmerge.hh:56
│ │ │ │ -
OverlappingMerge()
the coordinate type used in this interface
Definition overlappingmerge.hh:52
│ │ │ │ -
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
│ │ │ │ -
Dune::FieldVector< T, dimworld > WorldCoords
the coordinate type used in this interface
Definition overlappingmerge.hh:47
│ │ │ │ -
T ctype
the numeric type used in this interface
Definition overlappingmerge.hh:44
│ │ │ │ -
Common base class for many merger implementations: produce pairs of entities that may intersect.
Definition standardmerge.hh:58
│ │ │ │ -
typename IntersectionListProvider::SimplicialIntersection SimplicialIntersection
Definition standardmerge.hh:83
│ │ │ │ +
int insertPoint(const V p, std::vector< V > &P)
Definition computeintersection.hh:164
│ │ │ │ +
Definition computeintersection.hh:13
│ │ │ │ +
static void grid2_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
│ │ │ │ +
static bool computeIntersectionPoints(const std::vector< Vector > X, const std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector< std::vector< int > > &SY, std::vector< Vector > &P)
│ │ │ │ +
FieldVector< T, dimWorld > Vector
Definition computeintersection.hh:15
│ │ │ │ +
static const int grid1Dimension
Definition computeintersection.hh:16
│ │ │ │ +
static void grid1_subdivisions(const std::vector< Vector > elementCorners, std::vector< std::vector< unsigned int > > &subElements, std::vector< std::vector< int > > &faceIds)
│ │ │ │ +
static const int grid2Dimension
Definition computeintersection.hh:17
│ │ │ │ +
static const int intersectionDimension
Definition computeintersection.hh:18
│ │ │ │ +
Intersection computation method for two elements of arbitrary dimension.
Definition computeintersection.hh:39
│ │ │ │ +
static void orderPoints(const V &centroid, const std::vector< std::vector< int > > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V > &P, std::vector< std::vector< int > > &H)
Order Points in the point list P face-wise such that a subsimplex subdivision can be constructed.
Definition computeintersection.hh:75
│ │ │ │ +
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
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ │ @@ -1,127 +1,214 @@ │ │ │ │ │ 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 │ │ │ │ │ -overlappingmerge.hh │ │ │ │ │ +computeintersection.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_MERGING_OVERLAPPINGMERGE_HH │ │ │ │ │ -6#define DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH │ │ │ │ │ -7 │ │ │ │ │ -8#include │ │ │ │ │ -9#include │ │ │ │ │ -10#include │ │ │ │ │ -11#include │ │ │ │ │ -12 │ │ │ │ │ -13#include │ │ │ │ │ -14#include │ │ │ │ │ -15 │ │ │ │ │ -16#include │ │ │ │ │ -17#include │ │ │ │ │ -18 │ │ │ │ │ -19#include │ │ │ │ │ -20 │ │ │ │ │ -21#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h> │ │ │ │ │ -22#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_m_e_r_g_i_n_g_/_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ │ -23 │ │ │ │ │ -24namespace _D_u_n_e { │ │ │ │ │ -25namespace GridGlue { │ │ │ │ │ -26 │ │ │ │ │ -34template │ │ │ │ │ -_3_5class _O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e │ │ │ │ │ -36 : public _S_t_a_n_d_a_r_d_M_e_r_g_e │ │ │ │ │ -37{ │ │ │ │ │ -38 │ │ │ │ │ -39public: │ │ │ │ │ -40 │ │ │ │ │ -41 /* E X P O R T E D T Y P E S A N D C O N S T A N T S */ │ │ │ │ │ -42 │ │ │ │ │ -_4_4 typedef T _c_t_y_p_e; │ │ │ │ │ -45 │ │ │ │ │ -_4_7 typedef Dune::FieldVector _W_o_r_l_d_C_o_o_r_d_s; │ │ │ │ │ -48 │ │ │ │ │ -50 //typedef Dune::FieldVector LocalCoords; │ │ │ │ │ -51 │ │ │ │ │ -_5_2 _O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e() │ │ │ │ │ -53 {} │ │ │ │ │ -54 │ │ │ │ │ -55protected: │ │ │ │ │ -_5_6 typedef typename _S_t_a_n_d_a_r_d_M_e_r_g_e_<_T_,_d_i_m_1_,_d_i_m_2_,_d_i_m_w_o_r_l_d_>_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ │ -57 │ │ │ │ │ -69 void _c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_s(const Dune::GeometryType& grid1ElementType, │ │ │ │ │ -70 const std::vector >& grid1ElementCorners, │ │ │ │ │ -71 std::bitset<(1<& neighborIntersects1, │ │ │ │ │ -72 unsigned int grid1Index, │ │ │ │ │ -73 const Dune::GeometryType& grid2ElementType, │ │ │ │ │ -74 const std::vector >& grid2ElementCorners, │ │ │ │ │ -75 std::bitset<(1<& neighborIntersects2, │ │ │ │ │ -76 unsigned int grid2Index, │ │ │ │ │ -77 std::vector& intersections); │ │ │ │ │ -78 │ │ │ │ │ -79private: │ │ │ │ │ -80 bool inPlane(std::vector >& points); │ │ │ │ │ -81 │ │ │ │ │ -82}; │ │ │ │ │ -83 │ │ │ │ │ -84} /* namespace Dune::GridGlue */ │ │ │ │ │ -85} /* namespace Dune */ │ │ │ │ │ -86 │ │ │ │ │ -87#include "_o_v_e_r_l_a_p_p_i_n_g_m_e_r_g_e_._c_c" │ │ │ │ │ -88 │ │ │ │ │ -89 │ │ │ │ │ -90#endif // DUNE_GRIDGLUE_MERGING_OVERLAPPINGMERGE_HH │ │ │ │ │ -_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ │ -_o_v_e_r_l_a_p_p_i_n_g_m_e_r_g_e_._c_c │ │ │ │ │ -_s_t_a_n_d_a_r_d_m_e_r_g_e_._h_h │ │ │ │ │ -Common base class for many merger implementations: produce pairs of entities │ │ │ │ │ -that may intersect. │ │ │ │ │ +3#ifndef DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH │ │ │ │ │ +4#define DUNE_GRIDGLUE_MERGING_COMPUTEINTERSECTION_HH │ │ │ │ │ +5 │ │ │ │ │ +6#include │ │ │ │ │ +7#include │ │ │ │ │ +8 │ │ │ │ │ +9namespace _D_u_n_e { │ │ │ │ │ +10namespace GridGlue { │ │ │ │ │ +11 │ │ │ │ │ +12template │ │ │ │ │ +_1_3class _C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d { │ │ │ │ │ +14public: │ │ │ │ │ +_1_5 typedef FieldVector _V_e_c_t_o_r; │ │ │ │ │ +_1_6 static const int _g_r_i_d_1_D_i_m_e_n_s_i_o_n = dim1; │ │ │ │ │ +_1_7 static const int _g_r_i_d_2_D_i_m_e_n_s_i_o_n = dim2; │ │ │ │ │ +_1_8 static const int _i_n_t_e_r_s_e_c_t_i_o_n_D_i_m_e_n_s_i_o_n = (dim1 < dim2)?(dim1):(dim2); │ │ │ │ │ +19 │ │ │ │ │ +_2_0 static bool _c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_P_o_i_n_t_s(const std::vector X, │ │ │ │ │ +21 const std::vector Y, │ │ │ │ │ +22 std::vector >& SX, │ │ │ │ │ +23 std::vector >& SY, │ │ │ │ │ +24 std::vector& P); │ │ │ │ │ +_2_5 static void _g_r_i_d_1___s_u_b_d_i_v_i_s_i_o_n_s(const std::vector elementCorners, │ │ │ │ │ +26 std::vector >& subElements, │ │ │ │ │ +27 std::vector >& faceIds); │ │ │ │ │ +_2_8 static void _g_r_i_d_2___s_u_b_d_i_v_i_s_i_o_n_s(const std::vector elementCorners, │ │ │ │ │ +29 std::vector >& subElements, │ │ │ │ │ +30 std::vector >& faceIds); │ │ │ │ │ +31}; │ │ │ │ │ +32 │ │ │ │ │ +38template │ │ │ │ │ +_3_9class _I_n_t_e_r_s_e_c_t_i_o_n_C_o_m_p_u_t_a_t_i_o_n { │ │ │ │ │ +40private: │ │ │ │ │ +41 typedef typename CM::Vector V; │ │ │ │ │ +42 const int dimWorld = V::dimension; │ │ │ │ │ +43 const int dim1 = CM::grid1Dimension; │ │ │ │ │ +44 const int dim2 = CM::grid2Dimension; │ │ │ │ │ +45public: │ │ │ │ │ +59 static bool _c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n(const std::vector& X, │ │ │ │ │ +60 const std::vector& Y, │ │ │ │ │ +61 std::vector >& SX, │ │ │ │ │ +62 std::vector >& SY, │ │ │ │ │ +63 std::vector& P); │ │ │ │ │ +64 │ │ │ │ │ +74 template │ │ │ │ │ +_7_5 static void _o_r_d_e_r_P_o_i_n_t_s(const V& centroid, │ │ │ │ │ +76 const std::vector >& SX, │ │ │ │ │ +77 const std::vector >& SY, │ │ │ │ │ +78 const std::vector& P, │ │ │ │ │ +79 std::vector >& H) │ │ │ │ │ +80 { │ │ │ │ │ +81 if (isDim > 1) │ │ │ │ │ +82 orderPoints_(std::integral_constant(),std:: │ │ │ │ │ +integral_constant(), │ │ │ │ │ +83 centroid, SX, SY, P,H); │ │ │ │ │ +84 } │ │ │ │ │ +85 │ │ │ │ │ +86private: │ │ │ │ │ +87 static void orderPoints_(std::integral_constant, │ │ │ │ │ +88 std::integral_constant, │ │ │ │ │ +89 const V& centroid, │ │ │ │ │ +90 const std::vector >& SX, │ │ │ │ │ +91 const std::vector >& SY, │ │ │ │ │ +92 const std::vector& P, │ │ │ │ │ +93 std::vector >& H) {} │ │ │ │ │ +94 static void orderPoints_(std::integral_constant, │ │ │ │ │ +95 std::integral_constant, │ │ │ │ │ +96 const V& centroid, │ │ │ │ │ +97 const std::vector >& SX, │ │ │ │ │ +98 const std::vector >& SY, │ │ │ │ │ +99 const std::vector& P, │ │ │ │ │ +100 std::vector >& H) {} │ │ │ │ │ +101 static void orderPoints_(std::integral_constant, │ │ │ │ │ +102 std::integral_constant, │ │ │ │ │ +103 const V& centroid, │ │ │ │ │ +104 const std::vector >& SX, │ │ │ │ │ +105 const std::vector >& SY, │ │ │ │ │ +106 const std::vector& P, │ │ │ │ │ +107 std::vector >& H) {} │ │ │ │ │ +108 static void orderPoints_(std::integral_constant, │ │ │ │ │ +109 std::integral_constant, │ │ │ │ │ +110 const V& centroid, │ │ │ │ │ +111 const std::vector >& SX, │ │ │ │ │ +112 const std::vector >& SY, │ │ │ │ │ +113 const std::vector& P, │ │ │ │ │ +114 std::vector >& H); │ │ │ │ │ +115 static void orderPoints_(std::integral_constant, │ │ │ │ │ +116 std::integral_constant, │ │ │ │ │ +117 const V& centroid, │ │ │ │ │ +118 const std::vector >& SX, │ │ │ │ │ +119 const std::vector >& SY, │ │ │ │ │ +120 const std::vector& P, │ │ │ │ │ +121 std::vector >& H); │ │ │ │ │ +122 static void orderPoints_(std::integral_constant, │ │ │ │ │ +123 std::integral_constant, │ │ │ │ │ +124 const V& centroid, │ │ │ │ │ +125 const std::vector >& SX, │ │ │ │ │ +126 const std::vector >& SY, │ │ │ │ │ +127 const std::vector& P, │ │ │ │ │ +128 std::vector > & H); │ │ │ │ │ +129 │ │ │ │ │ +137 static void orderPointsCC(std::integral_constant, │ │ │ │ │ +138 const V& centroid, │ │ │ │ │ +139 std::vector &id, │ │ │ │ │ +140 const std::vector& P); │ │ │ │ │ +141 static void orderPointsCC(std::integral_constant, │ │ │ │ │ +142 const V& centroid, │ │ │ │ │ +143 std::vector &id, │ │ │ │ │ +144 const std::vector& P); │ │ │ │ │ +145 │ │ │ │ │ +150 static void removeDuplicates( std::vector & p); │ │ │ │ │ +151 │ │ │ │ │ +159 static bool newFace3D(const std::vector& id, │ │ │ │ │ +160 const std::vector >& H); │ │ │ │ │ +161}; │ │ │ │ │ +162 │ │ │ │ │ +163template │ │ │ │ │ +_1_6_4inline int _i_n_s_e_r_t_P_o_i_n_t(const V p, std::vector& P) │ │ │ │ │ +165{ │ │ │ │ │ +166 double eps= 1e-8; // tolerance for identical nodes │ │ │ │ │ +167 std::size_t k=0 ; │ │ │ │ │ +168 │ │ │ │ │ +169 if (P.size()>0) { │ │ │ │ │ +170 │ │ │ │ │ +171 while ((keps*(P[k].infinity_norm()) && │ │ │ │ │ +173 (p - P[k]).infinity_norm()>eps*(p.infinity_norm())) && │ │ │ │ │ +174 !(p.infinity_norm() < eps && P[k].infinity_norm() =P.size()) │ │ │ │ │ +179 P.push_back(p) ; // new node is not contained in P │ │ │ │ │ +180 │ │ │ │ │ +181 } │ │ │ │ │ +182 else │ │ │ │ │ +183 P.push_back(p); │ │ │ │ │ +184 │ │ │ │ │ +185 return k ; │ │ │ │ │ +186} │ │ │ │ │ +187 │ │ │ │ │ +188 │ │ │ │ │ +189} /* namespace Dune::GridGlue */ │ │ │ │ │ +190} /* namespace Dune */ │ │ │ │ │ +191 │ │ │ │ │ +192#include "_s_i_m_p_l_e_x_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ +193#include "_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._c_c" │ │ │ │ │ +194 │ │ │ │ │ +195#endif │ │ │ │ │ +_c_o_m_p_u_t_e_i_n_t_e_r_s_e_c_t_i_o_n_._c_c │ │ │ │ │ +_s_i_m_p_l_e_x_i_n_t_e_r_s_e_c_t_i_o_n_._c_c │ │ │ │ │ _D_u_n_e │ │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ │ -_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 │ │ │ │ │ -Computing overlapping grid intersections for grids of different dimensions. │ │ │ │ │ -DDeeffiinniittiioonn overlappingmerge.hh:37 │ │ │ │ │ -_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_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -StandardMerge< T, dim1, dim2, dimworld >::SimplicialIntersection │ │ │ │ │ -SimplicialIntersection │ │ │ │ │ -DDeeffiinniittiioonn overlappingmerge.hh:56 │ │ │ │ │ -_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_:_:_O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e │ │ │ │ │ -OverlappingMerge() │ │ │ │ │ -the coordinate type used in this interface │ │ │ │ │ -DDeeffiinniittiioonn overlappingmerge.hh:52 │ │ │ │ │ -_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_:_:_O_v_e_r_l_a_p_p_i_n_g_M_e_r_g_e_:_:_W_o_r_l_d_C_o_o_r_d_s │ │ │ │ │ -Dune::FieldVector< T, dimworld > WorldCoords │ │ │ │ │ -the coordinate type used in this interface │ │ │ │ │ -DDeeffiinniittiioonn overlappingmerge.hh:47 │ │ │ │ │ -_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_t_y_p_e │ │ │ │ │ -T ctype │ │ │ │ │ -the numeric type used in this interface │ │ │ │ │ -DDeeffiinniittiioonn overlappingmerge.hh:44 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_a_n_d_a_r_d_M_e_r_g_e │ │ │ │ │ -Common base class for many merger implementations: produce pairs of entities │ │ │ │ │ -that may intersect. │ │ │ │ │ -DDeeffiinniittiioonn standardmerge.hh:58 │ │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_S_t_a_n_d_a_r_d_M_e_r_g_e_:_:_S_i_m_p_l_i_c_i_a_l_I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ │ -typename IntersectionListProvider::SimplicialIntersection │ │ │ │ │ -SimplicialIntersection │ │ │ │ │ -DDeeffiinniittiioonn standardmerge.hh:83 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_i_n_s_e_r_t_P_o_i_n_t │ │ │ │ │ +int insertPoint(const V p, std::vector< V > &P) │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:164 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:13 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_2___s_u_b_d_i_v_i_s_i_o_n_s │ │ │ │ │ +static void grid2_subdivisions(const std::vector< Vector > elementCorners, │ │ │ │ │ +std::vector< std::vector< unsigned int > > &subElements, std::vector< std:: │ │ │ │ │ +vector< int > > &faceIds) │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_c_o_m_p_u_t_e_I_n_t_e_r_s_e_c_t_i_o_n_P_o_i_n_t_s │ │ │ │ │ +static bool computeIntersectionPoints(const std::vector< Vector > X, const │ │ │ │ │ +std::vector< Vector > Y, std::vector< std::vector< int > > &SX, std::vector< │ │ │ │ │ +std::vector< int > > &SY, std::vector< Vector > &P) │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_V_e_c_t_o_r │ │ │ │ │ +FieldVector< T, dimWorld > Vector │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:15 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_1_D_i_m_e_n_s_i_o_n │ │ │ │ │ +static const int grid1Dimension │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:16 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_1___s_u_b_d_i_v_i_s_i_o_n_s │ │ │ │ │ +static void grid1_subdivisions(const std::vector< Vector > elementCorners, │ │ │ │ │ +std::vector< std::vector< unsigned int > > &subElements, std::vector< std:: │ │ │ │ │ +vector< int > > &faceIds) │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_g_r_i_d_2_D_i_m_e_n_s_i_o_n │ │ │ │ │ +static const int grid2Dimension │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:17 │ │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_C_o_m_p_u_t_a_t_i_o_n_M_e_t_h_o_d_:_:_i_n_t_e_r_s_e_c_t_i_o_n_D_i_m_e_n_s_i_o_n │ │ │ │ │ +static const int intersectionDimension │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:18 │ │ │ │ │ +_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_:_:_o_r_d_e_r_P_o_i_n_t_s │ │ │ │ │ +static void orderPoints(const V ¢roid, const std::vector< std::vector< int │ │ │ │ │ +> > &SX, const std::vector< std::vector< int > > &SY, const std::vector< V > │ │ │ │ │ +&P, std::vector< std::vector< int > > &H) │ │ │ │ │ +Order Points in the point list P face-wise such that a subsimplex subdivision │ │ │ │ │ +can be constructed. │ │ │ │ │ +DDeeffiinniittiioonn computeintersection.hh:75 │ │ │ │ │ +_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 │ │ │ │ │ =============================================================================== │ │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.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
│ │ │ │
│ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │