--- /srv/rebuilderd/tmp/rebuilderdUwKWnZ/inputs/libdune-grid-glue-doc_2.10.0-1_all.deb +++ /srv/rebuilderd/tmp/rebuilderdUwKWnZ/out/libdune-grid-glue-doc_2.10.0-1_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2024-11-14 21:31:44.000000 debian-binary │ --rw-r--r-- 0 0 0 7380 2024-11-14 21:31:44.000000 control.tar.xz │ --rw-r--r-- 0 0 0 951132 2024-11-14 21:31:44.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 7392 2024-11-14 21:31:44.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 951684 2024-11-14 21:31:44.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ │ │ │ ├── line order │ │ │ │ @@ -40,16 +40,16 @@ │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00056.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00056_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html │ │ │ │ -usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html │ │ │ │ +usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html │ │ │ │ usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -5,77 +5,77 @@ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/ │ │ │ -rw-r--r-- 0 root (0) root (0) 945 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/changelog.Debian.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 1193 2024-09-04 15:07:05.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 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/ │ │ │ -rw-r--r-- 0 root (0) root (0) 7139 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html │ │ │ -rw-r--r-- 0 root (0) root (0) 81666 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6158 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14374 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5322 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html │ │ │ --rw-r--r-- 0 root (0) root (0) 16900 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5089 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html │ │ │ --rw-r--r-- 0 root (0) root (0) 16769 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8113 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014.html │ │ │ --rw-r--r-- 0 root (0) root (0) 118079 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5798 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html │ │ │ --rw-r--r-- 0 root (0) root (0) 52528 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10872 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020.html │ │ │ --rw-r--r-- 0 root (0) root (0) 70889 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5454 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html │ │ │ --rw-r--r-- 0 root (0) root (0) 27384 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5610 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html │ │ │ --rw-r--r-- 0 root (0) root (0) 84448 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7371 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html │ │ │ --rw-r--r-- 0 root (0) root (0) 44831 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11614 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html │ │ │ --rw-r--r-- 0 root (0) root (0) 39772 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7676 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11026 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10872 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 70889 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00005_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8113 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 118079 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5454 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 27384 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5798 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 52528 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00014_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5322 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16900 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00017_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5610 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 84448 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00020_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5089 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16769 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00023_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6158 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14374 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7676 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11026 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00029_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8223 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 30067 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00032_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5981 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 27622 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00035_source.html │ │ │ -rw-r--r-- 0 root (0) root (0) 8137 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038.html │ │ │ -rw-r--r-- 0 root (0) root (0) 72682 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00038_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5981 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html │ │ │ --rw-r--r-- 0 root (0) root (0) 27622 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5361 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8501 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8223 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html │ │ │ --rw-r--r-- 0 root (0) root (0) 30067 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6620 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9139 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5430 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053.html │ │ │ --rw-r--r-- 0 root (0) root (0) 44827 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11614 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 39772 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00041_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6620 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9139 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00044_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5361 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8501 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00047_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7371 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 44831 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5389 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 50227 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00053_source.html │ │ │ -rw-r--r-- 0 root (0) root (0) 8207 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056.html │ │ │ -rw-r--r-- 0 root (0) root (0) 94036 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00056_source.html │ │ │ -rw-r--r-- 0 root (0) root (0) 5563 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059.html │ │ │ -rw-r--r-- 0 root (0) root (0) 70754 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00059_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5389 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html │ │ │ --rw-r--r-- 0 root (0) root (0) 50227 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12400 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html │ │ │ --rw-r--r-- 0 root (0) root (0) 149555 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10147 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11544 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html │ │ │ --rw-r--r-- 0 root (0) root (0) 239994 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5931 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html │ │ │ --rw-r--r-- 0 root (0) root (0) 19311 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5485 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html │ │ │ --rw-r--r-- 0 root (0) root (0) 36323 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5358 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html │ │ │ --rw-r--r-- 0 root (0) root (0) 22695 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6081 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html │ │ │ --rw-r--r-- 0 root (0) root (0) 59846 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6349 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html │ │ │ --rw-r--r-- 0 root (0) root (0) 45999 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4560 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089.html │ │ │ --rw-r--r-- 0 root (0) root (0) 63706 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5968 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html │ │ │ --rw-r--r-- 0 root (0) root (0) 37343 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6648 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html │ │ │ --rw-r--r-- 0 root (0) root (0) 36463 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4311 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html │ │ │ --rw-r--r-- 0 root (0) root (0) 55660 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5430 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 44827 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00062_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10147 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00065.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11544 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 239994 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00068_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4560 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 63706 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00071_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5968 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 37343 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00074_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6349 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 45999 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00077_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5931 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 19311 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00080_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12400 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 149555 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00083_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6081 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 59846 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00086_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6648 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 36463 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00089_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4311 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 55660 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00092_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5358 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 22695 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00095_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5485 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 36323 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00098_source.html │ │ │ -rw-r--r-- 0 root (0) root (0) 5860 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00101.html │ │ │ -rw-r--r-- 0 root (0) root (0) 4620 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00103.html │ │ │ -rw-r--r-- 0 root (0) root (0) 67073 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00104.html │ │ │ -rw-r--r-- 0 root (0) root (0) 5775 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00105.html │ │ │ -rw-r--r-- 0 root (0) root (0) 15143 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00106.html │ │ │ -rw-r--r-- 0 root (0) root (0) 13627 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00107.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6281 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00108.html │ │ │ @@ -226,15 +226,15 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 6781 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_65f347cff0208f20f00d27c542208238.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2198 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_65f347cff0208f20f00d27c542208238_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 7641 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_68eff8a27dcb1cd0ff0ecf490070d3de.html │ │ │ -rw-r--r-- 0 root (0) root (0) 13471 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_68eff8a27dcb1cd0ff0ecf490070d3de_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 6671 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_eaad0bdad6fc03850e65b1fdad9faad4.html │ │ │ -rw-r--r-- 0 root (0) root (0) 7018 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dir_eaad0bdad6fc03850e65b1fdad9faad4_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 45631 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/doxygen.css │ │ │ --rw-r--r-- 0 root (0) root (0) 27032 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 27026 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dune-grid-glue.tag.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 7704 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/dynsections.js │ │ │ -rw-r--r-- 0 root (0) root (0) 15974 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/files.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3222 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3787 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_b.html │ │ │ -rw-r--r-- 0 root (0) root (0) 13457 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_c.html │ │ │ -rw-r--r-- 0 root (0) root (0) 4847 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_d.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6113 2024-11-14 21:31:44.000000 ./usr/share/doc/libdune-grid-glue-doc/doxygen/functions_e.html │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002.html │ │ │ @@ -87,28 +87,28 @@ │ │ │ #include <type_traits>
│ │ │ #include <dune/common/deprecated.hh>
│ │ │ #include <dune/common/exceptions.hh>
│ │ │ #include <dune/common/iteratorfacades.hh>
│ │ │ #include <dune/common/promotiontraits.hh>
│ │ │ #include <dune/common/shared_ptr.hh>
│ │ │ #include <dune/common/stdstreams.hh>
│ │ │ -#include "adapter/gridgluecommunicate.hh"
│ │ │ -#include <dune/grid-glue/merging/merger.hh>
│ │ │ +#include "adapter/gridgluecommunicate.hh"
│ │ │ +#include <dune/grid-glue/merging/merger.hh>
│ │ │ #include <dune/common/parallel/mpitraits.hh>
│ │ │ #include <dune/common/parallel/mpicommunication.hh>
│ │ │ #include <dune/common/parallel/indexset.hh>
│ │ │ #include <dune/common/parallel/plocalindex.hh>
│ │ │ #include <dune/common/parallel/remoteindices.hh>
│ │ │ #include <dune/common/parallel/communicator.hh>
│ │ │ #include <dune/common/parallel/interface.hh>
│ │ │ -#include "adapter/rangegenerators.hh"
│ │ │ -#include "adapter/gridglue.cc"
│ │ │ -#include "adapter/intersection.hh"
│ │ │ -#include "adapter/intersectioniterator.hh"
│ │ │ -#include "adapter/intersectionindexset.hh"
│ │ │ +#include "adapter/rangegenerators.hh"
│ │ │ +#include "adapter/gridglue.cc"
│ │ │ +#include "adapter/intersection.hh"
│ │ │ +#include "adapter/intersectioniterator.hh"
│ │ │ +#include "adapter/intersectionindexset.hh"
│ │ │ │ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00002_source.html │ │ │ @@ -95,16 +95,16 @@ │ │ │
19#include <dune/common/deprecated.hh>
│ │ │
20#include <dune/common/exceptions.hh>
│ │ │
21#include <dune/common/iteratorfacades.hh>
│ │ │
22#include <dune/common/promotiontraits.hh>
│ │ │
23#include <dune/common/shared_ptr.hh>
│ │ │
24#include <dune/common/stdstreams.hh>
│ │ │
25
│ │ │ -
26#include "adapter/gridgluecommunicate.hh"
│ │ │ -
27#include <dune/grid-glue/merging/merger.hh>
│ │ │ +
26#include "adapter/gridgluecommunicate.hh"
│ │ │ +
27#include <dune/grid-glue/merging/merger.hh>
│ │ │
28
│ │ │
29#include <dune/common/parallel/mpitraits.hh>
│ │ │
30#include <dune/common/parallel/mpicommunication.hh>
│ │ │
31#include <dune/common/parallel/indexset.hh>
│ │ │
32#include <dune/common/parallel/plocalindex.hh>
│ │ │
33#include <dune/common/parallel/remoteindices.hh>
│ │ │
34#include <dune/common/parallel/communicator.hh>
│ │ │ @@ -391,30 +391,30 @@ │ │ │ │ │ │
399
│ │ │
400} // end namespace GridGlue
│ │ │ │ │ │
401} // end namespace Dune
│ │ │ │ │ │
402
│ │ │ -
403#include "adapter/rangegenerators.hh"
│ │ │ +
403#include "adapter/rangegenerators.hh"
│ │ │
404
│ │ │ -
405#include "adapter/gridglue.cc"
│ │ │ +
405#include "adapter/gridglue.cc"
│ │ │
406
│ │ │ -
407#include "adapter/intersection.hh"
│ │ │ -
408#include "adapter/intersectioniterator.hh"
│ │ │ -
409#include "adapter/intersectionindexset.hh"
│ │ │ +
407#include "adapter/intersection.hh"
│ │ │ +
408#include "adapter/intersectioniterator.hh"
│ │ │ +
409#include "adapter/intersectionindexset.hh"
│ │ │
410
│ │ │
411#endif // DUNE_GRIDGLUE_GRIDGLUE_HH
│ │ │ -
rangegenerators.hh
│ │ │ -
intersectioniterator.hh
Implement iterators over GridGlue intersections.
│ │ │ -
intersectionindexset.hh
│ │ │ -
intersection.hh
Model of the Intersection concept provided by GridGlue.
│ │ │ -
gridgluecommunicate.hh
Describes the parallel communication interface class for Dune::GridGlue.
│ │ │ -
gridglue.cc
│ │ │ -
merger.hh
│ │ │ +
gridgluecommunicate.hh
Describes the parallel communication interface class for Dune::GridGlue.
│ │ │ +
intersection.hh
Model of the Intersection concept provided by GridGlue.
│ │ │ +
intersectioniterator.hh
Implement iterators over GridGlue intersections.
│ │ │ +
gridglue.cc
│ │ │ +
intersectionindexset.hh
│ │ │ +
rangegenerators.hh
│ │ │ +
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 │ │ │ │ -_r_a_n_g_e_g_e_n_e_r_a_t_o_r_s_._h_h │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_i_t_e_r_a_t_o_r_._h_h │ │ │ │ -Implement iterators over GridGlue intersections. │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_i_n_d_e_x_s_e_t_._h_h │ │ │ │ -_i_n_t_e_r_s_e_c_t_i_o_n_._h_h │ │ │ │ -Model of the Intersection concept provided by GridGlue. │ │ │ │ _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_._h_h │ │ │ │ +Model of the Intersection concept provided by GridGlue. │ │ │ │ +_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. │ │ │ │ _g_r_i_d_g_l_u_e_._c_c │ │ │ │ +_i_n_t_e_r_s_e_c_t_i_o_n_i_n_d_e_x_s_e_t_._h_h │ │ │ │ +_r_a_n_g_e_g_e_n_e_r_a_t_o_r_s_._h_h │ │ │ │ _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: rangegenerators.hh File Reference │ │ │ +dune-grid-glue: gridgluecommunicate.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,41 +72,73 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces | │ │ │ +Typedefs | │ │ │ Functions
│ │ │ -
rangegenerators.hh File Reference
│ │ │ +
gridgluecommunicate.hh File Reference
│ │ │
│ │ │
│ │ │ -
#include <dune/common/iteratorrange.hh>
│ │ │ + │ │ │ +

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

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

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

struct  Dune::GridGlue::Reverse< reverse >
struct  Dune::GridGlue::GlobalId
 
class  Dune::GridGlue::CommDataHandle< DataHandleImp, DataTypeImp >
 describes the features of a data handle for communication in parallel runs using the GridGlue::communicate methods. More...
 
class  Dune::GridGlue::StreamingMessageBuffer< DT >
 
class  Dune::GridGlue::CommunicationOperator< dir >
 forward gather scatter to user defined CommInfo class More...
 
struct  Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp >
 collects all GridGlue data required for communication More...
 
struct  Dune::CommPolicy< ::Dune::GridGlue::CommInfo< GG, DataHandleImp, DataTypeImp > >
 specialization of the CommPolicy struct, required for the ParallelIndexsets More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ Namespaces

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

│ │ │ +Typedefs

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

│ │ │ Functions

template<... >
IteratorRange<... > Dune::GridGlue::intersections (const GridGlue<... > &glue, const Reverse<... > &reverse=!reversed)
 Iterate over all intersections of a GridGlue.
 
std::ostream & Dune::GridGlue::operator<< (std::ostream &os, const GlobalId &id)
 
│ │ │ - │ │ │ +

Detailed Description

│ │ │ +

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

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

Implement iterators over GridGlue intersections. │ │ │ +

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

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

Go to the source code of this file.

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

│ │ │ Classes

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

│ │ │ Namespaces

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

│ │ │ +Macros

#define ONLY_SIMPLEX_INTERSECTIONS
 
│ │ │

Detailed Description

│ │ │ -

Implement iterators over GridGlue intersections.

│ │ │ +

Model of the Intersection concept provided by GridGlue.

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

Macro Definition Documentation

│ │ │ + │ │ │ +

