1072 { setup_neighborhood( domain_info, subdomain_info, subdomain_to_rank ); }
1075 {
return neighborhood_vertex_; }
1077 const std::map< BoundaryEdge, std::vector< NeighborSubdomainTupleEdge > >&
neighborhood_edge()
const
1078 {
return neighborhood_edge_; }
1080 const std::map< BoundaryFace, NeighborSubdomainTupleFace >&
neighborhood_face()
const {
return neighborhood_face_; }
1085 const mpi::MPIRank rank_will_be_overwritten_later = -1;
1087 const int diamond_id = subdomain_info.
diamond_id();
1088 const int subdomain_x = subdomain_info.
subdomain_x();
1089 const int subdomain_y = subdomain_info.
subdomain_y();
1090 const int subdomain_r = subdomain_info.
subdomain_r();
1097 const bool diamond_diamond_boundary =
1103 if ( diamond_diamond_boundary )
1135 switch ( diamond_id )
1143 switch ( boundary_face )
1148 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y, 0, subdomain_r ),
1151 rank_will_be_overwritten_later };
1155 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x, subdomain_r ),
1158 rank_will_be_overwritten_later };
1166 num_lateral_subdomains - 1,
1167 num_lateral_subdomains - 1 - subdomain_x,
1171 rank_will_be_overwritten_later };
1176 ( diamond_id + 4 ) % 5 + 5,
1177 num_lateral_subdomains - 1 - subdomain_y,
1178 num_lateral_subdomains - 1,
1182 rank_will_be_overwritten_later };
1186 Kokkos::abort(
"This should not happen." );
1196 switch ( boundary_face )
1201 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y, 0, subdomain_r ),
1204 rank_will_be_overwritten_later };
1208 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x, subdomain_r ),
1211 rank_will_be_overwritten_later };
1218 ( diamond_id - 4 ) % 5,
1219 num_lateral_subdomains - 1,
1220 num_lateral_subdomains - 1 - subdomain_x,
1224 rank_will_be_overwritten_later };
1230 num_lateral_subdomains - 1 - subdomain_y,
1231 num_lateral_subdomains - 1,
1235 rank_will_be_overwritten_later };
1238 Kokkos::abort(
"This should not happen." );
1243 Kokkos::abort(
"Invalid diamond id." );
1250 switch ( boundary_face )
1253 neighborhood_face_[boundary_face] = {
1254 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y, subdomain_r ),
1257 rank_will_be_overwritten_later };
1260 neighborhood_face_[boundary_face] = {
1261 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y, subdomain_r ),
1264 rank_will_be_overwritten_later };
1267 neighborhood_face_[boundary_face] = {
1268 SubdomainInfo( diamond_id, subdomain_x, subdomain_y - 1, subdomain_r ),
1271 rank_will_be_overwritten_later };
1274 neighborhood_face_[boundary_face] = {
1275 SubdomainInfo( diamond_id, subdomain_x, subdomain_y + 1, subdomain_r ),
1278 rank_will_be_overwritten_later };
1281 if ( subdomain_r > 0 )
1283 neighborhood_face_[boundary_face] = {
1284 SubdomainInfo( diamond_id, subdomain_x, subdomain_y, subdomain_r - 1 ),
1287 rank_will_be_overwritten_later };
1291 if ( subdomain_r < num_radial_subdomains - 1 )
1293 neighborhood_face_[boundary_face] = {
1294 SubdomainInfo( diamond_id, subdomain_x, subdomain_y, subdomain_r + 1 ),
1297 rank_will_be_overwritten_later };
1305 void setup_neighborhood_edges(
const DomainInfo& domain_info,
const SubdomainInfo& subdomain_info )
1307 const int diamond_id = subdomain_info.diamond_id();
1308 const int subdomain_x = subdomain_info.subdomain_x();
1309 const int subdomain_y = subdomain_info.subdomain_y();
1310 const int subdomain_r = subdomain_info.subdomain_r();
1312 const int num_lateral_subdomains = domain_info.num_subdomains_per_diamond_side();
1313 const int num_radial_subdomains = domain_info.num_subdomains_in_radial_direction();
1319 if ( diamond_id >= 0 && diamond_id <= 4 )
1323 if ( subdomain_x == 0 && subdomain_y == 0 )
1326 neighborhood_edge_[boundary_edge].emplace_back(
1327 SubdomainInfo( ( diamond_id + 2 ) % 5, 0, 0, subdomain_r ),
1331 neighborhood_edge_[boundary_edge].emplace_back(
1332 SubdomainInfo( ( diamond_id + 3 ) % 5, 0, 0, subdomain_r ),
1337 else if ( subdomain_x == 0 && subdomain_y > 0 )
1340 neighborhood_edge_[boundary_edge].emplace_back(
1341 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y - 1, 0, subdomain_r ),
1346 else if ( subdomain_x > 0 && subdomain_y == 0 )
1349 neighborhood_edge_[boundary_edge].emplace_back(
1350 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x - 1, subdomain_r ),
1358 if ( subdomain_x == 0 && subdomain_y < num_lateral_subdomains - 1 )
1361 neighborhood_edge_[boundary_edge].emplace_back(
1362 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y + 1, 0, subdomain_r ),
1367 else if ( subdomain_x > 0 && subdomain_y == num_lateral_subdomains - 1 )
1370 neighborhood_edge_[boundary_edge].emplace_back(
1373 num_lateral_subdomains - 1,
1374 num_lateral_subdomains - subdomain_x,
1383 if ( subdomain_y == 0 && subdomain_x < num_lateral_subdomains - 1 )
1386 neighborhood_edge_[boundary_edge].emplace_back(
1387 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x + 1, subdomain_r ),
1392 else if ( subdomain_y > 0 && subdomain_x == num_lateral_subdomains - 1 )
1395 neighborhood_edge_[boundary_edge].emplace_back(
1397 ( diamond_id + 4 ) % 5 + 5,
1398 num_lateral_subdomains - subdomain_y,
1399 num_lateral_subdomains - 1,
1408 if ( subdomain_x < num_lateral_subdomains - 1 && subdomain_y == num_lateral_subdomains - 1 )
1411 neighborhood_edge_[boundary_edge].emplace_back(
1414 num_lateral_subdomains - 1,
1415 num_lateral_subdomains - subdomain_x - 2,
1421 else if ( subdomain_y < num_lateral_subdomains - 1 && subdomain_x == num_lateral_subdomains - 1 )
1424 neighborhood_edge_[boundary_edge].emplace_back(
1426 ( diamond_id + 4 ) % 5 + 5,
1427 num_lateral_subdomains - subdomain_y - 2,
1428 num_lateral_subdomains - 1,
1436 else if ( diamond_id >= 5 && diamond_id <= 9 )
1440 if ( subdomain_x == 0 && subdomain_y == 0 )
1443 neighborhood_edge_[boundary_edge].emplace_back(
1444 SubdomainInfo( ( diamond_id + 2 ) % 5 + 5, 0, 0, subdomain_r ),
1448 neighborhood_edge_[boundary_edge].emplace_back(
1449 SubdomainInfo( ( diamond_id + 3 ) % 5 + 5, 0, 0, subdomain_r ),
1455 if ( subdomain_x == 0 && subdomain_y > 0 )
1458 neighborhood_edge_[boundary_edge].emplace_back(
1459 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y - 1, 0, subdomain_r ),
1464 else if ( subdomain_x > 0 && subdomain_y == 0 )
1467 neighborhood_edge_[boundary_edge].emplace_back(
1468 SubdomainInfo( ( diamond_id + 4 ) % 5 + 5, 0, subdomain_x - 1, subdomain_r ),
1477 if ( subdomain_x == 0 && subdomain_y < num_lateral_subdomains - 1 )
1480 neighborhood_edge_[boundary_edge].push_back(
1481 { SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y + 1, 0, subdomain_r ),
1486 else if ( subdomain_x > 0 && subdomain_y == num_lateral_subdomains - 1 )
1489 neighborhood_edge_[boundary_edge].push_back(
1491 ( diamond_id + 1 ) % 5,
1492 num_lateral_subdomains - 1,
1493 num_lateral_subdomains - subdomain_x,
1503 if ( subdomain_y == 0 && subdomain_x < num_lateral_subdomains - 1 )
1506 neighborhood_edge_[boundary_edge].emplace_back(
1507 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x + 1, subdomain_r ),
1512 else if ( subdomain_y > 0 && subdomain_x == num_lateral_subdomains - 1 )
1515 neighborhood_edge_[boundary_edge].emplace_back(
1518 num_lateral_subdomains - subdomain_y,
1519 num_lateral_subdomains - 1,
1529 if ( subdomain_x < num_lateral_subdomains - 1 && subdomain_y == num_lateral_subdomains - 1 )
1532 neighborhood_edge_[boundary_edge].emplace_back(
1534 ( diamond_id - 4 ) % 5,
1535 num_lateral_subdomains - 1,
1536 num_lateral_subdomains - subdomain_x - 2,
1542 else if ( subdomain_y < num_lateral_subdomains - 1 && subdomain_x == num_lateral_subdomains - 1 )
1545 neighborhood_edge_[boundary_edge].emplace_back(
1548 num_lateral_subdomains - subdomain_y - 2,
1549 num_lateral_subdomains - 1,
1559 Kokkos::abort(
"Invalid diamond ID." );
1564 if ( diamond_id >= 0 && diamond_id <= 4 )
1569 neighborhood_edge_[boundary_edge].emplace_back(
1570 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y, 0, subdomain_r - 1 ),
1577 subdomain_r < num_radial_subdomains - 1 )
1580 neighborhood_edge_[boundary_edge].emplace_back(
1581 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y, 0, subdomain_r + 1 ),
1589 neighborhood_edge_[boundary_edge].emplace_back(
1590 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x, subdomain_r - 1 ),
1597 subdomain_r < num_radial_subdomains - 1 )
1600 neighborhood_edge_[boundary_edge].emplace_back(
1601 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x, subdomain_r + 1 ),
1612 neighborhood_edge_[boundary_edge].emplace_back(
1615 num_lateral_subdomains - 1,
1616 num_lateral_subdomains - 1 - subdomain_x,
1624 subdomain_r < num_radial_subdomains - 1 )
1627 neighborhood_edge_[boundary_edge].emplace_back(
1630 num_lateral_subdomains - 1,
1631 num_lateral_subdomains - 1 - subdomain_x,
1642 neighborhood_edge_[boundary_edge].emplace_back(
1644 ( diamond_id + 4 ) % 5 + 5,
1645 num_lateral_subdomains - 1 - subdomain_y,
1646 num_lateral_subdomains - 1,
1654 subdomain_r < num_radial_subdomains - 1 )
1657 neighborhood_edge_[boundary_edge].emplace_back(
1659 ( diamond_id + 4 ) % 5 + 5,
1660 num_lateral_subdomains - 1 - subdomain_y,
1661 num_lateral_subdomains - 1,
1668 else if ( diamond_id >= 5 && diamond_id <= 9 )
1673 neighborhood_edge_[boundary_edge].emplace_back(
1674 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y, 0, subdomain_r - 1 ),
1681 subdomain_r < num_radial_subdomains - 1 )
1684 neighborhood_edge_[boundary_edge].emplace_back(
1685 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y, 0, subdomain_r + 1 ),
1693 neighborhood_edge_[boundary_edge].emplace_back(
1694 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x, subdomain_r - 1 ),
1701 subdomain_r < num_radial_subdomains - 1 )
1704 neighborhood_edge_[boundary_edge].emplace_back(
1705 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x, subdomain_r + 1 ),
1716 neighborhood_edge_[boundary_edge].emplace_back(
1718 ( diamond_id - 4 ) % 5,
1719 num_lateral_subdomains - 1,
1720 num_lateral_subdomains - 1 - subdomain_x,
1728 subdomain_r < num_radial_subdomains - 1 )
1731 neighborhood_edge_[boundary_edge].emplace_back(
1733 ( diamond_id - 4 ) % 5,
1734 num_lateral_subdomains - 1,
1735 num_lateral_subdomains - 1 - subdomain_x,
1746 neighborhood_edge_[boundary_edge].emplace_back(
1749 num_lateral_subdomains - 1 - subdomain_y,
1750 num_lateral_subdomains - 1,
1758 subdomain_r < num_radial_subdomains - 1 )
1761 neighborhood_edge_[boundary_edge].emplace_back(
1764 num_lateral_subdomains - 1 - subdomain_y,
1765 num_lateral_subdomains - 1,
1774 Kokkos::abort(
"Invalid diamond ID" );
1783 neighborhood_edge_[boundary_edge].emplace_back(
1784 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y - 1, subdomain_r ),
1790 boundary_edge ==
BoundaryEdge::E_10R && subdomain_x < num_lateral_subdomains - 1 && subdomain_y > 0 )
1792 neighborhood_edge_[boundary_edge].emplace_back(
1793 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y - 1, subdomain_r ),
1799 boundary_edge ==
BoundaryEdge::E_01R && subdomain_x > 0 && subdomain_y < num_lateral_subdomains - 1 )
1801 neighborhood_edge_[boundary_edge].emplace_back(
1802 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y + 1, subdomain_r ),
1809 subdomain_y < num_lateral_subdomains - 1 )
1811 neighborhood_edge_[boundary_edge].emplace_back(
1812 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y + 1, subdomain_r ),
1822 neighborhood_edge_[boundary_edge].emplace_back(
1823 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y, subdomain_r - 1 ),
1829 boundary_edge ==
BoundaryEdge::E_1Y0 && subdomain_x < num_lateral_subdomains - 1 && subdomain_r > 0 )
1831 neighborhood_edge_[boundary_edge].emplace_back(
1832 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y, subdomain_r - 1 ),
1838 boundary_edge ==
BoundaryEdge::E_0Y1 && subdomain_x > 0 && subdomain_r < num_radial_subdomains - 1 )
1840 neighborhood_edge_[boundary_edge].emplace_back(
1841 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y, subdomain_r + 1 ),
1848 subdomain_r < num_radial_subdomains - 1 )
1850 neighborhood_edge_[boundary_edge].emplace_back(
1851 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y, subdomain_r + 1 ),
1861 neighborhood_edge_[boundary_edge].emplace_back(
1862 SubdomainInfo( diamond_id, subdomain_x, subdomain_y - 1, subdomain_r - 1 ),
1868 boundary_edge ==
BoundaryEdge::E_X10 && subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
1870 neighborhood_edge_[boundary_edge].emplace_back(
1871 SubdomainInfo( diamond_id, subdomain_x, subdomain_y + 1, subdomain_r - 1 ),
1877 boundary_edge ==
BoundaryEdge::E_X01 && subdomain_y > 0 && subdomain_r < num_radial_subdomains - 1 )
1879 neighborhood_edge_[boundary_edge].emplace_back(
1880 SubdomainInfo( diamond_id, subdomain_x, subdomain_y - 1, subdomain_r + 1 ),
1887 subdomain_r < num_radial_subdomains - 1 )
1889 neighborhood_edge_[boundary_edge].emplace_back(
1890 SubdomainInfo( diamond_id, subdomain_x, subdomain_y + 1, subdomain_r + 1 ),
1898 void setup_neighborhood_vertices(
const DomainInfo& domain_info,
const SubdomainInfo& subdomain_info )
1900 const int diamond_id = subdomain_info.diamond_id();
1901 const int subdomain_x = subdomain_info.subdomain_x();
1902 const int subdomain_y = subdomain_info.subdomain_y();
1903 const int subdomain_r = subdomain_info.subdomain_r();
1905 const int num_lateral_subdomains = domain_info.num_subdomains_per_diamond_side();
1906 const int num_radial_subdomains = domain_info.num_subdomains_in_radial_direction();
1911 if ( diamond_id >= 0 && diamond_id <= 4 )
1918 neighborhood_vertex_[boundary_vertex].emplace_back(
1920 neighborhood_vertex_[boundary_vertex].emplace_back(
1925 subdomain_r < num_radial_subdomains - 1 )
1927 neighborhood_vertex_[boundary_vertex].emplace_back(
1929 neighborhood_vertex_[boundary_vertex].emplace_back(
1940 neighborhood_vertex_[boundary_vertex].emplace_back(
1941 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y - 1, 0, subdomain_r - 1 ),
1947 subdomain_r < num_radial_subdomains - 1 )
1949 neighborhood_vertex_[boundary_vertex].emplace_back(
1950 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y - 1, 0, subdomain_r + 1 ),
1962 neighborhood_vertex_[boundary_vertex].emplace_back(
1963 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x - 1, subdomain_r - 1 ),
1969 subdomain_r < num_radial_subdomains - 1 )
1971 neighborhood_vertex_[boundary_vertex].emplace_back(
1972 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x - 1, subdomain_r + 1 ),
1982 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
1984 neighborhood_vertex_[boundary_vertex].emplace_back(
1985 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y + 1, 0, subdomain_r - 1 ),
1991 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
1993 neighborhood_vertex_[boundary_vertex].emplace_back(
1994 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y + 1, 0, subdomain_r + 1 ),
2004 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
2006 neighborhood_vertex_[boundary_vertex].emplace_back(
2009 num_lateral_subdomains - 1,
2010 num_lateral_subdomains - subdomain_x,
2017 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2019 neighborhood_vertex_[boundary_vertex].emplace_back(
2022 num_lateral_subdomains - 1,
2023 num_lateral_subdomains - subdomain_x,
2034 subdomain_x < num_lateral_subdomains - 1 && subdomain_r > 0 )
2036 neighborhood_vertex_[boundary_vertex].emplace_back(
2037 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x + 1, subdomain_r - 1 ),
2043 subdomain_x < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2045 neighborhood_vertex_[boundary_vertex].emplace_back(
2046 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x + 1, subdomain_r + 1 ),
2056 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2058 neighborhood_vertex_[boundary_vertex].emplace_back(
2060 ( diamond_id + 4 ) % 5 + 5,
2061 num_lateral_subdomains - subdomain_y,
2062 num_lateral_subdomains - 1,
2069 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2071 neighborhood_vertex_[boundary_vertex].emplace_back(
2073 ( diamond_id + 4 ) % 5 + 5,
2074 num_lateral_subdomains - subdomain_y,
2075 num_lateral_subdomains - 1,
2086 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
2088 neighborhood_vertex_[boundary_vertex].emplace_back(
2091 num_lateral_subdomains - 1,
2092 num_lateral_subdomains - subdomain_x - 2,
2099 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2101 neighborhood_vertex_[boundary_vertex].emplace_back(
2104 num_lateral_subdomains - 1,
2105 num_lateral_subdomains - subdomain_x - 2,
2116 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2118 neighborhood_vertex_[boundary_vertex].emplace_back(
2120 ( diamond_id + 4 ) % 5 + 5,
2121 num_lateral_subdomains - subdomain_y - 2,
2122 num_lateral_subdomains - 1,
2129 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2131 neighborhood_vertex_[boundary_vertex].emplace_back(
2133 ( diamond_id + 4 ) % 5 + 5,
2134 num_lateral_subdomains - subdomain_y - 2,
2135 num_lateral_subdomains - 1,
2142 else if ( diamond_id >= 5 && diamond_id <= 9 )
2149 neighborhood_vertex_[boundary_vertex].emplace_back(
2150 SubdomainInfo( ( diamond_id + 2 ) % 5 + 5, 0, 0, subdomain_r - 1 ),
2153 neighborhood_vertex_[boundary_vertex].emplace_back(
2154 SubdomainInfo( ( diamond_id + 3 ) % 5 + 5, 0, 0, subdomain_r - 1 ),
2160 subdomain_r < num_radial_subdomains - 1 )
2162 neighborhood_vertex_[boundary_vertex].emplace_back(
2163 SubdomainInfo( ( diamond_id + 2 ) % 5 + 5, 0, 0, subdomain_r + 1 ),
2166 neighborhood_vertex_[boundary_vertex].emplace_back(
2167 SubdomainInfo( ( diamond_id + 3 ) % 5 + 5, 0, 0, subdomain_r + 1 ),
2179 neighborhood_vertex_[boundary_vertex].emplace_back(
2180 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y - 1, 0, subdomain_r - 1 ),
2186 subdomain_r < num_radial_subdomains - 1 )
2188 neighborhood_vertex_[boundary_vertex].emplace_back(
2189 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y - 1, 0, subdomain_r + 1 ),
2201 neighborhood_vertex_[boundary_vertex].emplace_back(
2202 SubdomainInfo( ( diamond_id + 4 ) % 5 + 5, 0, subdomain_x - 1, subdomain_r - 1 ),
2208 subdomain_r < num_radial_subdomains - 1 )
2210 neighborhood_vertex_[boundary_vertex].emplace_back(
2211 SubdomainInfo( ( diamond_id + 4 ) % 5 + 5, 0, subdomain_x - 1, subdomain_r + 1 ),
2221 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
2223 neighborhood_vertex_[boundary_vertex].emplace_back(
2224 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y + 1, 0, subdomain_r - 1 ),
2230 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2232 neighborhood_vertex_[boundary_vertex].emplace_back(
2233 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y + 1, 0, subdomain_r + 1 ),
2243 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
2245 neighborhood_vertex_[boundary_vertex].emplace_back(
2247 ( diamond_id + 1 ) % 5,
2248 num_lateral_subdomains - 1,
2249 num_lateral_subdomains - subdomain_x,
2256 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2258 neighborhood_vertex_[boundary_vertex].emplace_back(
2260 ( diamond_id + 1 ) % 5,
2261 num_lateral_subdomains - 1,
2262 num_lateral_subdomains - subdomain_x,
2273 subdomain_x < num_lateral_subdomains - 1 && subdomain_r > 0 )
2275 neighborhood_vertex_[boundary_vertex].emplace_back(
2276 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x + 1, subdomain_r - 1 ),
2282 subdomain_x < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2284 neighborhood_vertex_[boundary_vertex].emplace_back(
2285 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x + 1, subdomain_r + 1 ),
2295 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2297 neighborhood_vertex_[boundary_vertex].emplace_back(
2300 num_lateral_subdomains - subdomain_y,
2301 num_lateral_subdomains - 1,
2308 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2310 neighborhood_vertex_[boundary_vertex].emplace_back(
2313 num_lateral_subdomains - subdomain_y,
2314 num_lateral_subdomains - 1,
2325 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
2327 neighborhood_vertex_[boundary_vertex].emplace_back(
2329 ( diamond_id - 4 ) % 5,
2330 num_lateral_subdomains - 1,
2331 num_lateral_subdomains - subdomain_x - 2,
2338 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2340 neighborhood_vertex_[boundary_vertex].emplace_back(
2342 ( diamond_id - 4 ) % 5,
2343 num_lateral_subdomains - 1,
2344 num_lateral_subdomains - subdomain_x - 2,
2354 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2356 neighborhood_vertex_[boundary_vertex].emplace_back(
2359 num_lateral_subdomains - subdomain_y - 2,
2360 num_lateral_subdomains - 1,
2367 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2369 neighborhood_vertex_[boundary_vertex].emplace_back(
2372 num_lateral_subdomains - subdomain_y - 2,
2373 num_lateral_subdomains - 1,
2382 Kokkos::abort(
"Invalid diamond ID." );
2387 if ( boundary_vertex ==
BoundaryVertex::V_000 && subdomain_x > 0 && subdomain_y > 0 && subdomain_r > 0 )
2389 neighborhood_vertex_[boundary_vertex].emplace_back(
2390 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y - 1, subdomain_r - 1 ),
2396 subdomain_y > 0 && subdomain_r > 0 )
2398 neighborhood_vertex_[boundary_vertex].emplace_back(
2399 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y - 1, subdomain_r - 1 ),
2405 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
2407 neighborhood_vertex_[boundary_vertex].emplace_back(
2408 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y + 1, subdomain_r - 1 ),
2414 subdomain_r < num_radial_subdomains - 1 )
2416 neighborhood_vertex_[boundary_vertex].emplace_back(
2417 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y - 1, subdomain_r + 1 ),
2423 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
2425 neighborhood_vertex_[boundary_vertex].emplace_back(
2426 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y + 1, subdomain_r - 1 ),
2432 subdomain_y > 0 && subdomain_r < num_radial_subdomains - 1 )
2434 neighborhood_vertex_[boundary_vertex].emplace_back(
2435 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y - 1, subdomain_r + 1 ),
2441 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2443 neighborhood_vertex_[boundary_vertex].emplace_back(
2444 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y + 1, subdomain_r + 1 ),
2450 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2452 neighborhood_vertex_[boundary_vertex].emplace_back(
2453 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y + 1, subdomain_r + 1 ),
2460 void setup_neighborhood_ranks(
2461 const DomainInfo& domain_info,
2464 for (
auto& neighbors : neighborhood_vertex_ | std::views::values )
2466 for (
auto& [neighbor_subdomain_info, neighbor_boundary_vertex, neighbor_rank] : neighbors )
2468 neighbor_rank = subdomain_to_rank(
2469 neighbor_subdomain_info,
2470 domain_info.num_subdomains_per_diamond_side(),
2471 domain_info.num_subdomains_in_radial_direction() );
2475 for (
auto& neighbors : neighborhood_edge_ | std::views::values )
2477 for (
auto& [neighbor_subdomain_info, neighbor_boundary_edge, _, neighbor_rank] : neighbors )
2479 neighbor_rank = subdomain_to_rank(
2480 neighbor_subdomain_info,
2481 domain_info.num_subdomains_per_diamond_side(),
2482 domain_info.num_subdomains_in_radial_direction() );
2486 for (
auto& [neighbor_subdomain_info, neighbor_boundary_face, _, neighbor_rank] :
2487 neighborhood_face_ | std::views::values )
2489 neighbor_rank = subdomain_to_rank(
2490 neighbor_subdomain_info,
2491 domain_info.num_subdomains_per_diamond_side(),
2492 domain_info.num_subdomains_in_radial_direction() );
2496 void setup_neighborhood(
2497 const DomainInfo& domain_info,
2498 const SubdomainInfo& subdomain_info,
2501 setup_neighborhood_faces( domain_info, subdomain_info );
2502 setup_neighborhood_edges( domain_info, subdomain_info );
2503 setup_neighborhood_vertices( domain_info, subdomain_info );
2504 setup_neighborhood_ranks( domain_info, subdomain_to_rank );
2507 std::map< BoundaryVertex, std::vector< NeighborSubdomainTupleVertex > > neighborhood_vertex_;
2508 std::map< BoundaryEdge, std::vector< NeighborSubdomainTupleEdge > > neighborhood_edge_;
2509 std::map< BoundaryFace, NeighborSubdomainTupleFace > neighborhood_face_;