◆ ONLY_SIMPLEX_INTERSECTIONS

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
#define ONLY_SIMPLEX_INTERSECTIONS
│ │ │ +
│ │ │ + │ │ │ +
│ │ │ +
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,26 +1,46 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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_._._. │ │ │ │ +_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 │ │ │ │ -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_ _> │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a_<_ _P_0_,_ _P_1_ _> │ │ │ │ +  storage class for _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n related data _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s_<_ _P_0_,_ _P_1_,_ _i_n_s_i_d_e_,_ _o_u_t_s_i_d_e_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_<_ _P_0_,_ _P_1_,_ _I_,_ _O_ _> │ │ │ │ +  The intersection of two entities of the two patches of a _G_r_i_d_G_l_u_e. │ │ │ │ + _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │   │ │ │ │ +MMaaccrrooss │ │ │ │ +#define  _O_N_L_Y___S_I_M_P_L_E_X___I_N_T_E_R_S_E_C_T_I_O_N_S │ │ │ │ +  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Implement iterators over GridGlue intersections. │ │ │ │ +Model of the Intersection concept provided by GridGlue. │ │ │ │ Author │ │ │ │ Christian Engwer │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? OONNLLYY__SSIIMMPPLLEEXX__IINNTTEERRSSEECCTTIIOONNSS ********** │ │ │ │ +#define ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00008_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersectioniterator.hh Source File │ │ │ +dune-grid-glue: intersection.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,95 +74,569 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
intersectioniterator.hh
│ │ │ +
intersection.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 {
│ │ │ -
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 }
│ │ │ -
│ │ │ +
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
│ │ │ +
36 template<typename P0, typename P1>
│ │ │ +
│ │ │ + │ │ │ +
38 {
│ │ │ +
39 public:
│ │ │ +
40 typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
│ │ │ +
41
│ │ │ + │ │ │
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:
│ │ │ +
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 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
│ │ │ +
56 template<int side>
│ │ │ +
57 using GridLocalGeometry = AffineGeometry<
│ │ │ +
58 typename GridGlue::template GridView<side>::ctype, mydim, GridGlue::template GridView<side>::dimension>;
│ │ │ +
59
│ │ │ +
60 using Grid0LocalGeometry [[deprecated("please use GridLocalGeometry<0> instead")]] = GridLocalGeometry<0>;
│ │ │ +
61 using Grid1LocalGeometry [[deprecated("please use GridLocalGeometry<1> instead")]] = GridLocalGeometry<1>;
│ │ │ +
62
│ │ │ +
63 template<int side>
│ │ │ +
64 using GridGeometry = AffineGeometry<
│ │ │ +
65 typename GridGlue::template GridView<side>::ctype, mydim, GridGlue::template GridView<side>::dimensionworld>;
│ │ │ +
66
│ │ │ +
67 using Grid0Geometry [[deprecated("please use GridGeometry<0> instead")]] = GridGeometry<0>;
│ │ │ +
68 using Grid1Geometry [[deprecated("please use GridGeometry<1> instead")]] = GridGeometry<1>;
│ │ │ +
69
│ │ │ +
70 template<int side>
│ │ │ +
71 using GridIndexType = typename GridGlue::template GridView<side>::IndexSet::IndexType;
│ │ │ +
72
│ │ │ +
73 using Grid0IndexType [[deprecated("please use GridIndexType<0> instead")]] = GridIndexType<0>;
│ │ │ +
74 using Grid1IndexType [[deprecated("please use GridIndexType<1> instead")]] = GridIndexType<1>;
│ │ │ +
75
│ │ │ +
77 IntersectionData(const GridGlue& glue, unsigned int mergeindex, unsigned int offset, bool grid0local, bool grid1local);
│ │ │ +
78
│ │ │ +
80 IntersectionData() = default;
│ │ │ +
81
│ │ │ +
82 /* Accessor Functions */
│ │ │ +
83
│ │ │ +
84 template<int side>
│ │ │ +
│ │ │ +
85 const GridLocalGeometry<side>& localGeometry(unsigned int parentId = 0) const
│ │ │ +
86 { return *std::get<side>(sideData_).gridlocalgeom[parentId]; }
│ │ │ +
│ │ │ +
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 const Dune::GeometryType type = Dune::GeometryTypes::simplex(mydim);
│ │ │ +
184#else
│ │ │ +
185#error Not Implemented
│ │ │ +
186#endif
│ │ │ +
187 data.gridlocalgeom[par].emplace(type, corners_element_local);
│ │ │ +
188
│ │ │ +
189 // Add world geometry only for 0th parent
│ │ │ +
190 if (par == 0) {
│ │ │ +
191 typename GridGlue::template GridPatch<side>::Geometry
│ │ │ +
192 gridWorldGeometry = glue.template patch<side>().geometry(data.gridindices[par]);
│ │ │ +
193
│ │ │ +
194 // world coordinates of the remote intersection corners
│ │ │ +
195 std::array<Dune::FieldVector<ctype, GridGlue::template GridView<side>::dimensionworld>, nSimplexCorners> corners_global;
│ │ │ +
196
│ │ │ +
197 for (std::size_t i=0; i<corners_subEntity_local.size(); i++) {
│ │ │ +
198 corners_global[i] = gridWorldGeometry.global(corners_subEntity_local[i]);
│ │ │ +
199 }
│ │ │ +
200
│ │ │ +
201 data.gridgeom.emplace(type, corners_global);
│ │ │ +
202 }
│ │ │ +
203 }
│ │ │ +
204 }
│ │ │ +
205 }
│ │ │ +
206
│ │ │ +
208 template<typename P0, typename P1>
│ │ │ +
│ │ │ +
209 IntersectionData<P0, P1>::IntersectionData(const GridGlue& glue, unsigned int mergeindex, unsigned int offset,
│ │ │ +
210 bool grid0local, bool grid1local)
│ │ │ +
211 : index_(mergeindex+offset)
│ │ │ +
212 {
│ │ │ +
213 // if an invalid index is given do not proceed!
│ │ │ +
214 // (happens when the parent GridGlue initializes the "end"-Intersection)
│ │ │ +
215 assert (0 <= mergeindex || mergeindex < glue.index__sz);
│ │ │ +
216
│ │ │ +
217 std::get<0>(sideData_).gridlocal = grid0local;
│ │ │ +
218 std::get<1>(sideData_).gridlocal = grid1local;
│ │ │ +
219
│ │ │ +
220 initializeGeometry<0>(glue, mergeindex);
│ │ │ +
221 initializeGeometry<1>(glue, mergeindex);
│ │ │ +
222 }
│ │ │ +
│ │ │ +
223
│ │ │ +
228 template<typename P0, typename P1, int inside, int outside>
│ │ │ +
│ │ │ + │ │ │ +
230 {
│ │ │ + │ │ │ + │ │ │ +
233
│ │ │ +
234 using InsideGridView = typename GridGlue::template GridView<inside>;
│ │ │ +
235 using OutsideGridView = typename GridGlue::template GridView<outside>;
│ │ │ +
236
│ │ │ +
237 using InsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<inside>;
│ │ │ +
238 using OutsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<outside>;
│ │ │ +
239
│ │ │ +
240 using Geometry = typename IntersectionData::template GridGeometry<inside>;
│ │ │ +
241 using OutsideGeometry = typename IntersectionData::template GridGeometry<outside>;
│ │ │ +
242
│ │ │ +
243 static constexpr auto coorddim = IntersectionData::coorddim;
│ │ │ +
244 static constexpr auto mydim = IntersectionData::mydim;
│ │ │ +
245 static constexpr int insidePatch = inside;
│ │ │ +
246 static constexpr int outsidePatch = outside;
│ │ │ +
247
│ │ │ +
248 using ctype = typename GridGlue::ctype;
│ │ │ +
249 using LocalCoordinate = Dune::FieldVector<ctype, mydim>;
│ │ │ +
250 using GlobalCoordinate = Dune::FieldVector<ctype, coorddim>;
│ │ │ +
251 };
│ │ │ +
│ │ │ +
252
│ │ │ +
255 template<typename P0, typename P1, int I, int O>
│ │ │ +
│ │ │ + │ │ │ +
257 {
│ │ │ +
258
│ │ │ +
259 public:
│ │ │ +
260
│ │ │ + │ │ │ +
262
│ │ │ +
263 typedef typename Traits::GridGlue GridGlue;
│ │ │ + │ │ │ +
265
│ │ │ +
266
│ │ │ + │ │ │ + │ │ │ +
269
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
273
│ │ │ +
274 typedef typename Traits::Geometry Geometry;
│ │ │ +
275 typedef typename Traits::ctype ctype;
│ │ │ +
276
│ │ │ +
277 typedef typename InsideGridView::Traits::template Codim<0>::Entity InsideEntity;
│ │ │ +
278 typedef typename OutsideGridView::Traits::template Codim<0>::Entity OutsideEntity;
│ │ │ +
279
│ │ │ + │ │ │ + │ │ │ +
282
│ │ │ +
284 static constexpr auto coorddim = Traits::coorddim;
│ │ │ +
285
│ │ │ +
287 static constexpr auto mydim = Traits::mydim;
│ │ │ +
288
│ │ │ +
290 static constexpr int insidePatch = Traits::insidePatch;
│ │ │ +
291
│ │ │ +
293 static constexpr int outsidePatch = Traits::outsidePatch;
│ │ │ +
294
│ │ │ +
295 // typedef unsigned int IndexType;
│ │ │ +
296
│ │ │ +
297 private:
│ │ │ +
301 static constexpr int codimensionWorld = coorddim - mydim;
│ │ │ +
302
│ │ │ +
303 public:
│ │ │ +
304 /* C O N S T R U C T O R S */
│ │ │ +
305
│ │ │ +
│ │ │ +
307 Intersection(const GridGlue* glue, const IntersectionData* i) :
│ │ │ +
308 glue_(glue), i_(i) {}
│ │ │ +
│ │ │ +
309
│ │ │ +
310 /* F U N C T I O N A L I T Y */
│ │ │ +
311
│ │ │ + │ │ │ +
│ │ │ +
315 inside(unsigned int parentId = 0) const
│ │ │ +
316 {
│ │ │ +
317 assert(self());
│ │ │ +
318 return glue_->template patch<I>().element(i_->template index<I>(parentId));
│ │ │ +
319 }
│ │ │ +
│ │ │ +
320
│ │ │ + │ │ │ +
│ │ │ +
324 outside(unsigned int parentId = 0) const
│ │ │ +
325 {
│ │ │ +
326 assert(neighbor());
│ │ │ +
327 return glue_->template patch<O>().element(i_->template index<O>(parentId));
│ │ │ +
328 }
│ │ │ +
│ │ │ +
329
│ │ │ +
│ │ │ +
331 bool conforming() const
│ │ │ +
332 {
│ │ │ +
333 throw Dune::NotImplemented();
│ │ │ +
334 }
│ │ │ +
│ │ │ +
335
│ │ │ +
│ │ │ +
338 const InsideLocalGeometry& geometryInInside(unsigned int parentId = 0) const
│ │ │ +
339 {
│ │ │ +
340 return i_->template localGeometry<I>(parentId);
│ │ │ +
341 }
│ │ │ +
│ │ │ +
342
│ │ │ +
│ │ │ +
345 const OutsideLocalGeometry& geometryInOutside(unsigned int parentId = 0) const
│ │ │ +
346 {
│ │ │ +
347 return i_->template localGeometry<O>(parentId);
│ │ │ +
348 }
│ │ │ +
│ │ │ +
349
│ │ │ +
│ │ │ +
356 const Geometry& geometry() const
│ │ │ +
357 {
│ │ │ +
358 return i_->template geometry<I>();
│ │ │ +
359 }
│ │ │ +
│ │ │ +
360
│ │ │ +
│ │ │ +
367 const OutsideGeometry& geometryOutside() const // DUNE_DEPRECATED
│ │ │ +
368 {
│ │ │ +
369 return i_->template geometry<O>();
│ │ │ +
370 }
│ │ │ +
│ │ │ +
371
│ │ │ +
│ │ │ +
373 Dune::GeometryType type() const
│ │ │ +
374 {
│ │ │ +
375 #ifdef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ +
376 return Dune::GeometryTypes::simplex(mydim);
│ │ │ +
377 #else
│ │ │ +
378 #error Not Implemented
│ │ │ +
379 #endif
│ │ │ +
380 }
│ │ │ +
│ │ │ +
381
│ │ │ +
382
│ │ │ +
│ │ │ +
384 bool self() const
│ │ │ +
385 {
│ │ │ +
386 return i_->template local<I>();
│ │ │ +
387 }
│ │ │ +
│ │ │ +
388
│ │ │ +
│ │ │ +
390 size_t neighbor(unsigned int g = 0) const
│ │ │ +
391 {
│ │ │ +
392 if (g == 0 && i_->template local<O>()) {
│ │ │ +
393 return i_->template parents<O>();
│ │ │ +
394 } else if (g == 1 && i_->template local<I>()) {
│ │ │ +
395 return i_->template parents<I>();
│ │ │ +
396 }
│ │ │ +
397 return 0;
│ │ │ +
398 }
│ │ │ +
│ │ │ +
399
│ │ │ +
│ │ │ +
401 int indexInInside(unsigned int parentId = 0) const
│ │ │ +
402 {
│ │ │ +
403 assert(self());
│ │ │ +
404 return glue_->template patch<I>().indexInInside(i_->template index<I>(parentId));
│ │ │ +
405 }
│ │ │ +
│ │ │ +
406
│ │ │ +
│ │ │ +
408 int indexInOutside(unsigned int parentId = 0) const
│ │ │ +
409 {
│ │ │ +
410 assert(neighbor());
│ │ │ +
411 return glue_->template patch<O>().indexInInside(i_->template index<O>(parentId));
│ │ │ +
412 }
│ │ │ +
│ │ │ +
413
│ │ │ +
│ │ │ + │ │ │ +
419 {
│ │ │ +
420 GlobalCoordinate normal;
│ │ │ +
421
│ │ │ +
422 if (codimensionWorld == 0)
│ │ │ +
423 DUNE_THROW(Dune::Exception, "There is no normal vector to a full-dimensional intersection");
│ │ │ +
424 else if (codimensionWorld == 1) {
│ │ │ +
425 /* TODO: Implement the general n-ary cross product here */
│ │ │ +
426 const auto jacobianTransposed = geometry().jacobianTransposed(local);
│ │ │ +
427 if (mydim==1) {
│ │ │ +
428 normal[0] = - jacobianTransposed[0][1];
│ │ │ +
429 normal[1] = jacobianTransposed[0][0];
│ │ │ +
430 } else if (mydim==2) {
│ │ │ +
431 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][1]);
│ │ │ +
432 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][0]);
│ │ │ +
433 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - jacobianTransposed[0][1] * jacobianTransposed[1][0]);
│ │ │ +
434 } else
│ │ │ +
435 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for " << mydim << "-dimensional intersections yet");
│ │ │ +
436 } else
│ │ │ +
437 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for intersections with codim >= 2 yet");
│ │ │ +
438
│ │ │ +
439 return normal;
│ │ │ +
440 }
│ │ │ +
│ │ │ +
441
│ │ │ +
│ │ │ + │ │ │ +
447 {
│ │ │ +
448 GlobalCoordinate normal = outerNormal(local);
│ │ │ +
449 normal /= normal.two_norm();
│ │ │ +
450 return normal;
│ │ │ +
451 }
│ │ │ +
│ │ │ +
452
│ │ │ +
│ │ │ + │ │ │ +
458 {
│ │ │ +
459 return (unitOuterNormal(local) *= geometry().integrationElement(local));
│ │ │ +
460 }
│ │ │ +
│ │ │ +
461
│ │ │ +
│ │ │ + │ │ │ +
467 {
│ │ │ +
468 return unitOuterNormal(ReferenceElements<ctype,mydim>::general(type()).position(0,0));
│ │ │ +
469 }
│ │ │ +
│ │ │ +
470
│ │ │ +
│ │ │ + │ │ │ +
475 {
│ │ │ +
476 return Intersection<P0,P1,O,I>(glue_,i_);
│ │ │ +
477 }
│ │ │ +
│ │ │ +
478
│ │ │ +
479#ifdef QUICKHACK_INDEX
│ │ │ +
480 typedef typename GridGlue::IndexType IndexType;
│ │ │ +
481
│ │ │ +
482 IndexType index() const
│ │ │ +
483 {
│ │ │ +
484 return i_->index_;
│ │ │ +
485 }
│ │ │ +
486
│ │ │ +
487#endif
│ │ │ +
488
│ │ │ +
489 private:
│ │ │ +
490
│ │ │ +
491 friend class IntersectionIndexSet<P0,P1>;
│ │ │ +
492
│ │ │ +
493 /* M E M B E R V A R I A B L E S */
│ │ │ +
494
│ │ │ +
496 const GridGlue* glue_;
│ │ │ +
497
│ │ │ +
499 const IntersectionData* i_;
│ │ │ +
500 };
│ │ │ +
│ │ │ +
501
│ │ │ +
502
│ │ │ +
503 } // end namespace GridGlue
│ │ │ +
504} // end namespace Dune
│ │ │ +
505
│ │ │ +
506#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTION_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
│ │ │ - │ │ │ -
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
│ │ │ +
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:257
│ │ │ +
Traits::OutsideLocalGeometry OutsideLocalGeometry
Definition intersection.hh:271
│ │ │ +
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition intersection.hh:474
│ │ │ +
bool conforming() const
Return true if intersection is conforming.
Definition intersection.hh:331
│ │ │ +
InsideGridView::Traits::template Codim< 0 >::Entity InsideEntity
Definition intersection.hh:277
│ │ │ +
Traits::GridGlue GridGlue
Definition intersection.hh:263
│ │ │ +
int indexInOutside(unsigned int parentId=0) const
Local number of codim 1 entity in outside() Entity where intersection is contained in.
Definition intersection.hh:408
│ │ │ +
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:401
│ │ │ +
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition intersection.hh:384
│ │ │ +
static constexpr auto mydim
dimension of the intersection
Definition intersection.hh:287
│ │ │ +
static constexpr int outsidePatch
outside patch
Definition intersection.hh:293
│ │ │ +
Dune::GeometryType type() const
Type of reference element for this intersection.
Definition intersection.hh:373
│ │ │ +
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition intersection.hh:315
│ │ │ +
Traits::LocalCoordinate LocalCoordinate
Definition intersection.hh:280
│ │ │ +
const OutsideLocalGeometry & geometryInOutside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the outside() element.
Definition intersection.hh:345
│ │ │ +
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return a unit outer normal.
Definition intersection.hh:446
│ │ │ +
Traits::ctype ctype
Definition intersection.hh:275
│ │ │ +
IntersectionTraits< P0, P1, I, O > Traits
Definition intersection.hh:261
│ │ │ +
Traits::IntersectionData IntersectionData
Definition intersection.hh:264
│ │ │ +
Traits::GlobalCoordinate GlobalCoordinate
Definition intersection.hh:281
│ │ │ +
Traits::OutsideGeometry OutsideGeometry
Definition intersection.hh:272
│ │ │ +
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition intersection.hh:390
│ │ │ +
Intersection(const GridGlue *glue, const IntersectionData *i)
Constructor for a given Dataset.
Definition intersection.hh:307
│ │ │ +
static constexpr int insidePatch
inside patch
Definition intersection.hh:290
│ │ │ +
Traits::Geometry Geometry
Definition intersection.hh:274
│ │ │ +
OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity
Definition intersection.hh:278
│ │ │ +
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition intersection.hh:324
│ │ │ +
const Geometry & geometry() const
Geometric information about this intersection as part of the inside grid.
Definition intersection.hh:356
│ │ │ +
Traits::InsideLocalGeometry InsideLocalGeometry
Definition intersection.hh:268
│ │ │ +
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition intersection.hh:418
│ │ │ +
const OutsideGeometry & geometryOutside() const
Geometric information about this intersection as part of the outside grid.
Definition intersection.hh:367
│ │ │ +
Traits::OutsideGridView OutsideGridView
Definition intersection.hh:270
│ │ │ +
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
Return an outer normal with the length of the integration element.
Definition intersection.hh:457
│ │ │ +
Traits::InsideGridView InsideGridView
Definition intersection.hh:267
│ │ │ +
const InsideLocalGeometry & geometryInInside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the inside() element.
Definition intersection.hh:338
│ │ │ +
GlobalCoordinate centerUnitOuterNormal() const
Unit outer normal at the center of the intersection.
Definition intersection.hh:466
│ │ │ +
static constexpr auto coorddim
dimension of the world space of the intersection
Definition intersection.hh:284
│ │ │ +
Definition intersection.hh:230
│ │ │ +
static constexpr int insidePatch
Definition intersection.hh:245
│ │ │ +
Dune::FieldVector< ctype, mydim > LocalCoordinate
Definition intersection.hh:249
│ │ │ +
static constexpr auto coorddim
Definition intersection.hh:243
│ │ │ +
typename IntersectionData::template GridGeometry< outside > OutsideGeometry
Definition intersection.hh:241
│ │ │ +
typename GridGlue::ctype ctype
Definition intersection.hh:248
│ │ │ +
typename GridGlue::template GridView< outside > OutsideGridView
Definition intersection.hh:235
│ │ │ +
Dune::FieldVector< ctype, coorddim > GlobalCoordinate
Definition intersection.hh:250
│ │ │ +
typename IntersectionData::template GridLocalGeometry< outside > OutsideLocalGeometry
Definition intersection.hh:238
│ │ │ +
typename GridGlue::template GridView< inside > InsideGridView
Definition intersection.hh:234
│ │ │ +
typename IntersectionData::template GridGeometry< inside > Geometry
Definition intersection.hh:240
│ │ │ +
typename IntersectionData::template GridLocalGeometry< inside > InsideLocalGeometry
Definition intersection.hh:237
│ │ │ +
static constexpr int outsidePatch
Definition intersection.hh:246
│ │ │ +
static constexpr auto mydim
Definition intersection.hh:244
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,99 +1,743 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 │ │ │ │ +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// -*- 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 │ │ │ │ -15#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ -16 │ │ │ │ -17namespace _D_u_n_e { │ │ │ │ -18 namespace GridGlue { │ │ │ │ -19 │ │ │ │ -21 template │ │ │ │ -_2_2 class _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r : │ │ │ │ -23 public Dune::ForwardIteratorFacade< │ │ │ │ -IntersectionIterator, │ │ │ │ -24 const Intersection > │ │ │ │ -25 { │ │ │ │ -26 public: │ │ │ │ -27 │ │ │ │ -_2_8 typedef ::Dune::GridGlue::GridGlue _G_r_i_d_G_l_u_e; │ │ │ │ -_2_9 typedef ::Dune::GridGlue::Intersection _I_n_t_e_r_s_e_c_t_i_o_n; │ │ │ │ -30 │ │ │ │ -_3_1 _I_n_t_e_r_s_e_c_t_i_o_n_I_t_e_r_a_t_o_r(const _G_r_i_d_G_l_u_e * glue, unsigned int i) │ │ │ │ -32 : glue_(glue), │ │ │ │ -33 index_(i), │ │ │ │ -34 intersection_(glue_, & glue_->intersections_[index_]) │ │ │ │ -35 {} │ │ │ │ -36 │ │ │ │ -_3_7 const _I_n_t_e_r_s_e_c_t_i_o_n& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ +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 │ │ │ │ +36 template │ │ │ │ +_3_7 class _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ 38 { │ │ │ │ -39 assert(("never dereference the end iterator" && │ │ │ │ -40 index_ != glue_->index__sz)); │ │ │ │ -41 return intersection_; │ │ │ │ -42 } │ │ │ │ +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_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: │ │ │ │ +_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 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 │ │ │ │ +56 template │ │ │ │ +_5_7 using _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y = AffineGeometry< │ │ │ │ +58 typename GridGlue::template GridView::ctype, _m_y_d_i_m, GridGlue::template │ │ │ │ +GridView::dimension>; │ │ │ │ +59 │ │ │ │ +_6_0 using _G_r_i_d_0_L_o_c_a_l_G_e_o_m_e_t_r_y [[deprecated("please use GridLocalGeometry<0> │ │ │ │ +instead")]] = _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_0_>; │ │ │ │ +_6_1 using _G_r_i_d_1_L_o_c_a_l_G_e_o_m_e_t_r_y [[deprecated("please use GridLocalGeometry<1> │ │ │ │ +instead")]] = _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_1_>; │ │ │ │ +62 │ │ │ │ +63 template │ │ │ │ +_6_4 using _G_r_i_d_G_e_o_m_e_t_r_y = AffineGeometry< │ │ │ │ +65 typename GridGlue::template GridView::ctype, _m_y_d_i_m, GridGlue::template │ │ │ │ +GridView::dimensionworld>; │ │ │ │ +66 │ │ │ │ +_6_7 using _G_r_i_d_0_G_e_o_m_e_t_r_y [[deprecated("please use GridGeometry<0> instead")]] = │ │ │ │ +_G_r_i_d_G_e_o_m_e_t_r_y_<_0_>; │ │ │ │ +_6_8 using _G_r_i_d_1_G_e_o_m_e_t_r_y [[deprecated("please use GridGeometry<1> instead")]] = │ │ │ │ +_G_r_i_d_G_e_o_m_e_t_r_y_<_1_>; │ │ │ │ +69 │ │ │ │ +70 template │ │ │ │ +_7_1 using _G_r_i_d_I_n_d_e_x_T_y_p_e = typename GridGlue::template GridView::IndexSet:: │ │ │ │ +IndexType; │ │ │ │ +72 │ │ │ │ +_7_3 using _G_r_i_d_0_I_n_d_e_x_T_y_p_e [[deprecated("please use GridIndexType<0> instead")]] = │ │ │ │ +_G_r_i_d_I_n_d_e_x_T_y_p_e_<_0_>; │ │ │ │ +_7_4 using _G_r_i_d_1_I_n_d_e_x_T_y_p_e [[deprecated("please use GridIndexType<1> instead")]] = │ │ │ │ +_G_r_i_d_I_n_d_e_x_T_y_p_e_<_1_>; │ │ │ │ +75 │ │ │ │ +77 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a(const _G_r_i_d_G_l_u_e& glue, unsigned int mergeindex, unsigned int │ │ │ │ +offset, bool grid0local, bool grid1local); │ │ │ │ +78 │ │ │ │ +_8_0 _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a() = default; │ │ │ │ +81 │ │ │ │ +82 /* Accessor Functions */ │ │ │ │ +83 │ │ │ │ +84 template │ │ │ │ +_8_5 const _G_r_i_d_L_o_c_a_l_G_e_o_m_e_t_r_y_<_s_i_d_e_>& _l_o_c_a_l_G_e_o_m_e_t_r_y(unsigned int parentId = 0) │ │ │ │ +const │ │ │ │ +86 { return *std::get(sideData_).gridlocalgeom[parentId]; } │ │ │ │ +87 │ │ │ │ +88 template │ │ │ │ +_8_9 const _G_r_i_d_G_e_o_m_e_t_r_y_<_s_i_d_e_>& _g_e_o_m_e_t_r_y() const │ │ │ │ +90 { return *std::get(sideData_).gridgeom; } │ │ │ │ +91 │ │ │ │ +92 template │ │ │ │ +_9_3 bool _l_o_c_a_l() const │ │ │ │ +94 { return std::get(sideData_).gridlocal; } │ │ │ │ +95 │ │ │ │ +96 template │ │ │ │ +_9_7 _I_n_d_e_x_T_y_p_e _i_n_d_e_x(unsigned int parentId = 0) const │ │ │ │ +98 { return std::get(sideData_).gridindices[parentId]; } │ │ │ │ +99 │ │ │ │ +100 template │ │ │ │ +_1_0_1 _I_n_d_e_x_T_y_p_e _p_a_r_e_n_t_s() const │ │ │ │ +102 { return std::get(sideData_).gridindices.size(); } │ │ │ │ +103 │ │ │ │ +104 private: │ │ │ │ +105 template │ │ │ │ +106 void initializeGeometry(const _G_r_i_d_G_l_u_e& glue, unsigned mergeindex); │ │ │ │ +107 │ │ │ │ +108 /* M E M B E R V A R I A B L E S */ │ │ │ │ +109 │ │ │ │ +110 public: │ │ │ │ +_1_1_2 _I_n_d_e_x_T_y_p_e _i_n_d_e_x__; │ │ │ │ +113 │ │ │ │ +114 private: │ │ │ │ +115 template │ │ │ │ +116 struct SideData { │ │ │ │ +118 bool gridlocal = false; │ │ │ │ +119 │ │ │ │ +121 std::vector< GridIndexType > gridindices; │ │ │ │ +122 │ │ │ │ +124 std::vector< std::optional< GridLocalGeometry > > gridlocalgeom; │ │ │ │ +125 │ │ │ │ +133 std::optional< GridGeometry > gridgeom; │ │ │ │ +134 }; │ │ │ │ +135 │ │ │ │ +136 std::tuple< SideData<0>, SideData<1> > sideData_; │ │ │ │ +137 }; │ │ │ │ +138 │ │ │ │ +139 template │ │ │ │ +140 template │ │ │ │ +141 void IntersectionData::initializeGeometry(const GridGlue& glue, │ │ │ │ +unsigned mergeindex) │ │ │ │ +142 { │ │ │ │ +143 auto& data = std::get(sideData_); │ │ │ │ +144 │ │ │ │ +145 const unsigned n_parents = glue.merger_->template parents │ │ │ │ +(mergeindex); │ │ │ │ +146 │ │ │ │ +147 // init containers │ │ │ │ +148 data.gridindices.resize(n_parents); │ │ │ │ +149 data.gridlocalgeom.resize(n_parents); │ │ │ │ +150 │ │ │ │ +151 // default values │ │ │ │ +152 data.gridindices[0] = 0; │ │ │ │ +153 │ │ │ │ +154 static constexpr int nSimplexCorners = mydim + 1; │ │ │ │ +155 using ctype = typename _G_r_i_d_G_l_u_e_:_:_c_t_y_p_e; │ │ │ │ +156 │ │ │ │ +157 // initialize the local and the global geometries of grid `side` │ │ │ │ +158 │ │ │ │ +159 // compute the coordinates of the subface's corners in codim 0 entity local │ │ │ │ +coordinates │ │ │ │ +160 static constexpr int elementdim = GridGlue::template GridView:: │ │ │ │ +template Codim<0>::Geometry::mydimension; │ │ │ │ +161 │ │ │ │ +162 // coordinates within the subentity that contains the remote intersection │ │ │ │ +163 std::array() >, nSimplexCorners> │ │ │ │ +corners_subEntity_local; │ │ │ │ +164 │ │ │ │ +165 for (unsigned int par = 0; par < n_parents; ++par) { │ │ │ │ +166 for (int i = 0; i < nSimplexCorners; ++i) │ │ │ │ +167 corners_subEntity_local[i] = glue.merger_->template parentLocal │ │ │ │ +(mergeindex, i, par); │ │ │ │ +168 │ │ │ │ +169 // Coordinates of the remote intersection corners wrt the element │ │ │ │ +coordinate system │ │ │ │ +170 std::array, nSimplexCorners> │ │ │ │ +corners_element_local; │ │ │ │ +171 │ │ │ │ +172 if (data.gridlocal) { │ │ │ │ +173 data.gridindices[par] = glue.merger_->template parent │ │ │ │ +(mergeindex,par); │ │ │ │ +174 │ │ │ │ +175 typename GridGlue::template GridPatch::LocalGeometry │ │ │ │ +176 gridLocalGeometry = glue.template patch().geometryLocal │ │ │ │ +(data.gridindices[par]); │ │ │ │ +177 for (std::size_t i=0; i::Geometry │ │ │ │ +192 gridWorldGeometry = glue.template patch().geometry(data.gridindices │ │ │ │ +[par]); │ │ │ │ +193 │ │ │ │ +194 // world coordinates of the remote intersection corners │ │ │ │ +195 std::array:: │ │ │ │ +dimensionworld>, nSimplexCorners> corners_global; │ │ │ │ +196 │ │ │ │ +197 for (std::size_t i=0; i │ │ │ │ +_2_0_9 _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, │ │ │ │ +210 bool grid0local, bool grid1local) │ │ │ │ +211 : index_(mergeindex+offset) │ │ │ │ +212 { │ │ │ │ +213 // if an invalid index is given do not proceed! │ │ │ │ +214 // (happens when the parent GridGlue initializes the "end"-Intersection) │ │ │ │ +215 assert (0 <= mergeindex || mergeindex < glue.index__sz); │ │ │ │ +216 │ │ │ │ +217 std::get<0>(sideData_).gridlocal = grid0local; │ │ │ │ +218 std::get<1>(sideData_).gridlocal = grid1local; │ │ │ │ +219 │ │ │ │ +220 initializeGeometry<0>(glue, mergeindex); │ │ │ │ +221 initializeGeometry<1>(glue, mergeindex); │ │ │ │ +222 } │ │ │ │ +223 │ │ │ │ +228 template │ │ │ │ +_2_2_9 struct _I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ +230 { │ │ │ │ +_2_3_1 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_2 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_>; │ │ │ │ +233 │ │ │ │ +_2_3_4 using _I_n_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ +_2_3_5 using _O_u_t_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ +236 │ │ │ │ +_2_3_7 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_3_8 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; │ │ │ │ +239 │ │ │ │ +_2_4_0 using _G_e_o_m_e_t_r_y = typename IntersectionData::template GridGeometry; │ │ │ │ +_2_4_1 using _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ +GridGeometry; │ │ │ │ +242 │ │ │ │ +_2_4_3 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_4 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_5 static constexpr int _i_n_s_i_d_e_P_a_t_c_h = inside; │ │ │ │ +_2_4_6 static constexpr int _o_u_t_s_i_d_e_P_a_t_c_h = outside; │ │ │ │ +247 │ │ │ │ +_2_4_8 using _c_t_y_p_e = typename _G_r_i_d_G_l_u_e_:_:_c_t_y_p_e; │ │ │ │ +_2_4_9 using _L_o_c_a_l_C_o_o_r_d_i_n_a_t_e = Dune::FieldVector; │ │ │ │ +_2_5_0 using _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e = Dune::FieldVector; │ │ │ │ +251 }; │ │ │ │ +252 │ │ │ │ +255 template │ │ │ │ +_2_5_6 class _I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ +257 { │ │ │ │ +258 │ │ │ │ +259 public: │ │ │ │ +260 │ │ │ │ +_2_6_1 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; │ │ │ │ +262 │ │ │ │ +_2_6_3 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_4 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; │ │ │ │ +265 │ │ │ │ +266 │ │ │ │ +_2_6_7 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_6_8 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; │ │ │ │ +269 │ │ │ │ +_2_7_0 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_1 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_2 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; │ │ │ │ +273 │ │ │ │ +_2_7_4 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_5 typedef typename _T_r_a_i_t_s_:_:_c_t_y_p_e _c_t_y_p_e; │ │ │ │ +276 │ │ │ │ +_2_7_7 typedef typename InsideGridView::Traits::template Codim<0>::Entity │ │ │ │ +_I_n_s_i_d_e_E_n_t_i_t_y; │ │ │ │ +_2_7_8 typedef typename OutsideGridView::Traits::template Codim<0>::Entity │ │ │ │ +_O_u_t_s_i_d_e_E_n_t_i_t_y; │ │ │ │ +279 │ │ │ │ +_2_8_0 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_1 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; │ │ │ │ +282 │ │ │ │ +_2_8_4 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; │ │ │ │ +285 │ │ │ │ +_2_8_7 static constexpr auto _m_y_d_i_m = _T_r_a_i_t_s_:_:_m_y_d_i_m; │ │ │ │ +288 │ │ │ │ +_2_9_0 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; │ │ │ │ +291 │ │ │ │ +_2_9_3 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; │ │ │ │ +294 │ │ │ │ +295 // typedef unsigned int IndexType; │ │ │ │ +296 │ │ │ │ +297 private: │ │ │ │ +301 static constexpr int codimensionWorld = _c_o_o_r_d_d_i_m - _m_y_d_i_m; │ │ │ │ +302 │ │ │ │ +303 public: │ │ │ │ +304 /* C O N S T R U C T O R S */ │ │ │ │ +305 │ │ │ │ +_3_0_7 _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) : │ │ │ │ +308 glue_(glue), i_(i) {} │ │ │ │ +309 │ │ │ │ +310 /* F U N C T I O N A L I T Y */ │ │ │ │ +311 │ │ │ │ +314 _I_n_s_i_d_e_E_n_t_i_t_y │ │ │ │ +_3_1_5 _i_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ +316 { │ │ │ │ +317 assert(_s_e_l_f()); │ │ │ │ +318 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ +319 } │ │ │ │ +320 │ │ │ │ +323 _O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ +_3_2_4 _o_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ +325 { │ │ │ │ +326 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ +327 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ +328 } │ │ │ │ +329 │ │ │ │ +_3_3_1 bool _c_o_n_f_o_r_m_i_n_g() const │ │ │ │ +332 { │ │ │ │ +333 throw Dune::NotImplemented(); │ │ │ │ +334 } │ │ │ │ +335 │ │ │ │ +_3_3_8 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 │ │ │ │ +339 { │ │ │ │ +340 return i_->template localGeometry(parentId); │ │ │ │ +341 } │ │ │ │ +342 │ │ │ │ +_3_4_5 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 │ │ │ │ +346 { │ │ │ │ +347 return i_->template localGeometry(parentId); │ │ │ │ +348 } │ │ │ │ +349 │ │ │ │ +_3_5_6 const _G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y() const │ │ │ │ +357 { │ │ │ │ +358 return i_->template geometry(); │ │ │ │ +359 } │ │ │ │ +360 │ │ │ │ +_3_6_7 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 │ │ │ │ +368 { │ │ │ │ +369 return i_->template geometry(); │ │ │ │ +370 } │ │ │ │ +371 │ │ │ │ +_3_7_3 Dune::GeometryType _t_y_p_e() const │ │ │ │ +374 { │ │ │ │ +375 #ifdef ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ +376 return Dune::GeometryTypes::simplex(_m_y_d_i_m); │ │ │ │ +377 #else │ │ │ │ +378 #error Not Implemented │ │ │ │ +379 #endif │ │ │ │ +380 } │ │ │ │ +381 │ │ │ │ +382 │ │ │ │ +_3_8_4 bool _s_e_l_f() const │ │ │ │ +385 { │ │ │ │ +386 return i_->template local(); │ │ │ │ +387 } │ │ │ │ +388 │ │ │ │ +_3_9_0 size_t _n_e_i_g_h_b_o_r(unsigned int g = 0) const │ │ │ │ +391 { │ │ │ │ +392 if (g == 0 && i_->template local()) { │ │ │ │ +393 return i_->template parents(); │ │ │ │ +394 } else if (g == 1 && i_->template local()) { │ │ │ │ +395 return i_->template parents(); │ │ │ │ +396 } │ │ │ │ +397 return 0; │ │ │ │ +398 } │ │ │ │ +399 │ │ │ │ +_4_0_1 int _i_n_d_e_x_I_n_I_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ +402 { │ │ │ │ +403 assert(_s_e_l_f()); │ │ │ │ +404 return glue_->template patch().indexInInside(i_->template index │ │ │ │ +(parentId)); │ │ │ │ +405 } │ │ │ │ +406 │ │ │ │ +_4_0_8 int _i_n_d_e_x_I_n_O_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ +409 { │ │ │ │ +410 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ +411 return glue_->template patch().indexInInside(i_->template index │ │ │ │ +(parentId)); │ │ │ │ +412 } │ │ │ │ +413 │ │ │ │ +_4_1_8 _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 │ │ │ │ +419 { │ │ │ │ +420 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e normal; │ │ │ │ +421 │ │ │ │ +422 if (codimensionWorld == 0) │ │ │ │ +423 DUNE_THROW(Dune::Exception, "There is no normal vector to a full- │ │ │ │ +dimensional intersection"); │ │ │ │ +424 else if (codimensionWorld == 1) { │ │ │ │ +425 /* TODO: Implement the general n-ary cross product here */ │ │ │ │ +426 const auto jacobianTransposed = _g_e_o_m_e_t_r_y().jacobianTransposed(local); │ │ │ │ +427 if (_m_y_d_i_m==1) { │ │ │ │ +428 normal[0] = - jacobianTransposed[0][1]; │ │ │ │ +429 normal[1] = jacobianTransposed[0][0]; │ │ │ │ +430 } else if (_m_y_d_i_m==2) { │ │ │ │ +431 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - │ │ │ │ +jacobianTransposed[0][2] * jacobianTransposed[1][1]); │ │ │ │ +432 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - │ │ │ │ +jacobianTransposed[0][2] * jacobianTransposed[1][0]); │ │ │ │ +433 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - │ │ │ │ +jacobianTransposed[0][1] * jacobianTransposed[1][0]); │ │ │ │ +434 } else │ │ │ │ +435 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ +'outerNormal' method for " << _m_y_d_i_m << "-dimensional intersections yet"); │ │ │ │ +436 } else │ │ │ │ +437 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ +'outerNormal' method for intersections with codim >= 2 yet"); │ │ │ │ +438 │ │ │ │ +439 return normal; │ │ │ │ +440 } │ │ │ │ +441 │ │ │ │ +_4_4_6 _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 │ │ │ │ +447 { │ │ │ │ +448 _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); │ │ │ │ +449 normal /= normal.two_norm(); │ │ │ │ +450 return normal; │ │ │ │ +451 } │ │ │ │ +452 │ │ │ │ +_4_5_7 _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 │ │ │ │ +458 { │ │ │ │ +459 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)); │ │ │ │ +460 } │ │ │ │ +461 │ │ │ │ +_4_6_6 _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 │ │ │ │ +467 { │ │ │ │ +468 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)); │ │ │ │ +469 } │ │ │ │ +470 │ │ │ │ +_4_7_4 _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_> _f_l_i_p() const │ │ │ │ +475 { │ │ │ │ +476 return _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_>(glue_,i_); │ │ │ │ +477 } │ │ │ │ +478 │ │ │ │ +479#ifdef QUICKHACK_INDEX │ │ │ │ +480 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e IndexType; │ │ │ │ +481 │ │ │ │ +482 IndexType index() const │ │ │ │ +483 { │ │ │ │ +484 return i_->_i_n_d_e_x__; │ │ │ │ +485 } │ │ │ │ +486 │ │ │ │ +487#endif │ │ │ │ +488 │ │ │ │ +489 private: │ │ │ │ +490 │ │ │ │ +491 friend class IntersectionIndexSet; │ │ │ │ +492 │ │ │ │ +493 /* M E M B E R V A R I A B L E S */ │ │ │ │ +494 │ │ │ │ +496 const _G_r_i_d_G_l_u_e* glue_; │ │ │ │ +497 │ │ │ │ +499 const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a* i_; │ │ │ │ +500 }; │ │ │ │ +501 │ │ │ │ +502 │ │ │ │ +503 } // end namespace GridGlue │ │ │ │ +504} // end namespace Dune │ │ │ │ +505 │ │ │ │ +506#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_:_:_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 │ │ │ │ +_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 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 │ │ │ │ +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:257 │ │ │ │ +_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: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_:_:_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:474 │ │ │ │ +_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:331 │ │ │ │ +_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:277 │ │ │ │ +_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:263 │ │ │ │ +_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:408 │ │ │ │ +_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:401 │ │ │ │ +_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:384 │ │ │ │ +_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:287 │ │ │ │ +_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:293 │ │ │ │ +_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:373 │ │ │ │ +_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:315 │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ +Traits::LocalCoordinate LocalCoordinate │ │ │ │ +DDeeffiinniittiioonn intersection.hh:280 │ │ │ │ +_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:345 │ │ │ │ +_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:446 │ │ │ │ +_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: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_:_:_T_r_a_i_t_s │ │ │ │ +IntersectionTraits< P0, P1, I, O > Traits │ │ │ │ +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_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ +Traits::IntersectionData IntersectionData │ │ │ │ +DDeeffiinniittiioonn intersection.hh:264 │ │ │ │ +_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: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_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y │ │ │ │ +Traits::OutsideGeometry OutsideGeometry │ │ │ │ +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_:_:_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:390 │ │ │ │ +_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:307 │ │ │ │ +_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:290 │ │ │ │ +_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: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_:_:_O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ +OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity │ │ │ │ +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 │ │ │ │ +OutsideEntity outside(unsigned int parentId=0) const │ │ │ │ +Return element on the outside of this intersection. │ │ │ │ +DDeeffiinniittiioonn intersection.hh:324 │ │ │ │ +_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:356 │ │ │ │ +_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: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_:_:_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:418 │ │ │ │ +_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:367 │ │ │ │ +_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:270 │ │ │ │ +_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:457 │ │ │ │ +_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: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_:_:_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:338 │ │ │ │ +_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: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_:_:_c_o_o_r_d_d_i_m │ │ │ │ +static constexpr auto coorddim │ │ │ │ +dimension of the world space of the intersection │ │ │ │ +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_T_r_a_i_t_s │ │ │ │ +DDeeffiinniittiioonn intersection.hh:230 │ │ │ │ +_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: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_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ +Dune::FieldVector< ctype, mydim > LocalCoordinate │ │ │ │ +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_:_:_c_o_o_r_d_d_i_m │ │ │ │ +static constexpr auto coorddim │ │ │ │ +DDeeffiinniittiioonn intersection.hh:243 │ │ │ │ +_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: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_:_:_c_t_y_p_e │ │ │ │ +typename GridGlue::ctype ctype │ │ │ │ +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_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:235 │ │ │ │ +_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: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_:_:_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: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_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ +typename GridGlue::template GridView< inside > InsideGridView │ │ │ │ +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_:_:_G_e_o_m_e_t_r_y │ │ │ │ +typename IntersectionData::template GridGeometry< inside > Geometry │ │ │ │ +DDeeffiinniittiioonn intersection.hh:240 │ │ │ │ +_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:237 │ │ │ │ +_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:246 │ │ │ │ +_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:244 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00011.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: 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.

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

│ │ │ 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/a00011_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:257
│ │ │ -
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.10 │ │ │ │ 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:257 │ │ │ │ -_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/a00014.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::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.10 │ │ │ │ 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/a00014_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: intersection.hh Source File │ │ │ +dune-grid-glue: gridgluevtkwriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,569 +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 const Dune::GeometryType type = Dune::GeometryTypes::simplex(mydim);
│ │ │ -
184#else
│ │ │ -
185#error Not Implemented
│ │ │ -
186#endif
│ │ │ -
187 data.gridlocalgeom[par].emplace(type, corners_element_local);
│ │ │ +
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 // Add world geometry only for 0th parent
│ │ │ -
190 if (par == 0) {
│ │ │ -
191 typename GridGlue::template GridPatch<side>::Geometry
│ │ │ -
192 gridWorldGeometry = glue.template patch<side>().geometry(data.gridindices[par]);
│ │ │ -
193
│ │ │ -
194 // world coordinates of the remote intersection corners
│ │ │ -
195 std::array<Dune::FieldVector<ctype, GridGlue::template GridView<side>::dimensionworld>, nSimplexCorners> corners_global;
│ │ │ -
196
│ │ │ -
197 for (std::size_t i=0; i<corners_subEntity_local.size(); i++) {
│ │ │ -
198 corners_global[i] = gridWorldGeometry.global(corners_subEntity_local[i]);
│ │ │ -
199 }
│ │ │ -
200
│ │ │ -
201 data.gridgeom.emplace(type, corners_global);
│ │ │ -
202 }
│ │ │ -
203 }
│ │ │ -
204 }
│ │ │ -
205 }
│ │ │ -
206
│ │ │ -
208 template<typename P0, typename P1>
│ │ │ -
│ │ │ -
209 IntersectionData<P0, P1>::IntersectionData(const GridGlue& glue, unsigned int mergeindex, unsigned int offset,
│ │ │ -
210 bool grid0local, bool grid1local)
│ │ │ -
211 : index_(mergeindex+offset)
│ │ │ -
212 {
│ │ │ -
213 // if an invalid index is given do not proceed!
│ │ │ -
214 // (happens when the parent GridGlue initializes the "end"-Intersection)
│ │ │ -
215 assert (0 <= mergeindex || mergeindex < glue.index__sz);
│ │ │ -
216
│ │ │ -
217 std::get<0>(sideData_).gridlocal = grid0local;
│ │ │ -
218 std::get<1>(sideData_).gridlocal = grid1local;
│ │ │ +
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 initializeGeometry<0>(glue, mergeindex);
│ │ │ -
221 initializeGeometry<1>(glue, mergeindex);
│ │ │ -
222 }
│ │ │ -
│ │ │ -
223
│ │ │ -
228 template<typename P0, typename P1, int inside, int outside>
│ │ │ -
│ │ │ - │ │ │ -
230 {
│ │ │ - │ │ │ - │ │ │ -
233
│ │ │ -
234 using InsideGridView = typename GridGlue::template GridView<inside>;
│ │ │ -
235 using OutsideGridView = typename GridGlue::template GridView<outside>;
│ │ │ -
236
│ │ │ -
237 using InsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<inside>;
│ │ │ -
238 using OutsideLocalGeometry = typename IntersectionData::template GridLocalGeometry<outside>;
│ │ │ -
239
│ │ │ -
240 using Geometry = typename IntersectionData::template GridGeometry<inside>;
│ │ │ -
241 using OutsideGeometry = typename IntersectionData::template GridGeometry<outside>;
│ │ │ +
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 static constexpr auto coorddim = IntersectionData::coorddim;
│ │ │ -
244 static constexpr auto mydim = IntersectionData::mydim;
│ │ │ -
245 static constexpr int insidePatch = inside;
│ │ │ -
246 static constexpr int outsidePatch = outside;
│ │ │ +
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 using ctype = typename GridGlue::ctype;
│ │ │ -
249 using LocalCoordinate = Dune::FieldVector<ctype, mydim>;
│ │ │ -
250 using GlobalCoordinate = Dune::FieldVector<ctype, coorddim>;
│ │ │ -
251 };
│ │ │ -
│ │ │ +
248 for (int i = 0; i < overlaps; i++)
│ │ │ +
249 fmerged << "10" << std::endl;
│ │ │ +
250
│ │ │ +
251 }
│ │ │
252
│ │ │ -
255 template<typename P0, typename P1, int I, int O>
│ │ │ -
│ │ │ - │ │ │ -
257 {
│ │ │ -
258
│ │ │ -
259 public:
│ │ │ -
260
│ │ │ - │ │ │ -
262
│ │ │ -
263 typedef typename Traits::GridGlue GridGlue;
│ │ │ - │ │ │ -
265
│ │ │ -
266
│ │ │ - │ │ │ - │ │ │ -
269
│ │ │ - │ │ │ - │ │ │ - │ │ │ +
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
│ │ │ -
274 typedef typename Traits::Geometry Geometry;
│ │ │ -
275 typedef typename Traits::ctype ctype;
│ │ │ -
276
│ │ │ -
277 typedef typename InsideGridView::Traits::template Codim<0>::Entity InsideEntity;
│ │ │ -
278 typedef typename OutsideGridView::Traits::template Codim<0>::Entity OutsideEntity;
│ │ │ -
279
│ │ │ - │ │ │ - │ │ │ +
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
│ │ │ -
284 static constexpr auto coorddim = Traits::coorddim;
│ │ │ +
283 writeIntersections<Glue,0>(glue,
│ │ │ +
284 filenameTrunk + "-intersections-grid0.vtk");
│ │ │
285
│ │ │ -
287 static constexpr auto mydim = Traits::mydim;
│ │ │ -
288
│ │ │ -
290 static constexpr int insidePatch = Traits::insidePatch;
│ │ │ -
291
│ │ │ -
293 static constexpr int outsidePatch = Traits::outsidePatch;
│ │ │ -
294
│ │ │ -
295 // typedef unsigned int IndexType;
│ │ │ -
296
│ │ │ -
297 private:
│ │ │ -
301 static constexpr int codimensionWorld = coorddim - mydim;
│ │ │ -
302
│ │ │ -
303 public:
│ │ │ -
304 /* C O N S T R U C T O R S */
│ │ │ -
305
│ │ │ -
│ │ │ -
307 Intersection(const GridGlue* glue, const IntersectionData* i) :
│ │ │ -
308 glue_(glue), i_(i) {}
│ │ │ -
│ │ │ -
309
│ │ │ -
310 /* F U N C T I O N A L I T Y */
│ │ │ -
311
│ │ │ - │ │ │ -
│ │ │ -
315 inside(unsigned int parentId = 0) const
│ │ │ -
316 {
│ │ │ -
317 assert(self());
│ │ │ -
318 return glue_->template patch<I>().element(i_->template index<I>(parentId));
│ │ │ -
319 }
│ │ │ -
│ │ │ -
320
│ │ │ - │ │ │ -
│ │ │ -
324 outside(unsigned int parentId = 0) const
│ │ │ -
325 {
│ │ │ -
326 assert(neighbor());
│ │ │ -
327 return glue_->template patch<O>().element(i_->template index<O>(parentId));
│ │ │ -
328 }
│ │ │ -
│ │ │ -
329
│ │ │ -
│ │ │ -
331 bool conforming() const
│ │ │ -
332 {
│ │ │ -
333 throw Dune::NotImplemented();
│ │ │ -
334 }
│ │ │ -
│ │ │ -
335
│ │ │ -
│ │ │ -
338 const InsideLocalGeometry& geometryInInside(unsigned int parentId = 0) const
│ │ │ -
339 {
│ │ │ -
340 return i_->template localGeometry<I>(parentId);
│ │ │ -
341 }
│ │ │ -
│ │ │ -
342
│ │ │ -
│ │ │ -
345 const OutsideLocalGeometry& geometryInOutside(unsigned int parentId = 0) const
│ │ │ -
346 {
│ │ │ -
347 return i_->template localGeometry<O>(parentId);
│ │ │ -
348 }
│ │ │ +
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 }
│ │ │
│ │ │ -
349
│ │ │ -
│ │ │ -
356 const Geometry& geometry() const
│ │ │ -
357 {
│ │ │ -
358 return i_->template geometry<I>();
│ │ │ -
359 }
│ │ │ -
│ │ │ -
360
│ │ │ -
│ │ │ -
367 const OutsideGeometry& geometryOutside() const // DUNE_DEPRECATED
│ │ │ -
368 {
│ │ │ -
369 return i_->template geometry<O>();
│ │ │ -
370 }
│ │ │ -
│ │ │ -
371
│ │ │ -
│ │ │ -
373 Dune::GeometryType type() const
│ │ │ -
374 {
│ │ │ -
375 #ifdef ONLY_SIMPLEX_INTERSECTIONS
│ │ │ -
376 return Dune::GeometryTypes::simplex(mydim);
│ │ │ -
377 #else
│ │ │ -
378 #error Not Implemented
│ │ │ -
379 #endif
│ │ │ -
380 }
│ │ │ -
│ │ │ -
381
│ │ │ -
382
│ │ │ -
│ │ │ -
384 bool self() const
│ │ │ -
385 {
│ │ │ -
386 return i_->template local<I>();
│ │ │ -
387 }
│ │ │ -
│ │ │ -
388
│ │ │ -
│ │ │ -
390 size_t neighbor(unsigned int g = 0) const
│ │ │ -
391 {
│ │ │ -
392 if (g == 0 && i_->template local<O>()) {
│ │ │ -
393 return i_->template parents<O>();
│ │ │ -
394 } else if (g == 1 && i_->template local<I>()) {
│ │ │ -
395 return i_->template parents<I>();
│ │ │ -
396 }
│ │ │ -
397 return 0;
│ │ │ -
398 }
│ │ │ -
│ │ │ -
399
│ │ │ -
│ │ │ -
401 int indexInInside(unsigned int parentId = 0) const
│ │ │ -
402 {
│ │ │ -
403 assert(self());
│ │ │ -
404 return glue_->template patch<I>().indexInInside(i_->template index<I>(parentId));
│ │ │ -
405 }
│ │ │ -
│ │ │ -
406
│ │ │ -
│ │ │ -
408 int indexInOutside(unsigned int parentId = 0) const
│ │ │ -
409 {
│ │ │ -
410 assert(neighbor());
│ │ │ -
411 return glue_->template patch<O>().indexInInside(i_->template index<O>(parentId));
│ │ │ -
412 }
│ │ │ -
│ │ │ -
413
│ │ │ -
│ │ │ - │ │ │ -
419 {
│ │ │ -
420 GlobalCoordinate normal;
│ │ │ -
421
│ │ │ -
422 if (codimensionWorld == 0)
│ │ │ -
423 DUNE_THROW(Dune::Exception, "There is no normal vector to a full-dimensional intersection");
│ │ │ -
424 else if (codimensionWorld == 1) {
│ │ │ -
425 /* TODO: Implement the general n-ary cross product here */
│ │ │ -
426 const auto jacobianTransposed = geometry().jacobianTransposed(local);
│ │ │ -
427 if (mydim==1) {
│ │ │ -
428 normal[0] = - jacobianTransposed[0][1];
│ │ │ -
429 normal[1] = jacobianTransposed[0][0];
│ │ │ -
430 } else if (mydim==2) {
│ │ │ -
431 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][1]);
│ │ │ -
432 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - jacobianTransposed[0][2] * jacobianTransposed[1][0]);
│ │ │ -
433 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - jacobianTransposed[0][1] * jacobianTransposed[1][0]);
│ │ │ -
434 } else
│ │ │ -
435 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for " << mydim << "-dimensional intersections yet");
│ │ │ -
436 } else
│ │ │ -
437 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the 'outerNormal' method for intersections with codim >= 2 yet");
│ │ │ -
438
│ │ │ -
439 return normal;
│ │ │ -
440 }
│ │ │ -
│ │ │ -
441
│ │ │ -
│ │ │ - │ │ │ -
447 {
│ │ │ -
448 GlobalCoordinate normal = outerNormal(local);
│ │ │ -
449 normal /= normal.two_norm();
│ │ │ -
450 return normal;
│ │ │ -
451 }
│ │ │ -
│ │ │ -
452
│ │ │ -
│ │ │ - │ │ │ -
458 {
│ │ │ -
459 return (unitOuterNormal(local) *= geometry().integrationElement(local));
│ │ │ -
460 }
│ │ │ -
│ │ │ -
461
│ │ │ -
│ │ │ - │ │ │ -
467 {
│ │ │ -
468 return unitOuterNormal(ReferenceElements<ctype,mydim>::general(type()).position(0,0));
│ │ │ -
469 }
│ │ │ -
│ │ │ -
470
│ │ │ -
│ │ │ - │ │ │ -
475 {
│ │ │ -
476 return Intersection<P0,P1,O,I>(glue_,i_);
│ │ │ -
477 }
│ │ │ -
│ │ │ -
478
│ │ │ -
479#ifdef QUICKHACK_INDEX
│ │ │ -
480 typedef typename GridGlue::IndexType IndexType;
│ │ │ -
481
│ │ │ -
482 IndexType index() const
│ │ │ -
483 {
│ │ │ -
484 return i_->index_;
│ │ │ -
485 }
│ │ │ -
486
│ │ │ -
487#endif
│ │ │ -
488
│ │ │ -
489 private:
│ │ │ -
490
│ │ │ -
491 friend class IntersectionIndexSet<P0,P1>;
│ │ │ -
492
│ │ │ -
493 /* M E M B E R V A R I A B L E S */
│ │ │ -
494
│ │ │ -
496 const GridGlue* glue_;
│ │ │ -
497
│ │ │ -
499 const IntersectionData* i_;
│ │ │ -
500 };
│ │ │ +
294
│ │ │ +
295};
│ │ │
│ │ │ -
501
│ │ │ -
502
│ │ │ -
503 } // end namespace GridGlue
│ │ │ -
504} // end namespace Dune
│ │ │ -
505
│ │ │ -
506#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:257
│ │ │ -
Traits::OutsideLocalGeometry OutsideLocalGeometry
Definition intersection.hh:271
│ │ │ -
Intersection< P0, P1, O, I > flip() const
Return a copy of the intersection with inside and outside switched.
Definition intersection.hh:474
│ │ │ -
bool conforming() const
Return true if intersection is conforming.
Definition intersection.hh:331
│ │ │ -
InsideGridView::Traits::template Codim< 0 >::Entity InsideEntity
Definition intersection.hh:277
│ │ │ -
Traits::GridGlue GridGlue
Definition intersection.hh:263
│ │ │ -
int indexInOutside(unsigned int parentId=0) const
Local number of codim 1 entity in outside() Entity where intersection is contained in.
Definition intersection.hh:408
│ │ │ -
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:401
│ │ │ -
bool self() const
For parallel computations: Return true if inside() entity exists locally.
Definition intersection.hh:384
│ │ │ -
static constexpr auto mydim
dimension of the intersection
Definition intersection.hh:287
│ │ │ -
static constexpr int outsidePatch
outside patch
Definition intersection.hh:293
│ │ │ -
Dune::GeometryType type() const
Type of reference element for this intersection.
Definition intersection.hh:373
│ │ │ -
InsideEntity inside(unsigned int parentId=0) const
Return element on the inside of this intersection.
Definition intersection.hh:315
│ │ │ -
Traits::LocalCoordinate LocalCoordinate
Definition intersection.hh:280
│ │ │ -
const OutsideLocalGeometry & geometryInOutside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the outside() element.
Definition intersection.hh:345
│ │ │ -
GlobalCoordinate unitOuterNormal(const LocalCoordinate &local) const
Return a unit outer normal.
Definition intersection.hh:446
│ │ │ -
Traits::ctype ctype
Definition intersection.hh:275
│ │ │ -
IntersectionTraits< P0, P1, I, O > Traits
Definition intersection.hh:261
│ │ │ -
Traits::IntersectionData IntersectionData
Definition intersection.hh:264
│ │ │ -
Traits::GlobalCoordinate GlobalCoordinate
Definition intersection.hh:281
│ │ │ -
Traits::OutsideGeometry OutsideGeometry
Definition intersection.hh:272
│ │ │ -
size_t neighbor(unsigned int g=0) const
Return number of embeddings into local grid0 (grid1) entities.
Definition intersection.hh:390
│ │ │ -
Intersection(const GridGlue *glue, const IntersectionData *i)
Constructor for a given Dataset.
Definition intersection.hh:307
│ │ │ -
static constexpr int insidePatch
inside patch
Definition intersection.hh:290
│ │ │ -
Traits::Geometry Geometry
Definition intersection.hh:274
│ │ │ -
OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity
Definition intersection.hh:278
│ │ │ -
OutsideEntity outside(unsigned int parentId=0) const
Return element on the outside of this intersection.
Definition intersection.hh:324
│ │ │ -
const Geometry & geometry() const
Geometric information about this intersection as part of the inside grid.
Definition intersection.hh:356
│ │ │ -
Traits::InsideLocalGeometry InsideLocalGeometry
Definition intersection.hh:268
│ │ │ -
GlobalCoordinate outerNormal(const LocalCoordinate &local) const
Return an outer normal (length not necessarily 1)
Definition intersection.hh:418
│ │ │ -
const OutsideGeometry & geometryOutside() const
Geometric information about this intersection as part of the outside grid.
Definition intersection.hh:367
│ │ │ -
Traits::OutsideGridView OutsideGridView
Definition intersection.hh:270
│ │ │ -
GlobalCoordinate integrationOuterNormal(const LocalCoordinate &local) const
Return an outer normal with the length of the integration element.
Definition intersection.hh:457
│ │ │ -
Traits::InsideGridView InsideGridView
Definition intersection.hh:267
│ │ │ -
const InsideLocalGeometry & geometryInInside(unsigned int parentId=0) const
Geometric information about this intersection in local coordinates of the inside() element.
Definition intersection.hh:338
│ │ │ -
GlobalCoordinate centerUnitOuterNormal() const
Unit outer normal at the center of the intersection.
Definition intersection.hh:466
│ │ │ -
static constexpr auto coorddim
dimension of the world space of the intersection
Definition intersection.hh:284
│ │ │ -
Definition intersection.hh:230
│ │ │ -
static constexpr int insidePatch
Definition intersection.hh:245
│ │ │ -
Dune::FieldVector< ctype, mydim > LocalCoordinate
Definition intersection.hh:249
│ │ │ -
static constexpr auto coorddim
Definition intersection.hh:243
│ │ │ -
typename IntersectionData::template GridGeometry< outside > OutsideGeometry
Definition intersection.hh:241
│ │ │ -
typename GridGlue::ctype ctype
Definition intersection.hh:248
│ │ │ -
typename GridGlue::template GridView< outside > OutsideGridView
Definition intersection.hh:235
│ │ │ -
Dune::FieldVector< ctype, coorddim > GlobalCoordinate
Definition intersection.hh:250
│ │ │ -
typename IntersectionData::template GridLocalGeometry< outside > OutsideLocalGeometry
Definition intersection.hh:238
│ │ │ -
typename GridGlue::template GridView< inside > InsideGridView
Definition intersection.hh:234
│ │ │ -
typename IntersectionData::template GridGeometry< inside > Geometry
Definition intersection.hh:240
│ │ │ -
typename IntersectionData::template GridLocalGeometry< inside > InsideLocalGeometry
Definition intersection.hh:237
│ │ │ -
static constexpr int outsidePatch
Definition intersection.hh:246
│ │ │ -
static constexpr auto mydim
Definition intersection.hh:244
│ │ │ +
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:256
│ │ │ +
static constexpr auto dim
Definition extractor.hh:51
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,743 +1,349 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 │ │ │ │ +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 // Add world geometry only for 0th parent │ │ │ │ -190 if (par == 0) { │ │ │ │ -191 typename GridGlue::template GridPatch::Geometry │ │ │ │ -192 gridWorldGeometry = glue.template patch().geometry(data.gridindices │ │ │ │ -[par]); │ │ │ │ -193 │ │ │ │ -194 // world coordinates of the remote intersection corners │ │ │ │ -195 std::array:: │ │ │ │ -dimensionworld>, nSimplexCorners> corners_global; │ │ │ │ -196 │ │ │ │ -197 for (std::size_t i=0; i │ │ │ │ -_2_0_9 _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, │ │ │ │ -210 bool grid0local, bool grid1local) │ │ │ │ -211 : index_(mergeindex+offset) │ │ │ │ -212 { │ │ │ │ -213 // if an invalid index is given do not proceed! │ │ │ │ -214 // (happens when the parent GridGlue initializes the "end"-Intersection) │ │ │ │ -215 assert (0 <= mergeindex || mergeindex < glue.index__sz); │ │ │ │ -216 │ │ │ │ -217 std::get<0>(sideData_).gridlocal = grid0local; │ │ │ │ -218 std::get<1>(sideData_).gridlocal = grid1local; │ │ │ │ +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 initializeGeometry<0>(glue, mergeindex); │ │ │ │ -221 initializeGeometry<1>(glue, mergeindex); │ │ │ │ -222 } │ │ │ │ -223 │ │ │ │ -228 template │ │ │ │ -_2_2_9 struct _I_n_t_e_r_s_e_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ -230 { │ │ │ │ -_2_3_1 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_2 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_>; │ │ │ │ -233 │ │ │ │ -_2_3_4 using _I_n_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ -_2_3_5 using _O_u_t_s_i_d_e_G_r_i_d_V_i_e_w = typename GridGlue::template GridView; │ │ │ │ -236 │ │ │ │ -_2_3_7 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_3_8 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; │ │ │ │ -239 │ │ │ │ -_2_4_0 using _G_e_o_m_e_t_r_y = typename IntersectionData::template GridGeometry; │ │ │ │ -_2_4_1 using _O_u_t_s_i_d_e_G_e_o_m_e_t_r_y = typename IntersectionData::template │ │ │ │ -GridGeometry; │ │ │ │ +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; │ │ │ │ -_2_5_0 using _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e = Dune::FieldVector; │ │ │ │ -251 }; │ │ │ │ +248 for (int i = 0; i < overlaps; i++) │ │ │ │ +249 fmerged << "10" << std::endl; │ │ │ │ +250 │ │ │ │ +251 } │ │ │ │ 252 │ │ │ │ -255 template │ │ │ │ -_2_5_6 class _I_n_t_e_r_s_e_c_t_i_o_n │ │ │ │ -257 { │ │ │ │ -258 │ │ │ │ -259 public: │ │ │ │ -260 │ │ │ │ -_2_6_1 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; │ │ │ │ -262 │ │ │ │ -_2_6_3 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_4 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; │ │ │ │ -265 │ │ │ │ -266 │ │ │ │ -_2_6_7 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_6_8 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; │ │ │ │ -269 │ │ │ │ -_2_7_0 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_1 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_2 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; │ │ │ │ +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() << " 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_:_:_G_e_o_m_e_t_r_y _G_e_o_m_e_t_r_y; │ │ │ │ -_2_7_5 typedef typename _T_r_a_i_t_s_:_:_c_t_y_p_e _c_t_y_p_e; │ │ │ │ -276 │ │ │ │ -_2_7_7 typedef typename InsideGridView::Traits::template Codim<0>::Entity │ │ │ │ -_I_n_s_i_d_e_E_n_t_i_t_y; │ │ │ │ -_2_7_8 typedef typename OutsideGridView::Traits::template Codim<0>::Entity │ │ │ │ -_O_u_t_s_i_d_e_E_n_t_i_t_y; │ │ │ │ -279 │ │ │ │ -_2_8_0 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_1 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; │ │ │ │ +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 │ │ │ │ -_2_8_4 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; │ │ │ │ +283 writeIntersections(glue, │ │ │ │ +284 filenameTrunk + "-intersections-grid0.vtk"); │ │ │ │ 285 │ │ │ │ -_2_8_7 static constexpr auto _m_y_d_i_m = _T_r_a_i_t_s_:_:_m_y_d_i_m; │ │ │ │ -288 │ │ │ │ -_2_9_0 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; │ │ │ │ -291 │ │ │ │ -_2_9_3 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; │ │ │ │ +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 // typedef unsigned int IndexType; │ │ │ │ +295}; │ │ │ │ 296 │ │ │ │ -297 private: │ │ │ │ -301 static constexpr int codimensionWorld = _c_o_o_r_d_d_i_m - _m_y_d_i_m; │ │ │ │ -302 │ │ │ │ -303 public: │ │ │ │ -304 /* C O N S T R U C T O R S */ │ │ │ │ -305 │ │ │ │ -_3_0_7 _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) : │ │ │ │ -308 glue_(glue), i_(i) {} │ │ │ │ -309 │ │ │ │ -310 /* F U N C T I O N A L I T Y */ │ │ │ │ -311 │ │ │ │ -314 _I_n_s_i_d_e_E_n_t_i_t_y │ │ │ │ -_3_1_5 _i_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ -316 { │ │ │ │ -317 assert(_s_e_l_f()); │ │ │ │ -318 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ -319 } │ │ │ │ -320 │ │ │ │ -323 _O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ -_3_2_4 _o_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ -325 { │ │ │ │ -326 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ -327 return glue_->template patch().element(i_->template index(parentId)); │ │ │ │ -328 } │ │ │ │ -329 │ │ │ │ -_3_3_1 bool _c_o_n_f_o_r_m_i_n_g() const │ │ │ │ -332 { │ │ │ │ -333 throw Dune::NotImplemented(); │ │ │ │ -334 } │ │ │ │ -335 │ │ │ │ -_3_3_8 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 │ │ │ │ -339 { │ │ │ │ -340 return i_->template localGeometry(parentId); │ │ │ │ -341 } │ │ │ │ -342 │ │ │ │ -_3_4_5 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 │ │ │ │ -346 { │ │ │ │ -347 return i_->template localGeometry(parentId); │ │ │ │ -348 } │ │ │ │ -349 │ │ │ │ -_3_5_6 const _G_e_o_m_e_t_r_y& _g_e_o_m_e_t_r_y() const │ │ │ │ -357 { │ │ │ │ -358 return i_->template geometry(); │ │ │ │ -359 } │ │ │ │ -360 │ │ │ │ -_3_6_7 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 │ │ │ │ -368 { │ │ │ │ -369 return i_->template geometry(); │ │ │ │ -370 } │ │ │ │ -371 │ │ │ │ -_3_7_3 Dune::GeometryType _t_y_p_e() const │ │ │ │ -374 { │ │ │ │ -375 #ifdef ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ -376 return Dune::GeometryTypes::simplex(_m_y_d_i_m); │ │ │ │ -377 #else │ │ │ │ -378 #error Not Implemented │ │ │ │ -379 #endif │ │ │ │ -380 } │ │ │ │ -381 │ │ │ │ -382 │ │ │ │ -_3_8_4 bool _s_e_l_f() const │ │ │ │ -385 { │ │ │ │ -386 return i_->template local(); │ │ │ │ -387 } │ │ │ │ -388 │ │ │ │ -_3_9_0 size_t _n_e_i_g_h_b_o_r(unsigned int g = 0) const │ │ │ │ -391 { │ │ │ │ -392 if (g == 0 && i_->template local()) { │ │ │ │ -393 return i_->template parents(); │ │ │ │ -394 } else if (g == 1 && i_->template local()) { │ │ │ │ -395 return i_->template parents(); │ │ │ │ -396 } │ │ │ │ -397 return 0; │ │ │ │ -398 } │ │ │ │ -399 │ │ │ │ -_4_0_1 int _i_n_d_e_x_I_n_I_n_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ -402 { │ │ │ │ -403 assert(_s_e_l_f()); │ │ │ │ -404 return glue_->template patch().indexInInside(i_->template index │ │ │ │ -(parentId)); │ │ │ │ -405 } │ │ │ │ -406 │ │ │ │ -_4_0_8 int _i_n_d_e_x_I_n_O_u_t_s_i_d_e(unsigned int parentId = 0) const │ │ │ │ -409 { │ │ │ │ -410 assert(_n_e_i_g_h_b_o_r()); │ │ │ │ -411 return glue_->template patch().indexInInside(i_->template index │ │ │ │ -(parentId)); │ │ │ │ -412 } │ │ │ │ -413 │ │ │ │ -_4_1_8 _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 │ │ │ │ -419 { │ │ │ │ -420 _G_l_o_b_a_l_C_o_o_r_d_i_n_a_t_e normal; │ │ │ │ -421 │ │ │ │ -422 if (codimensionWorld == 0) │ │ │ │ -423 DUNE_THROW(Dune::Exception, "There is no normal vector to a full- │ │ │ │ -dimensional intersection"); │ │ │ │ -424 else if (codimensionWorld == 1) { │ │ │ │ -425 /* TODO: Implement the general n-ary cross product here */ │ │ │ │ -426 const auto jacobianTransposed = _g_e_o_m_e_t_r_y().jacobianTransposed(local); │ │ │ │ -427 if (_m_y_d_i_m==1) { │ │ │ │ -428 normal[0] = - jacobianTransposed[0][1]; │ │ │ │ -429 normal[1] = jacobianTransposed[0][0]; │ │ │ │ -430 } else if (_m_y_d_i_m==2) { │ │ │ │ -431 normal[0] = (jacobianTransposed[0][1] * jacobianTransposed[1][2] - │ │ │ │ -jacobianTransposed[0][2] * jacobianTransposed[1][1]); │ │ │ │ -432 normal[1] = - (jacobianTransposed[0][0] * jacobianTransposed[1][2] - │ │ │ │ -jacobianTransposed[0][2] * jacobianTransposed[1][0]); │ │ │ │ -433 normal[2] = (jacobianTransposed[0][0] * jacobianTransposed[1][1] - │ │ │ │ -jacobianTransposed[0][1] * jacobianTransposed[1][0]); │ │ │ │ -434 } else │ │ │ │ -435 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ -'outerNormal' method for " << _m_y_d_i_m << "-dimensional intersections yet"); │ │ │ │ -436 } else │ │ │ │ -437 DUNE_THROW(Dune::NotImplemented, "Remote intersections don't implement the │ │ │ │ -'outerNormal' method for intersections with codim >= 2 yet"); │ │ │ │ -438 │ │ │ │ -439 return normal; │ │ │ │ -440 } │ │ │ │ -441 │ │ │ │ -_4_4_6 _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 │ │ │ │ -447 { │ │ │ │ -448 _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); │ │ │ │ -449 normal /= normal.two_norm(); │ │ │ │ -450 return normal; │ │ │ │ -451 } │ │ │ │ -452 │ │ │ │ -_4_5_7 _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 │ │ │ │ -458 { │ │ │ │ -459 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)); │ │ │ │ -460 } │ │ │ │ -461 │ │ │ │ -_4_6_6 _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 │ │ │ │ -467 { │ │ │ │ -468 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)); │ │ │ │ -469 } │ │ │ │ -470 │ │ │ │ -_4_7_4 _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_> _f_l_i_p() const │ │ │ │ -475 { │ │ │ │ -476 return _I_n_t_e_r_s_e_c_t_i_o_n_<_P_0_,_P_1_,_O_,_I_>(glue_,i_); │ │ │ │ -477 } │ │ │ │ -478 │ │ │ │ -479#ifdef QUICKHACK_INDEX │ │ │ │ -480 typedef typename _G_r_i_d_G_l_u_e_:_:_I_n_d_e_x_T_y_p_e IndexType; │ │ │ │ -481 │ │ │ │ -482 IndexType index() const │ │ │ │ -483 { │ │ │ │ -484 return i_->_i_n_d_e_x__; │ │ │ │ -485 } │ │ │ │ -486 │ │ │ │ -487#endif │ │ │ │ -488 │ │ │ │ -489 private: │ │ │ │ -490 │ │ │ │ -491 friend class IntersectionIndexSet; │ │ │ │ -492 │ │ │ │ -493 /* M E M B E R V A R I A B L E S */ │ │ │ │ -494 │ │ │ │ -496 const _G_r_i_d_G_l_u_e* glue_; │ │ │ │ -497 │ │ │ │ -499 const _I_n_t_e_r_s_e_c_t_i_o_n_D_a_t_a* i_; │ │ │ │ -500 }; │ │ │ │ -501 │ │ │ │ -502 │ │ │ │ -503 } // end namespace GridGlue │ │ │ │ -504} // end namespace Dune │ │ │ │ -505 │ │ │ │ -506#endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTION_HH │ │ │ │ +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:257 │ │ │ │ -_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: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_:_:_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:474 │ │ │ │ -_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:331 │ │ │ │ -_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:277 │ │ │ │ -_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:263 │ │ │ │ -_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:408 │ │ │ │ -_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:401 │ │ │ │ -_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:384 │ │ │ │ -_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:287 │ │ │ │ -_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:293 │ │ │ │ -_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:373 │ │ │ │ -_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:315 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ -Traits::LocalCoordinate LocalCoordinate │ │ │ │ -DDeeffiinniittiioonn intersection.hh:280 │ │ │ │ -_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:345 │ │ │ │ -_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:446 │ │ │ │ -_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: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_:_:_T_r_a_i_t_s │ │ │ │ -IntersectionTraits< P0, P1, I, O > Traits │ │ │ │ -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_t_e_r_s_e_c_t_i_o_n_D_a_t_a │ │ │ │ -Traits::IntersectionData IntersectionData │ │ │ │ -DDeeffiinniittiioonn intersection.hh:264 │ │ │ │ -_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: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_:_:_O_u_t_s_i_d_e_G_e_o_m_e_t_r_y │ │ │ │ -Traits::OutsideGeometry OutsideGeometry │ │ │ │ -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_:_:_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:390 │ │ │ │ -_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:307 │ │ │ │ -_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:290 │ │ │ │ -_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: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_:_:_O_u_t_s_i_d_e_E_n_t_i_t_y │ │ │ │ -OutsideGridView::Traits::template Codim< 0 >::Entity OutsideEntity │ │ │ │ -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 │ │ │ │ -OutsideEntity outside(unsigned int parentId=0) const │ │ │ │ -Return element on the outside of this intersection. │ │ │ │ -DDeeffiinniittiioonn intersection.hh:324 │ │ │ │ -_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:356 │ │ │ │ -_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: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_:_:_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:418 │ │ │ │ -_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:367 │ │ │ │ -_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:270 │ │ │ │ -_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:457 │ │ │ │ -_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: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_:_:_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:338 │ │ │ │ -_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: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_:_:_c_o_o_r_d_d_i_m │ │ │ │ -static constexpr auto coorddim │ │ │ │ -dimension of the world space of the intersection │ │ │ │ -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_T_r_a_i_t_s │ │ │ │ -DDeeffiinniittiioonn intersection.hh:230 │ │ │ │ -_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: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_:_:_L_o_c_a_l_C_o_o_r_d_i_n_a_t_e │ │ │ │ -Dune::FieldVector< ctype, mydim > LocalCoordinate │ │ │ │ -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_:_:_c_o_o_r_d_d_i_m │ │ │ │ -static constexpr auto coorddim │ │ │ │ -DDeeffiinniittiioonn intersection.hh:243 │ │ │ │ -_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: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_:_:_c_t_y_p_e │ │ │ │ -typename GridGlue::ctype ctype │ │ │ │ -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_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:235 │ │ │ │ -_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: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_:_:_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: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_:_:_I_n_s_i_d_e_G_r_i_d_V_i_e_w │ │ │ │ -typename GridGlue::template GridView< inside > InsideGridView │ │ │ │ -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_:_:_G_e_o_m_e_t_r_y │ │ │ │ -typename IntersectionData::template GridGeometry< inside > Geometry │ │ │ │ -DDeeffiinniittiioonn intersection.hh:240 │ │ │ │ -_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:237 │ │ │ │ -_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:246 │ │ │ │ -_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: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_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:256 │ │ │ │ +_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/a00017.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridgluevtkwriter.hh File Reference │ │ │ +dune-grid-glue: intersectioniterator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,46 +72,39 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ -
gridgluevtkwriter.hh File Reference
│ │ │ +
intersectioniterator.hh File Reference
│ │ │
│ │ │
│ │ │ │ │ │ -

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

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

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

Go to the source code of this file.

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

│ │ │ Classes

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

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::GridGlue
 
│ │ │

Detailed Description

│ │ │ -

Write all remote intersections to a vtk file for debugging.

│ │ │ +

Implement iterators over GridGlue intersections.

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

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

│ │ │ -
#include <type_traits>
│ │ │ -#include <dune/common/bartonnackmanifcheck.hh>
│ │ │ -#include <dune/common/parallel/communicator.hh>
│ │ │ -#include <dune/grid/common/datahandleif.hh>
│ │ │ -#include <dune/grid/common/gridenums.hh>
│ │ │ +
#include "intersection.hh"
│ │ │ +#include <vector>
│ │ │ +#include <iterator>
│ │ │ +#include "../gridglue.hh"
│ │ │ +#include "../common/ringcomm.hh"
│ │ │ +#include <dune/common/unused.hh>
│ │ │
│ │ │

Go to the source code of this file.

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

│ │ │ -Classes

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

│ │ │ Namespaces

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

│ │ │ -Typedefs

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

│ │ │ Functions

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

Detailed Description

│ │ │ -

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

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

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

│ │ │ -
#include <fstream>
│ │ │ -#include <sstream>
│ │ │ -#include <type_traits>
│ │ │ +
#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::GridGlueAmiraWriter
 Write remote intersections to a AmiraMesh 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 AmiraMesh file.

│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -2,27 +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 │ │ │ │ -gridglueamirawriter.hh File Reference │ │ │ │ -Write all remote intersections to a AmiraMesh file. _M_o_r_e_._._. │ │ │ │ -#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_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_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 AmiraMesh file. │ │ │ │ =============================================================================== │ │ │ │ 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: gridglueamirawriter.hh Source File │ │ │ +dune-grid-glue: intersectionindexset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,166 +74,87 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
gridglueamirawriter.hh
│ │ │ +
intersectionindexset.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
│ │ │ -
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>
│ │ │ +
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 {
│ │ │ -
16namespace GridGlue {
│ │ │ +
16 namespace 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");
│ │ │ +
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;
│ │ │
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;
│ │ │ +
33 template<int I, int O>
│ │ │ +
│ │ │ + │ │ │ +
35 {
│ │ │ +
36 return i.i_->index_;
│ │ │ +
37 }
│ │ │ +
│ │ │
38
│ │ │ -
39 // coordinates have to be in R^3 in the VTK format
│ │ │ -
40 std::string coordinatePadding;
│ │ │ -
41 for (int i=domdimw; i<3; i++)
│ │ │ -
42 coordinatePadding += " 0";
│ │ │ -
43
│ │ │ -
44 int overlaps = glue.size();
│ │ │ +
│ │ │ +
41 SizeType size () const
│ │ │ +
42 {
│ │ │ +
43 return glue_->size();
│ │ │ +
44 }
│ │ │ +
│ │ │
45
│ │ │ -
46 if (dim==3) {
│ │ │ +
46 private:
│ │ │
47
│ │ │ -
48 fgrid << "# HyperSurface 0.1 ASCII \n" << std::endl;
│ │ │ -
49 fgrid<<"\n";
│ │ │ -
50 fgrid<<"Parameters {\n";
│ │ │ -
51 fgrid<<" Materials {\n";
│ │ │ -
52 fgrid<<" outside {\n";
│ │ │ -
53 fgrid<<" Id 0\n";
│ │ │ -
54 fgrid<<" }\n";
│ │ │ -
55 fgrid<<" inside {\n";
│ │ │ -
56 fgrid<<" Id 1\n";
│ │ │ -
57 fgrid<<" }\n";
│ │ │ -
58 fgrid<<" }\n";
│ │ │ -
59 fgrid<<"\n";
│ │ │ -
60 fgrid<<"}\n";
│ │ │ -
61
│ │ │ -
62 // ////////////////////////////////////////////
│ │ │ -
63 // Write vertices
│ │ │ -
64 // ////////////////////////////////////////////
│ │ │ -
65
│ │ │ -
66 //use dim and not dim+1
│ │ │ -
67 fgrid<<"\nVertices "<< overlaps*(dim)<<"\n";
│ │ │ -
68 auto isEnd = glue.template iend<side>();
│ │ │ -
69 for (auto isIt = glue.template ibegin<side>(); isIt != isEnd; ++isIt)
│ │ │ -
70 {
│ │ │ -
71 const auto& geometry = isIt->geometry();
│ │ │ -
72 for (int i = 0; i < geometry.corners(); ++i)
│ │ │ -
73 fgrid << geometry.corner(i) << coordinatePadding << std::endl;
│ │ │ -
74 }
│ │ │ -
75
│ │ │ -
76 // ////////////////////////////////////////////
│ │ │ -
77 // Write triangles
│ │ │ -
78 // ////////////////////////////////////////////
│ │ │ -
79
│ │ │ -
80 fgrid<<"NBranchingPoints 0\n";
│ │ │ -
81 fgrid<<"NVerticesOnCurves 0\n";
│ │ │ -
82 fgrid<<"BoundaryCurves 0\n";
│ │ │ -
83 fgrid<<"Patches 1\n";
│ │ │ -
84 fgrid<<"{\n";
│ │ │ -
85 fgrid<<"InnerRegion inside\n";
│ │ │ -
86 fgrid<<"OuterRegion outside\n";
│ │ │ -
87 fgrid<<"BoundaryID 0\n";
│ │ │ -
88 fgrid<<"BranchingPoints 0";
│ │ │ -
89 fgrid<<"\n";
│ │ │ -
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
│ │ │ + │ │ │ +
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.
│ │ │
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
│ │ │ +
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:257
│ │ │ +
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,165 +1,105 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 │ │ │ │ +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// 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 │ │ │ │ -8#ifndef DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH │ │ │ │ -9#define DUNE_GRIDGLUE_ADAPTER_GRIDGLUEAMIRAWRITER_HH │ │ │ │ -10 │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ +3#ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ +4#define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONINDEXSET_HH │ │ │ │ +5 │ │ │ │ +6#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_g_r_i_d_g_l_u_e_._h_h> │ │ │ │ +7#include <_d_u_n_e_/_g_r_i_d_-_g_l_u_e_/_a_d_a_p_t_e_r_/_i_n_t_e_r_s_e_c_t_i_o_n_._h_h> │ │ │ │ +8 │ │ │ │ +9#ifndef ONLY_SIMPLEX_INTERSECTIONS │ │ │ │ +10// we currently support only one intersection type. If we want to support │ │ │ │ +more, │ │ │ │ +11// we have to think about the semantics of our IndexSet │ │ │ │ +12#error Not Implemented │ │ │ │ +13#endif │ │ │ │ 14 │ │ │ │ 15namespace _D_u_n_e { │ │ │ │ -16namespace GridGlue { │ │ │ │ +16 namespace _G_r_i_d_G_l_u_e { │ │ │ │ 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"); │ │ │ │ +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; │ │ │ │ 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; │ │ │ │ +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 │ │ │ │ -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(); │ │ │ │ +_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 if (dim==3) { │ │ │ │ +46 private: │ │ │ │ 47 │ │ │ │ -48 fgrid << "# HyperSurface 0.1 ASCII \n" << std::endl; │ │ │ │ -49 fgrid<<"\n"; │ │ │ │ -50 fgrid<<"Parameters {\n"; │ │ │ │ -51 fgrid<<" Materials {\n"; │ │ │ │ -52 fgrid<<" outside {\n"; │ │ │ │ -53 fgrid<<" Id 0\n"; │ │ │ │ -54 fgrid<<" }\n"; │ │ │ │ -55 fgrid<<" inside {\n"; │ │ │ │ -56 fgrid<<" Id 1\n"; │ │ │ │ -57 fgrid<<" }\n"; │ │ │ │ -58 fgrid<<" }\n"; │ │ │ │ -59 fgrid<<"\n"; │ │ │ │ -60 fgrid<<"}\n"; │ │ │ │ -61 │ │ │ │ -62 // //////////////////////////////////////////// │ │ │ │ -63 // Write vertices │ │ │ │ -64 // //////////////////////////////////////////// │ │ │ │ -65 │ │ │ │ -66 //use dim and not dim+1 │ │ │ │ -67 fgrid<<"\nVertices "<< overlaps*(dim)<<"\n"; │ │ │ │ -68 auto isEnd = glue.template iend(); │ │ │ │ -69 for (auto isIt = glue.template ibegin(); isIt != isEnd; ++isIt) │ │ │ │ -70 { │ │ │ │ -71 const auto& geometry = isIt->geometry(); │ │ │ │ -72 for (int i = 0; i < geometry.corners(); ++i) │ │ │ │ -73 fgrid << geometry.corner(i) << coordinatePadding << std::endl; │ │ │ │ -74 } │ │ │ │ -75 │ │ │ │ -76 // //////////////////////////////////////////// │ │ │ │ -77 // Write triangles │ │ │ │ -78 // //////////////////////////////////////////// │ │ │ │ -79 │ │ │ │ -80 fgrid<<"NBranchingPoints 0\n"; │ │ │ │ -81 fgrid<<"NVerticesOnCurves 0\n"; │ │ │ │ -82 fgrid<<"BoundaryCurves 0\n"; │ │ │ │ -83 fgrid<<"Patches 1\n"; │ │ │ │ -84 fgrid<<"{\n"; │ │ │ │ -85 fgrid<<"InnerRegion inside\n"; │ │ │ │ -86 fgrid<<"OuterRegion outside\n"; │ │ │ │ -87 fgrid<<"BoundaryID 0\n"; │ │ │ │ -88 fgrid<<"BranchingPoints 0"; │ │ │ │ -89 fgrid<<"\n"; │ │ │ │ -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 │ │ │ │ +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. │ │ │ │ _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_:_:_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:257 │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:20 │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_s_i_z_e │ │ │ │ +SizeType size() const │ │ │ │ +Return total number of intersections. │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:41 │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_I_n_d_e_x_T_y_p_e │ │ │ │ +GridGlue::IndexType IndexType │ │ │ │ +The type used for the indices. │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:27 │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_i_n_d_e_x │ │ │ │ +IndexType index(const Intersection< P0, P1, I, O > &i) const │ │ │ │ +Map Dune::GridGlue::Intersection to index. │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:34 │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_I_n_t_e_r_s_e_c_t_i_o_n_I_n_d_e_x_S_e_t_:_:_S_i_z_e_T_y_p_e │ │ │ │ +size_t SizeType │ │ │ │ +The type used for the size. │ │ │ │ +DDeeffiinniittiioonn intersectionindexset.hh:29 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00026.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: gridglue.cc File Reference │ │ │ +dune-grid-glue: rangegenerators.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,40 +70,42 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ +Classes | │ │ │ Namespaces | │ │ │ Functions
│ │ │ -
gridglue.cc File Reference
│ │ │ +
rangegenerators.hh File Reference
│ │ │
│ │ │
│ │ │ -
#include "intersection.hh"
│ │ │ -#include <vector>
│ │ │ -#include <iterator>
│ │ │ -#include "../gridglue.hh"
│ │ │ -#include "../common/ringcomm.hh"
│ │ │ -#include <dune/common/unused.hh>
│ │ │ +
#include <dune/common/iteratorrange.hh>
│ │ │
│ │ │

Go to the source code of this file.

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

│ │ │ +Classes

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

│ │ │ Namespaces

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

│ │ │ Functions

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

Macro Definition Documentation

│ │ │ - │ │ │ -

◆ CheckMPIStatus

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define CheckMPIStatus( A,
 
)   {}
│ │ │ -
│ │ │ -
Todo:
Implement MPI Status check with exception handling
│ │ │ - │ │ │ -
│ │ │ -
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,39 +1,37 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 │ │ │ │ +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" │ │ │ │ _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 (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. │ │ │ │   │ │ │ │ -********** 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/a00029_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: ringcomm.hh Source File │ │ │ +dune-grid-glue: projectionwriter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,309 +74,57 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
ringcomm.hh
│ │ │ +
projectionwriter.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>
│ │ │ +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
│ │ │ +
5
│ │ │ +
6#include <iostream>
│ │ │ +
7#include <string>
│ │ │ +
8
│ │ │ + │ │ │ +
10
│ │ │ +
11namespace Dune {
│ │ │ +
12namespace GridGlue {
│ │ │
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 actual 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
│ │ │ +
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 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(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,308 +1,62 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ * _c_o_m_m_o_n │ │ │ │ -ringcomm.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// -*- 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 │ │ │ │ +3#ifndef DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_HH │ │ │ │ +4#define DUNE_GRIDGLUE_COMMON_PROJECTIONWRITER_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 │ │ │ │ -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 actual 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 &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/a00032.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projectionwriter_impl.hh File Reference │ │ │ +dune-grid-glue: areawriter_impl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,61 +70,56 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ +Classes | │ │ │ Namespaces | │ │ │ Functions
│ │ │ -
projectionwriter_impl.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::ProjectionWriterImplementation
namespace  Dune::GridGlue::AreaWriterImplementation
 
│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ 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 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,60 +1,43 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 │ │ │ │ +_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_:_:_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_:_:_A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │   │ │ │ │ FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___p_o_i_n_t_s (const │ │ │ │ - _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const Corners &corners, std:: │ │ │ │ - ostream &out) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___n_o_r_m_a_l_s (const │ │ │ │ - _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const Normals &normals, std:: │ │ │ │ - ostream &out) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ - _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___p_o_i_n_t_s (const _P_r_o_j_e_c_t_i_o_n< Coordinate > │ │ │ │ - &projection, const Corners &corners, std::ostream &out) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_: │ │ │ │ - _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___n_o_r_m_a_l_s (const _P_r_o_j_e_c_t_i_o_n< Coordinate > │ │ │ │ - &projection, const Normals &normals, std::ostream &out) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___s_u_c_c_e_s_s (const │ │ │ │ - _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, std::ostream &out) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ - Corners &corners, const Normals &normals, std::ostream &out) │ │ │ │ -  write projection in VTK format │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ - Corners &corners, const Normals &normals, const std::string &filename) │ │ │ │ -  write projection in VTK format │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t (const _P_r_o_j_e_c_t_i_o_n< Coordinate > &projection, const │ │ │ │ - Corners &corners, const Normals &normals) │ │ │ │ -  Print information about the projection to std::cout stream. │ │ │ │ +template │ │ │ │ +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/a00032_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projectionwriter_impl.hh Source File │ │ │ +dune-grid-glue: areawriter_impl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,211 +74,183 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
projectionwriter_impl.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#include <fstream>
│ │ │ -
4
│ │ │ -
5namespace Dune {
│ │ │ -
6namespace GridGlue {
│ │ │ -
7
│ │ │ -
│ │ │ -
8namespace ProjectionWriterImplementation {
│ │ │ +
4#include <vector>
│ │ │ +
5
│ │ │ +
6#include <dune/common/fvector.hh>
│ │ │ +
7#include <dune/geometry/type.hh>
│ │ │ +
8#include <dune/grid/common/mcmgmapper.hh>
│ │ │
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}
│ │ │ -
│ │ │ -
41
│ │ │ -
42template<typename Coordinate, typename Corners>
│ │ │ -
│ │ │ -
43void write_edge_intersection_points(const Projection<Coordinate>& projection, const Corners& corners, std::ostream& out)
│ │ │ -
44{
│ │ │ -
45 using namespace ProjectionImplementation;
│ │ │ -
46 using std::get;
│ │ │ -
47
│ │ │ -
48 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
│ │ │ -
49 const auto& local = projection.edgeIntersections()[i].local;
│ │ │ -
50 out << interpolate(local[0], get<0>(corners)) << "\n"
│ │ │ -
51 << interpolate(local[1], get<1>(corners)) << "\n";
│ │ │ -
52 }
│ │ │ -
53}
│ │ │ -
│ │ │ -
54
│ │ │ -
55template<typename Coordinate, typename Normals>
│ │ │ -
│ │ │ -
56void write_edge_intersection_normals(const Projection<Coordinate>& projection, const Normals& normals, std::ostream& out)
│ │ │ -
57{
│ │ │ -
58 using namespace ProjectionImplementation;
│ │ │ -
59 using std::get;
│ │ │ -
60
│ │ │ -
61 for (std::size_t i = 0; i < projection.numberOfEdgeIntersections(); ++i) {
│ │ │ -
62 const auto& local = projection.edgeIntersections()[i].local;
│ │ │ -
63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals));
│ │ │ -
64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals));
│ │ │ -
65
│ │ │ -
66 out << n0 << "\n"
│ │ │ -
67 << n1 << "\n";
│ │ │ -
68 }
│ │ │ -
69}
│ │ │ -
│ │ │ -
70
│ │ │ -
71template<unsigned side, typename Coordinate>
│ │ │ -
│ │ │ -
72void write_success(const Projection<Coordinate>& projection, std::ostream& out)
│ │ │ -
73{
│ │ │ -
74 using std::get;
│ │ │ -
75
│ │ │ -
76 out << side << "\n";
│ │ │ -
77
│ │ │ -
78 const auto& success = get<side>(projection.success());
│ │ │ -
79 for (std::size_t i = 0; i < success.size(); ++i)
│ │ │ -
80 out << (success[i] ? "1\n" : "0\n");
│ │ │ -
81}
│ │ │ +
10namespace Dune {
│ │ │ +
11namespace GridGlue {
│ │ │ +
12
│ │ │ +
│ │ │ +
13namespace AreaWriterImplementation {
│ │ │ +
14
│ │ │ +
15template<int dimgrid>
│ │ │ +
│ │ │ + │ │ │ +
17{
│ │ │ +
│ │ │ +
18 bool contains(Dune::GeometryType gt) const
│ │ │ +
19 {
│ │ │ +
20 return gt.dim() == dimgrid - 1;
│ │ │ +
21 }
│ │ │ +
│ │ │ +
22};
│ │ │ +
│ │ │ +
23
│ │ │ +
24template<typename GridView>
│ │ │ +
│ │ │ +
25void write_facet_geometry(const GridView& gv, std::ostream& out)
│ │ │ +
26{
│ │ │ +
27 using Coordinate = Dune::FieldVector<double, 3>;
│ │ │ +
28
│ │ │ +
29 std::vector<Coordinate> corners;
│ │ │ +
30 for (const auto& facet : facets(gv)) {
│ │ │ +
31 const auto geometry = facet.geometry();
│ │ │ +
32 for (int i = 0; i < geometry.corners(); ++i) {
│ │ │ +
33 /* VTK always needs 3-dim coordinates... */
│ │ │ +
34 const auto c0 = geometry.corner(i);
│ │ │ +
35 Coordinate c1;
│ │ │ +
36 for (int d = 0; d < GridView::dimensionworld; ++d)
│ │ │ +
37 c1[d] = c0[d];
│ │ │ +
38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d)
│ │ │ +
39 c1[d] = double(0);
│ │ │ +
40 corners.push_back(c1);
│ │ │ +
41 }
│ │ │ +
42 }
│ │ │ +
43
│ │ │ +
44 {
│ │ │ +
45 out << "DATASET UNSTRUCTURED_GRID\n"
│ │ │ +
46 << "POINTS " << corners.size() << " double\n";
│ │ │ +
47 for (const auto& c : corners)
│ │ │ +
48 out << c << "\n";
│ │ │ +
49 }
│ │ │ +
50 {
│ │ │ +
51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << "\n";
│ │ │ +
52 std::size_t c = 0;
│ │ │ +
53 for (const auto& facet : facets(gv)) {
│ │ │ +
54 const auto geometry = facet.geometry();
│ │ │ +
55 out << geometry.corners();
│ │ │ +
56 for (int i = 0; i < geometry.corners(); ++i, ++c)
│ │ │ +
57 out << " " << c;
│ │ │ +
58 out << "\n";
│ │ │ +
59 }
│ │ │ +
60 }
│ │ │ +
61 {
│ │ │ +
62 out << "CELL_TYPES " << gv.size(1) << "\n";
│ │ │ +
63 for (const auto& facet : facets(gv)) {
│ │ │ +
64 const auto type = facet.type();
│ │ │ +
65 if (type.isVertex())
│ │ │ +
66 out << "1\n";
│ │ │ +
67 else if (type.isLine())
│ │ │ +
68 out << "2\n";
│ │ │ +
69 else if (type.isTriangle())
│ │ │ +
70 out << "5\n";
│ │ │ +
71 else if (type.isQuadrilateral())
│ │ │ +
72 out << "9\n";
│ │ │ +
73 else if (type.isTetrahedron())
│ │ │ +
74 out << "10\n";
│ │ │ +
75 else
│ │ │ +
76 DUNE_THROW(Dune::Exception, "Unhandled geometry type");
│ │ │ +
77 }
│ │ │ +
78 }
│ │ │ +
79}
│ │ │
│ │ │ -
82
│ │ │ -
83} /* namespace ProjectionWriterImplementation */
│ │ │ +
80
│ │ │ +
81} /* namespace AreaWriterImplementation */
│ │ │
│ │ │ -
84
│ │ │ -
85template<typename Coordinate, typename Corners, typename Normals>
│ │ │ -
│ │ │ -
86void write(const Projection<Coordinate>& projection,
│ │ │ -
87 const Corners& corners,
│ │ │ -
88 const Normals& normals,
│ │ │ -
89 std::ostream& out)
│ │ │ -
90{
│ │ │ -
91 using namespace ProjectionWriterImplementation;
│ │ │ -
92
│ │ │ -
93 const auto numberOfEdgeIntersections = projection.numberOfEdgeIntersections();
│ │ │ -
94 const auto nPoints = 12 + 2 * numberOfEdgeIntersections;
│ │ │ -
95
│ │ │ -
96 out << "# vtk DataFile Version2.0\n"
│ │ │ -
97 << "Filename: projection\n"
│ │ │ -
98 << "ASCII\n"
│ │ │ -
99 << "DATASET UNSTRUCTURED_GRID\n"
│ │ │ -
100 << "POINTS " << nPoints << " double\n";
│ │ │ -
101 write_points<0>(projection, corners, out);
│ │ │ -
102 write_points<1>(projection, corners, out);
│ │ │ -
103 write_edge_intersection_points(projection, corners, out);
│ │ │ -
104 out << "CELLS " << (8 + numberOfEdgeIntersections) << " " << (26 + 3 * numberOfEdgeIntersections) << "\n";
│ │ │ -
105 out << "3 0 1 2\n" "2 0 3\n" "2 1 4\n" "2 2 5\n"
│ │ │ -
106 << "3 6 7 8\n" "2 6 9\n" "2 7 10\n" "2 8 11\n";
│ │ │ -
107 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
│ │ │ -
108 out << "2 " << (12 + 2*i) << " " << (12 + 2*i + 1) << "\n";
│ │ │ -
109 out << "CELL_TYPES " << (8 + numberOfEdgeIntersections) << "\n" "5\n3\n3\n3\n" "5\n3\n3\n3\n";
│ │ │ -
110 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
│ │ │ -
111 out << "3\n";
│ │ │ -
112 out << "CELL_DATA " << (8 + numberOfEdgeIntersections) << "\n";
│ │ │ -
113 out << "SCALARS success int 1\n"
│ │ │ -
114 << "LOOKUP_TABLE success\n";
│ │ │ -
115 write_success<0>(projection, out);
│ │ │ -
116 write_success<1>(projection, out);
│ │ │ -
117 for (std::size_t i = 0; i < numberOfEdgeIntersections; ++i)
│ │ │ -
118 out << "2\n";
│ │ │ -
119 out << "LOOKUP_TABLE success 2\n"
│ │ │ -
120 << "1.0 0.0 0.0 1.0\n"
│ │ │ -
121 << "0.0 1.0 0.0 1.0\n";
│ │ │ -
122 out << "POINT_DATA " << nPoints << "\n"
│ │ │ -
123 << "NORMALS normals double\n";
│ │ │ -
124 write_normals<0>(projection, normals, out);
│ │ │ -
125 write_normals<1>(projection, normals, out);
│ │ │ -
126 write_edge_intersection_normals(projection, normals, out);
│ │ │ -
127}
│ │ │ -
│ │ │ -
128
│ │ │ -
129template<typename Coordinate, typename Corners, typename Normals>
│ │ │ -
│ │ │ -
130void write(const Projection<Coordinate>& projection,
│ │ │ -
131 const Corners& corners,
│ │ │ -
132 const Normals& normals,
│ │ │ -
133 const std::string& filename)
│ │ │ -
134{
│ │ │ -
135 std::ofstream out(filename.c_str());
│ │ │ -
136 write(projection, corners, normals, out);
│ │ │ -
137}
│ │ │ -
│ │ │ -
138
│ │ │ -
139template<typename Coordinate, typename Corners, typename Normals>
│ │ │ -
│ │ │ -
140void print(const Projection<Coordinate>& projection,
│ │ │ -
141 const Corners& corners,
│ │ │ -
142 const Normals& normals)
│ │ │ -
143{
│ │ │ -
144 using namespace ProjectionWriterImplementation;
│ │ │ -
145
│ │ │ -
146 std::cout << "Side 0 corners and images:\n";
│ │ │ -
147 write_points<0>(projection, corners, std::cout);
│ │ │ -
148 std::cout << "Side 0 success:\n";
│ │ │ -
149 write_success<0>(projection, std::cout);
│ │ │ -
150 std::cout << "Side 1 corners and images:\n";
│ │ │ -
151 write_points<1>(projection, corners, std::cout);
│ │ │ -
152 std::cout << "Side 1 success:\n";
│ │ │ -
153 write_success<1>(projection, std::cout);
│ │ │ -
154 std::cout << "Side 0 normals and projected normals:\n";
│ │ │ -
155 write_normals<0>(projection, normals, std::cout);
│ │ │ -
156 std::cout << "Side 1 normals and projected normals:\n";
│ │ │ -
157 write_normals<1>(projection, normals, std::cout);
│ │ │ -
158 std::cout << projection.numberOfEdgeIntersections() << " edge intersections:\n";
│ │ │ -
159 write_edge_intersection_points(projection, corners, std::cout);
│ │ │ -
160}
│ │ │ -
│ │ │ -
161
│ │ │ -
162} /* namespace GridGlue */
│ │ │ -
163} /* namespace Dune */
│ │ │ +
82
│ │ │ +
83template<int side, typename Glue>
│ │ │ +
│ │ │ +
84void write_glue_area_vtk(const Glue& glue, std::ostream& out)
│ │ │ +
85{
│ │ │ +
86 using GridView = typename std::decay< decltype(glue.template gridView<side>()) >::type;
│ │ │ +
87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView, AreaWriterImplementation::FacetLayout>;
│ │ │ +
88 using ctype = typename GridView::ctype;
│ │ │ +
89
│ │ │ +
90 const GridView gv = glue.template gridView<side>();
│ │ │ +
91 Mapper mapper(gv);
│ │ │ +
92 std::vector<ctype> coveredArea(mapper.size(), ctype(0));
│ │ │ +
93 std::vector<ctype> totalArea(mapper.size(), ctype(1));
│ │ │ +
94
│ │ │ +
95 for (const auto& in : intersections(glue, Reverse<side == 1>())) {
│ │ │ +
96 const auto element = in.inside();
│ │ │ +
97 const auto index = mapper.subIndex(element, in.indexInInside(), 1);
│ │ │ +
98 coveredArea[index] += in.geometryInInside().volume();
│ │ │ +
99
│ │ │ +
100 const auto& refElement = Dune::ReferenceElements<ctype, GridView::dimension>::general(element.type());
│ │ │ +
101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside());
│ │ │ +
102 totalArea[index] = subGeometry.volume();
│ │ │ +
103 }
│ │ │ +
104
│ │ │ +
105 for (std::size_t i = 0; i < coveredArea.size(); ++i)
│ │ │ +
106 coveredArea[i] /= totalArea[i];
│ │ │ +
107
│ │ │ +
108 out << "# vtk DataFile Version 2.0\n"
│ │ │ +
109 << "Filename: Glue Area\n"
│ │ │ +
110 << "ASCII\n";
│ │ │ +
111
│ │ │ + │ │ │ +
113
│ │ │ +
114 out << "CELL_DATA " << coveredArea.size() << "\n"
│ │ │ +
115 << "SCALARS CoveredArea double 1\n"
│ │ │ +
116 << "LOOKUP_TABLE default\n";
│ │ │ +
117 for (const auto& value : coveredArea)
│ │ │ +
118 out << value << "\n";
│ │ │ +
119}
│ │ │ +
│ │ │ +
120
│ │ │ +
121template<int side, typename Glue>
│ │ │ +
│ │ │ +
122void write_glue_area_vtk(const Glue& glue, const std::string& filename)
│ │ │ +
123{
│ │ │ +
124 std::ofstream out(filename.c_str());
│ │ │ +
125 write_glue_area_vtk<side>(glue, out);
│ │ │ +
126}
│ │ │ +
│ │ │ +
127
│ │ │ +
128template<typename Glue>
│ │ │ +
│ │ │ +
129void write_glue_areas_vtk(const Glue& glue, const std::string& base)
│ │ │ +
130{
│ │ │ +
131 {
│ │ │ +
132 std::string filename = base;
│ │ │ +
133 filename += "-inside.vtk";
│ │ │ +
134 write_glue_area_vtk<0>(glue, filename);
│ │ │ +
135 }
│ │ │ +
136 {
│ │ │ +
137 std::string filename = base;
│ │ │ +
138 filename += "-outside.vtk";
│ │ │ +
139 write_glue_area_vtk<1>(glue, filename);
│ │ │ +
140 }
│ │ │ +
141}
│ │ │ +
│ │ │ +
142
│ │ │ +
143} /* namespace GridGlue */
│ │ │ +
144} /* namespace Dune */
│ │ │
Definition gridglue.hh:37
│ │ │ -
void write(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals, std::ostream &out)
write projection in VTK format
Definition projectionwriter_impl.hh:86
│ │ │ -
void print(const Projection< Coordinate > &projection, const Corners &corners, const Normals &normals)
Print information about the projection to std::cout stream.
Definition projectionwriter_impl.hh:140
│ │ │ -
void write_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
Definition projectionwriter_impl.hh:27
│ │ │ -
void write_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
Definition projectionwriter_impl.hh:11
│ │ │ -
void write_success(const Projection< Coordinate > &projection, std::ostream &out)
Definition projectionwriter_impl.hh:72
│ │ │ -
void write_edge_intersection_points(const Projection< Coordinate > &projection, const Corners &corners, std::ostream &out)
Definition projectionwriter_impl.hh:43
│ │ │ -
void write_edge_intersection_normals(const Projection< Coordinate > &projection, const Normals &normals, std::ostream &out)
Definition projectionwriter_impl.hh:56
│ │ │ -
Projection of a line (triangle) on another line (triangle).
Definition projection.hh:21
│ │ │ -
const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const
Indicate whether projection (inverse projection) is valid for each corner or not.
Definition projection.hh:252
│ │ │ -
unsigned numberOfEdgeIntersections() const
Number of edge intersections.
Definition projection.hh:262
│ │ │ -
const std::tuple< Images, Preimages > & images() const
Images and preimages of corners.
Definition projection.hh:235
│ │ │ -
const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections() const
Edge-edge intersections.
Definition projection.hh:273
│ │ │ +
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,238 +1,184 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 │ │ │ │ +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#include │ │ │ │ -4 │ │ │ │ -5namespace _D_u_n_e { │ │ │ │ -6namespace GridGlue { │ │ │ │ -7 │ │ │ │ -_8namespace ProjectionWriterImplementation { │ │ │ │ +4#include │ │ │ │ +5 │ │ │ │ +6#include │ │ │ │ +7#include │ │ │ │ +8#include │ │ │ │ 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; │ │ │ │ -32 │ │ │ │ -33 for (const auto& n : get(normals)) │ │ │ │ -34 out << n << "\n"; │ │ │ │ -35 │ │ │ │ -36 for (const auto& x : get(projection._i_m_a_g_e_s())) { │ │ │ │ -37 const auto n = interpolate_unit_normals(x, get(normals)); │ │ │ │ -38 out << n << "\n"; │ │ │ │ -39 } │ │ │ │ -40} │ │ │ │ -41 │ │ │ │ -42template │ │ │ │ -_4_3void _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___p_o_i_n_t_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, │ │ │ │ -const Corners& corners, std::ostream& out) │ │ │ │ -44{ │ │ │ │ -45 using namespace ProjectionImplementation; │ │ │ │ -46 using std::get; │ │ │ │ -47 │ │ │ │ -48 for (std::size_t i = 0; i < projection._n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s(); ++i) { │ │ │ │ -49 const auto& local = projection._e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s()[i].local; │ │ │ │ -50 out << interpolate(local[0], get<0>(corners)) << "\n" │ │ │ │ -51 << interpolate(local[1], get<1>(corners)) << "\n"; │ │ │ │ -52 } │ │ │ │ -53} │ │ │ │ -54 │ │ │ │ -55template │ │ │ │ -_5_6void _w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___n_o_r_m_a_l_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& │ │ │ │ -projection, const Normals& normals, std::ostream& out) │ │ │ │ -57{ │ │ │ │ -58 using namespace ProjectionImplementation; │ │ │ │ -59 using std::get; │ │ │ │ -60 │ │ │ │ -61 for (std::size_t i = 0; i < projection._n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s(); ++i) { │ │ │ │ -62 const auto& local = projection._e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s()[i].local; │ │ │ │ -63 const auto n0 = interpolate_unit_normals(local[0], get<0>(normals)); │ │ │ │ -64 const auto n1 = interpolate_unit_normals(local[1], get<1>(normals)); │ │ │ │ -65 │ │ │ │ -66 out << n0 << "\n" │ │ │ │ -67 << n1 << "\n"; │ │ │ │ -68 } │ │ │ │ -69} │ │ │ │ -70 │ │ │ │ -71template │ │ │ │ -_7_2void _w_r_i_t_e___s_u_c_c_e_s_s(const _P_r_o_j_e_c_t_i_o_n_<_C_o_o_r_d_i_n_a_t_e_>& projection, std::ostream& │ │ │ │ -out) │ │ │ │ -73{ │ │ │ │ -74 using std::get; │ │ │ │ -75 │ │ │ │ -76 out << side << "\n"; │ │ │ │ -77 │ │ │ │ -78 const auto& success = get(projection._s_u_c_c_e_s_s()); │ │ │ │ -79 for (std::size_t i = 0; i < success.size(); ++i) │ │ │ │ -80 out << (success[i] ? "1\n" : "0\n"); │ │ │ │ -81} │ │ │ │ +10namespace _D_u_n_e { │ │ │ │ +11namespace GridGlue { │ │ │ │ +12 │ │ │ │ +_1_3namespace AreaWriterImplementation { │ │ │ │ +14 │ │ │ │ +15template │ │ │ │ +_1_6struct _F_a_c_e_t_L_a_y_o_u_t │ │ │ │ +17{ │ │ │ │ +_1_8 bool _c_o_n_t_a_i_n_s(Dune::GeometryType gt) const │ │ │ │ +19 { │ │ │ │ +20 return gt.dim() == dimgrid - 1; │ │ │ │ +21 } │ │ │ │ +22}; │ │ │ │ +23 │ │ │ │ +24template │ │ │ │ +_2_5void _w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y(const GridView& gv, std::ostream& out) │ │ │ │ +26{ │ │ │ │ +27 using Coordinate = Dune::FieldVector; │ │ │ │ +28 │ │ │ │ +29 std::vector corners; │ │ │ │ +30 for (const auto& facet : facets(gv)) { │ │ │ │ +31 const auto geometry = facet.geometry(); │ │ │ │ +32 for (int i = 0; i < geometry.corners(); ++i) { │ │ │ │ +33 /* VTK always needs 3-dim coordinates... */ │ │ │ │ +34 const auto c0 = geometry.corner(i); │ │ │ │ +35 Coordinate c1; │ │ │ │ +36 for (int d = 0; d < GridView::dimensionworld; ++d) │ │ │ │ +37 c1[d] = c0[d]; │ │ │ │ +38 for (int d = GridView::dimensionworld; d < Coordinate::dimension; ++d) │ │ │ │ +39 c1[d] = double(0); │ │ │ │ +40 corners.push_back(c1); │ │ │ │ +41 } │ │ │ │ +42 } │ │ │ │ +43 │ │ │ │ +44 { │ │ │ │ +45 out << "DATASET UNSTRUCTURED_GRID\n" │ │ │ │ +46 << "POINTS " << corners.size() << " double\n"; │ │ │ │ +47 for (const auto& c : corners) │ │ │ │ +48 out << c << "\n"; │ │ │ │ +49 } │ │ │ │ +50 { │ │ │ │ +51 out << "CELLS " << gv.size(1) << " " << (gv.size(1) + corners.size()) << │ │ │ │ +"\n"; │ │ │ │ +52 std::size_t c = 0; │ │ │ │ +53 for (const auto& facet : facets(gv)) { │ │ │ │ +54 const auto geometry = facet.geometry(); │ │ │ │ +55 out << geometry.corners(); │ │ │ │ +56 for (int i = 0; i < geometry.corners(); ++i, ++c) │ │ │ │ +57 out << " " << c; │ │ │ │ +58 out << "\n"; │ │ │ │ +59 } │ │ │ │ +60 } │ │ │ │ +61 { │ │ │ │ +62 out << "CELL_TYPES " << gv.size(1) << "\n"; │ │ │ │ +63 for (const auto& facet : facets(gv)) { │ │ │ │ +64 const auto type = facet.type(); │ │ │ │ +65 if (type.isVertex()) │ │ │ │ +66 out << "1\n"; │ │ │ │ +67 else if (type.isLine()) │ │ │ │ +68 out << "2\n"; │ │ │ │ +69 else if (type.isTriangle()) │ │ │ │ +70 out << "5\n"; │ │ │ │ +71 else if (type.isQuadrilateral()) │ │ │ │ +72 out << "9\n"; │ │ │ │ +73 else if (type.isTetrahedron()) │ │ │ │ +74 out << "10\n"; │ │ │ │ +75 else │ │ │ │ +76 DUNE_THROW(Dune::Exception, "Unhandled geometry type"); │ │ │ │ +77 } │ │ │ │ +78 } │ │ │ │ +79} │ │ │ │ +80 │ │ │ │ +81} /* namespace AreaWriterImplementation */ │ │ │ │ 82 │ │ │ │ -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 */ │ │ │ │ +83template │ │ │ │ +_8_4void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, std::ostream& out) │ │ │ │ +85{ │ │ │ │ +86 using GridView = typename std::decay< decltype(glue.template gridView │ │ │ │ +()) >::type; │ │ │ │ +87 using Mapper = Dune::MultipleCodimMultipleGeomTypeMapper; │ │ │ │ +88 using ctype = typename GridView::ctype; │ │ │ │ +89 │ │ │ │ +90 const GridView gv = glue.template gridView(); │ │ │ │ +91 Mapper mapper(gv); │ │ │ │ +92 std::vector coveredArea(mapper.size(), ctype(0)); │ │ │ │ +93 std::vector totalArea(mapper.size(), ctype(1)); │ │ │ │ +94 │ │ │ │ +95 for (const auto& in : _i_n_t_e_r_s_e_c_t_i_o_n_s(glue, _R_e_v_e_r_s_e_<_s_i_d_e_ _=_=_ _1_>())) { │ │ │ │ +96 const auto element = in.inside(); │ │ │ │ +97 const auto index = mapper.subIndex(element, in.indexInInside(), 1); │ │ │ │ +98 coveredArea[index] += in.geometryInInside().volume(); │ │ │ │ +99 │ │ │ │ +100 const auto& refElement = Dune::ReferenceElements::general(element.type()); │ │ │ │ +101 const auto& subGeometry = refElement.template geometry<1>(in.indexInInside │ │ │ │ +()); │ │ │ │ +102 totalArea[index] = subGeometry.volume(); │ │ │ │ +103 } │ │ │ │ +104 │ │ │ │ +105 for (std::size_t i = 0; i < coveredArea.size(); ++i) │ │ │ │ +106 coveredArea[i] /= totalArea[i]; │ │ │ │ +107 │ │ │ │ +108 out << "# vtk DataFile Version 2.0\n" │ │ │ │ +109 << "Filename: Glue Area\n" │ │ │ │ +110 << "ASCII\n"; │ │ │ │ +111 │ │ │ │ +112 _A_r_e_a_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___f_a_c_e_t___g_e_o_m_e_t_r_y(gv, out); │ │ │ │ +113 │ │ │ │ +114 out << "CELL_DATA " << coveredArea.size() << "\n" │ │ │ │ +115 << "SCALARS CoveredArea double 1\n" │ │ │ │ +116 << "LOOKUP_TABLE default\n"; │ │ │ │ +117 for (const auto& value : coveredArea) │ │ │ │ +118 out << value << "\n"; │ │ │ │ +119} │ │ │ │ +120 │ │ │ │ +121template │ │ │ │ +_1_2_2void _w_r_i_t_e___g_l_u_e___a_r_e_a___v_t_k(const Glue& glue, const std::string& filename) │ │ │ │ +123{ │ │ │ │ +124 std::ofstream out(filename.c_str()); │ │ │ │ +125 write_glue_area_vtk(glue, out); │ │ │ │ +126} │ │ │ │ +127 │ │ │ │ +128template │ │ │ │ +_1_2_9void _w_r_i_t_e___g_l_u_e___a_r_e_a_s___v_t_k(const Glue& glue, const std::string& base) │ │ │ │ +130{ │ │ │ │ +131 { │ │ │ │ +132 std::string filename = base; │ │ │ │ +133 filename += "-inside.vtk"; │ │ │ │ +134 write_glue_area_vtk<0>(glue, filename); │ │ │ │ +135 } │ │ │ │ +136 { │ │ │ │ +137 std::string filename = base; │ │ │ │ +138 filename += "-outside.vtk"; │ │ │ │ +139 write_glue_area_vtk<1>(glue, filename); │ │ │ │ +140 } │ │ │ │ +141} │ │ │ │ +142 │ │ │ │ +143} /* namespace GridGlue */ │ │ │ │ +144} /* namespace Dune */ │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn gridglue.hh:37 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_w_r_i_t_e │ │ │ │ -void write(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ -const Normals &normals, std::ostream &out) │ │ │ │ -write projection in VTK format │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:86 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_p_r_i_n_t │ │ │ │ -void print(const Projection< Coordinate > &projection, const Corners &corners, │ │ │ │ -const Normals &normals) │ │ │ │ -Print information about the projection to std::cout stream. │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:140 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___n_o_r_m_a_l_s │ │ │ │ -void write_normals(const Projection< Coordinate > &projection, const Normals │ │ │ │ -&normals, std::ostream &out) │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:27 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___p_o_i_n_t_s │ │ │ │ -void write_points(const Projection< Coordinate > &projection, const Corners │ │ │ │ -&corners, std::ostream &out) │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:11 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___s_u_c_c_e_s_s │ │ │ │ -void write_success(const Projection< Coordinate > &projection, std::ostream │ │ │ │ -&out) │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:72 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___p_o_i_n_t_s │ │ │ │ -void write_edge_intersection_points(const Projection< Coordinate > &projection, │ │ │ │ -const Corners &corners, std::ostream &out) │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:43 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_W_r_i_t_e_r_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_w_r_i_t_e___e_d_g_e___i_n_t_e_r_s_e_c_t_i_o_n___n_o_r_m_a_l_s │ │ │ │ -void write_edge_intersection_normals(const Projection< Coordinate > │ │ │ │ -&projection, const Normals &normals, std::ostream &out) │ │ │ │ -DDeeffiinniittiioonn projectionwriter_impl.hh:56 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n │ │ │ │ -Projection of a line (triangle) on another line (triangle). │ │ │ │ -DDeeffiinniittiioonn projection.hh:21 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_s_u_c_c_e_s_s │ │ │ │ -const std::tuple< std::bitset< dim >, std::bitset< dim > > & success() const │ │ │ │ -Indicate whether projection (inverse projection) is valid for each corner or │ │ │ │ -not. │ │ │ │ -DDeeffiinniittiioonn projection.hh:252 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_n_u_m_b_e_r_O_f_E_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ -unsigned numberOfEdgeIntersections() const │ │ │ │ -Number of edge intersections. │ │ │ │ -DDeeffiinniittiioonn projection.hh:262 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_i_m_a_g_e_s │ │ │ │ -const std::tuple< Images, Preimages > & images() const │ │ │ │ -Images and preimages of corners. │ │ │ │ -DDeeffiinniittiioonn projection.hh:235 │ │ │ │ -_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_P_r_o_j_e_c_t_i_o_n_:_:_e_d_g_e_I_n_t_e_r_s_e_c_t_i_o_n_s │ │ │ │ -const std::array< EdgeIntersection, maxEdgeIntersections > & edgeIntersections │ │ │ │ -() const │ │ │ │ -Edge-edge intersections. │ │ │ │ -DDeeffiinniittiioonn projection.hh:273 │ │ │ │ +_D_u_n_e_:_:_G_r_i_d_G_l_u_e_:_:_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/a00035.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -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.10 │ │ │ │ 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/a00035_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.10 │ │ │ │ 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/a00041.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: projection.hh File Reference │ │ │ +dune-grid-glue: projectionwriter_impl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,41 +70,61 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -Classes | │ │ │ -Namespaces
│ │ │ -
projection.hh File Reference
│ │ │ +Namespaces | │ │ │ +Functions
│ │ │ +
projectionwriter_impl.hh File Reference
│ │ │ │ │ │
│ │ │ -
#include <array>
│ │ │ -#include <bitset>
│ │ │ -#include <tuple>
│ │ │ -#include "projection_impl.hh"
│ │ │ +
#include <fstream>
│ │ │
│ │ │

Go to the source code of this file.

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

│ │ │ -Classes

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

│ │ │ Namespaces

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

│ │ │ +Functions

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

Go to the source code of this file.

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

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

Go to the source code of this file.

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

│ │ │ Namespaces

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

│ │ │ +Macros

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

│ │ │ Functions

template<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,32 +1,39 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 │ │ │ │ -#include │ │ │ │ -#include "_a_r_e_a_w_r_i_t_e_r___i_m_p_l_._h_h" │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +ringcomm.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_G_r_i_d_G_l_u_e │ │ │ │ +namespace   _D_u_n_e_:_:_P_a_r_a_l_l_e_l │ │ │ │   │ │ │ │ -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___g_l_u_e___a_r_e_a___v_t_k (const Glue &glue, const std::string │ │ │ │ - &filename) │ │ │ │ +MMaaccrrooss │ │ │ │ +#define  _C_h_e_c_k_M_P_I_S_t_a_t_u_s(A, B)   {} │ │ │ │   │ │ │ │ -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) │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ +void  _D_u_n_e_:_:_P_a_r_a_l_l_e_l_:_:_M_P_I___A_l_l_A_p_p_l_y (MPI_Comm mpicomm, OP &&op, const Args &... │ │ │ │ + data) │ │ │ │ +  apply an operator locally to a difstributed data set │ │ │ │   │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? CChheecckkMMPPIISSttaattuuss ********** │ │ │ │ +#define CheckMPIStatus (   A, │ │ │ │ +   B  │ │ │ │ + )    {} │ │ │ │ + _TT_oo_dd_oo_:: │ │ │ │ + Implement MPI Status check with exception handling │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-grid-glue-doc/doxygen/a00050_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: areawriter.hh Source File │ │ │ +dune-grid-glue: ringcomm.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,47 +74,309 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
areawriter.hh
│ │ │ +
ringcomm.hh
│ │ │
│ │ │
│ │ │ -Go to the documentation of this file.
1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │ -
2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
│ │ │ -
3#ifndef DUNE_GRIDGLUE_COMMON_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
│ │ │ - │ │ │ +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 actual size is stored in the status
│ │ │ +
112 result =
│ │ │ +
113 MPI_Irecv(
│ │ │ +
114 &(next[0]), Info::size*next.size(), Info::getType(), leftrank, tag,
│ │ │ +
115 comm, &r_recv);
│ │ │ +
116 // // check result
│ │ │ +
117 // MPI_Status status;
│ │ │ +
118 // CheckMPIStatus(result, status);
│ │ │ +
119 }
│ │ │ +
120
│ │ │ +
121 template<typename T>
│ │ │ +
122 using ptr_t = T*;
│ │ │ +
123
│ │ │ +
124 /* these helper structs are needed as long as we still support
│ │ │ +
125 C++11, as we can't use variadic lambdas */
│ │ │ +
126 template<typename... Args>
│ │ │ +
127 struct call_MPI_SendVectorInRing
│ │ │ +
128 {
│ │ │ +
129 std::tuple<Args...> & remotedata;
│ │ │ +
130 std::tuple<Args...> & nextdata;
│ │ │ +
131 int & tag;
│ │ │ +
132 int & rightrank;
│ │ │ +
133 int & leftrank;
│ │ │ +
134 MPI_Comm & mpicomm;
│ │ │ +
135 std::array<MPI_Request,sizeof...(Args)> & requests_send;
│ │ │ +
136 std::array<MPI_Request,sizeof...(Args)> & requests_recv;
│ │ │ +
137
│ │ │ +
138 template<typename I>
│ │ │ +
139 void operator()(I i)
│ │ │ +
140 {
│ │ │ +
141 MPI_SendVectorInRing(
│ │ │ +
142 std::get<i>(remotedata),
│ │ │ +
143 std::get<i>(nextdata),
│ │ │ +
144 tag+i,
│ │ │ +
145 rightrank, leftrank, mpicomm,
│ │ │ +
146 requests_send[i],
│ │ │ +
147 requests_recv[i]);
│ │ │ +
148 }
│ │ │ +
149 };
│ │ │ +
150 template<typename... Args>
│ │ │ +
151 struct call_MPI_SetVectorSize
│ │ │ +
152 {
│ │ │ +
153 std::tuple<Args...> & nextdata;
│ │ │ +
154 std::array<MPI_Status,sizeof...(Args)> & status_recv;
│ │ │ +
155
│ │ │ +
156 template<typename I>
│ │ │ +
157 void operator()(I i)
│ │ │ +
158 {
│ │ │ +
159 MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
│ │ │ +
160 }
│ │ │ +
161 };
│ │ │ +
162
│ │ │ +
163 template<typename OP, std::size_t... Indices, typename... Args>
│ │ │ +
164 void MPI_AllApply_impl(MPI_Comm mpicomm,
│ │ │ +
165 OP && op,
│ │ │ +
166 std::index_sequence<Indices...> indices,
│ │ │ +
167 const Args&... data)
│ │ │ +
168 {
│ │ │ +
169 constexpr std::size_t N = sizeof...(Args);
│ │ │ +
170 int myrank = 0;
│ │ │ +
171 int commsize = 0;
│ │ │ +
172#if HAVE_MPI
│ │ │ +
173 MPI_Comm_rank(mpicomm, &myrank);
│ │ │ +
174 MPI_Comm_size(mpicomm, &commsize);
│ │ │ +
175#endif // HAVE_MPI
│ │ │ +
176
│ │ │ +
177 if (commsize > 1)
│ │ │ +
178 {
│ │ │ +
179#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
│ │ │ +
180 std::cout << myrank << " Start Communication, size " << commsize << std::endl;
│ │ │ +
181#endif
│ │ │ +
182
│ │ │ +
183 // get data sizes
│ │ │ +
184 std::array<unsigned int, N> size({ ((unsigned int)data.size())... });
│ │ │ +
185
│ │ │ +
186 // communicate max data size
│ │ │ +
187 std::array<unsigned int, N> maxSize;
│ │ │ +
188 MPI_Allreduce(&size, &maxSize,
│ │ │ +
189 size.size(), MPI_UNSIGNED, MPI_MAX, mpicomm);
│ │ │ +
190#ifdef DEBUG_GRIDGLUE_PARALLELMERGE
│ │ │ +
191 std::cout << myrank << " maxSize " << "done... " << std::endl;
│ │ │ +
192#endif
│ │ │ +
193
│ │ │ +
194 // allocate receiving buffers with maxsize to ensure sufficient buffer size for communication
│ │ │ +
195 std::tuple<Args...> remotedata { Args(maxSize[Indices])... };
│ │ │ +
196
│ │ │ +
197 // copy local data to receiving buffer
│ │ │ +
198 remotedata = std::tie(data...);
│ │ │ +
199
│ │ │ +
200 // allocate second set of receiving buffers necessary for async communication
│ │ │ +
201 std::tuple<Args...> nextdata { Args(maxSize[Indices])... };
│ │ │ +
202
│ │ │ +
203 // communicate data in the ring
│ │ │ +
204 int rightrank = (myrank + 1 + commsize) % commsize;
│ │ │ +
205 int leftrank = (myrank - 1 + commsize) % commsize;
│ │ │ +
206
│ │ │ +
207 std::cout << myrank << ": size = " << commsize << std::endl;
│ │ │ +
208 std::cout << myrank << ": left = " << leftrank
│ │ │ +
209 << " right = " << rightrank << std::endl;
│ │ │ +
210
│ │ │ +
211 // currently the remote data is our own data
│ │ │ +
212 int remoterank = myrank;
│ │ │ +
213
│ │ │ +
214 for (int i=1; i<commsize; i++)
│ │ │ +
215 {
│ │ │ +
216 // in this iteration we will receive data from nextrank
│ │ │ +
217 int nextrank = (myrank - i + commsize) % commsize;
│ │ │ +
218
│ │ │ +
219 std::cout << myrank << ": next = " << nextrank << std::endl;
│ │ │ +
220
│ │ │ +
221 // send remote data to right neighbor and receive from left neighbor
│ │ │ +
222 std::array<MPI_Request,N> requests_send;
│ │ │ +
223 std::array<MPI_Request,N> requests_recv;
│ │ │ +
224
│ │ │ +
225 int tag = 0;
│ │ │ +
226 Dune::Hybrid::forEach(indices,
│ │ │ +
227 // [&](auto i){
│ │ │ +
228 // MPI_SendVectorInRing(
│ │ │ +
229 // std::get<i>(remotedata),
│ │ │ +
230 // std::get<i>(nextdata),
│ │ │ +
231 // tag+i,
│ │ │ +
232 // rightrank, leftrank, mpicomm,
│ │ │ +
233 // requests_send[i],
│ │ │ +
234 // requests_recv[i]);
│ │ │ +
235 // });
│ │ │ +
236 call_MPI_SendVectorInRing<Args...>({
│ │ │ +
237 remotedata,
│ │ │ +
238 nextdata,
│ │ │ +
239 tag,
│ │ │ +
240 rightrank, leftrank, mpicomm,
│ │ │ +
241 requests_send,
│ │ │ +
242 requests_recv
│ │ │ +
243 }));
│ │ │ +
244
│ │ │ +
245 // apply operator
│ │ │ +
246 op(remoterank,std::get<Indices>(remotedata)...);
│ │ │ +
247
│ │ │ +
248 // wait for communication to finalize
│ │ │ +
249 std::array<MPI_Status,N> status_send;
│ │ │ +
250 std::array<MPI_Status,N> status_recv;
│ │ │ +
251 MPI_Waitall(N,&requests_recv[0],&status_recv[0]);
│ │ │ +
252
│ │ │ +
253 // we finished receiving from nextrank and thus remoterank = nextrank
│ │ │ +
254 remoterank = nextrank;
│ │ │ +
255
│ │ │ +
256 // get current data sizes
│ │ │ +
257 // and resize vectors
│ │ │ +
258 Dune::Hybrid::forEach(indices,
│ │ │ +
259 // [&](auto i){
│ │ │ +
260 // MPI_SetVectorSize(std::get<i>(nextdata),status_recv[i]);
│ │ │ +
261 // });
│ │ │ +
262 call_MPI_SetVectorSize<Args...>({
│ │ │ +
263 nextdata, status_recv
│ │ │ +
264 }));
│ │ │ +
265
│ │ │ +
266 MPI_Waitall(N,&requests_send[0],&status_send[0]);
│ │ │ +
267
│ │ │ +
268 // swap the communication buffers
│ │ │ +
269 std::swap(remotedata,nextdata);
│ │ │ +
270 }
│ │ │ +
271
│ │ │ +
272 // last apply (or the only one in the case of sequential application)
│ │ │ +
273 op(remoterank,std::get<Indices>(remotedata)...);
│ │ │ +
274 }
│ │ │ +
275 else // sequential
│ │ │ +
276 {
│ │ │ +
277 op(myrank,data...);
│ │ │ +
278 }
│ │ │ +
279 }
│ │ │ +
280
│ │ │ +
281 } // end namespace Impl
│ │ │ +
282
│ │ │ +
296template<typename OP, typename... Args>
│ │ │ +
│ │ │ +
297void MPI_AllApply(MPI_Comm mpicomm,
│ │ │ +
298 OP && op,
│ │ │ +
299 const Args& ... data)
│ │ │ +
300{
│ │ │ +
301 Impl::MPI_AllApply_impl(
│ │ │ +
302 mpicomm,
│ │ │ +
303 std::forward<OP>(op),
│ │ │ +
304 std::make_index_sequence<sizeof...(Args)>(),
│ │ │ +
305 data...
│ │ │ +
306 );
│ │ │ +
307}
│ │ │ +
│ │ │ +
308
│ │ │ +
309} // end namespace Parallel
│ │ │ +
│ │ │ +
310} // end namespace Dune
│ │ │
Definition gridglue.hh:37
│ │ │ -
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 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,48 +1,308 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _g_r_i_d_-_g_l_u_e │ │ │ │ * _c_o_m_m_o_n │ │ │ │ -areawriter.hh │ │ │ │ +ringcomm.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ -1// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ +1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ +2// vi: set et ts=4 sw=2 sts=2: │ │ │ │ +3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ -2// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ +4// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with- │ │ │ │ dune-grid-glue-exception │ │ │ │ -3#ifndef DUNE_GRIDGLUE_COMMON_AREAWRITER_HH │ │ │ │ -4#define DUNE_GRIDGLUE_COMMON_AREAWRITER_HH │ │ │ │ -5 │ │ │ │ -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 │ │ │ │ +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 actual 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: 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::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/a00053_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 edge
│ │ │ -
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:73
│ │ │ +
static constexpr auto codim
Definition extractor.hh:52
│ │ │ +
std::map< IndexType, VertexInfo > VertexInfoMap
Definition extractor.hh:186
│ │ │ +
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:116
│ │ │ +
simple struct holding an element seed and an index
Definition extractor.hh:128
│ │ │ +
Holds some information about an element's subentity involved in a coupling.
Definition extractor.hh:147
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,280 +1,325 @@ │ │ │ │ dune-grid-glue 2.10 │ │ │ │ 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 edge │ │ │ │ -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:73 │ │ │ │ +_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:186 │ │ │ │ +_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:94 │ │ │ │ +_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:116 │ │ │ │ +_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:128 │ │ │ │ +_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:147 │ │ │ │ =============================================================================== │ │ │ │ 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>
│ │ │
│ │ │ @@ -429,15 +429,15 @@ │ │ │
369}
│ │ │
370
│ │ │
371} // namespace GridGlue
│ │ │
372
│ │ │
373} // namespace Dune
│ │ │
374
│ │ │
375#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: 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::Codim1Extractor< GV >
 
│ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ 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/a00062_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 edge
│ │ │ +
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:73
│ │ │ -
static constexpr auto codim
Definition extractor.hh:52
│ │ │ -
std::map< IndexType, VertexInfo > VertexInfoMap
Definition extractor.hh:186
│ │ │ -
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:116
│ │ │ -
simple struct holding an element seed and an index
Definition extractor.hh:128
│ │ │ -
Holds some information about an element's subentity involved in a coupling.
Definition extractor.hh:147
│ │ │ +
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.10 │ │ │ │ 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 edge │ │ │ │ +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:73 │ │ │ │ -_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:186 │ │ │ │ -_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:94 │ │ │ │ -_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:116 │ │ │ │ -_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:128 │ │ │ │ -_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:147 │ │ │ │ +_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/a00065.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-grid-glue: standardmerge.hh File Reference │ │ │ +dune-grid-glue: standardmerge.cc File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,85 +70,55 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -Classes | │ │ │ Namespaces | │ │ │ Macros | │ │ │ Functions
│ │ │ -
standardmerge.hh File Reference
│ │ │ +
standardmerge.cc File Reference
│ │ │
│ │ │
│ │ │ - │ │ │ -

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...
 
│ │ │ +
#include "config.h"
│ │ │ +#include "standardmerge.hh"
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ Namespaces

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

│ │ │ Macros

#define DECL   extern
#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

│ │ │ -

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

│ │ │ -

Macro Definition Documentation

│ │ │ +

Macro Definition Documentation

│ │ │ │ │ │

◆ DECL

│ │ │ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │
#define DECL   extern#define DECL
│ │ │
│ │ │ │ │ │
│ │ │
│ │ │ │ │ │ @@ -185,22 +155,22 @@ │ │ │ │ │ │ ) │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ Value:
DECL template \
│ │ │ -
void StandardMerge<T,A,B,C>::build(const std::vector<Dune::FieldVector<T,C> >& grid1Coords, \
│ │ │ +
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> >& grid2Coords, \
│ │ │ +
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.hh:827
│ │ │ +
#define DECL
Definition standardmerge.cc:12
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │