1047 setup_neighborhood( domain_info, subdomain_info, subdomain_to_rank );
1052 return neighborhood_vertex_;
1055 const std::map< BoundaryEdge, std::vector< NeighborSubdomainTupleEdge > >&
neighborhood_edge()
const
1057 return neighborhood_edge_;
1060 const std::map< BoundaryFace, NeighborSubdomainTupleFace >&
neighborhood_face()
const {
return neighborhood_face_; }
1065 const mpi::MPIRank rank_will_be_overwritten_later = -1;
1067 const int diamond_id = subdomain_info.
diamond_id();
1068 const int subdomain_x = subdomain_info.
subdomain_x();
1069 const int subdomain_y = subdomain_info.
subdomain_y();
1070 const int subdomain_r = subdomain_info.
subdomain_r();
1077 const bool diamond_diamond_boundary =
1083 if ( diamond_diamond_boundary )
1115 switch ( diamond_id )
1123 switch ( boundary_face )
1128 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y, 0, subdomain_r ),
1131 rank_will_be_overwritten_later };
1135 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x, subdomain_r ),
1138 rank_will_be_overwritten_later };
1146 num_lateral_subdomains - 1,
1147 num_lateral_subdomains - 1 - subdomain_x,
1151 rank_will_be_overwritten_later };
1156 ( diamond_id + 4 ) % 5 + 5,
1157 num_lateral_subdomains - 1 - subdomain_y,
1158 num_lateral_subdomains - 1,
1162 rank_will_be_overwritten_later };
1166 Kokkos::abort(
"This should not happen." );
1176 switch ( boundary_face )
1181 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y, 0, subdomain_r ),
1184 rank_will_be_overwritten_later };
1188 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x, subdomain_r ),
1191 rank_will_be_overwritten_later };
1198 ( diamond_id - 4 ) % 5,
1199 num_lateral_subdomains - 1,
1200 num_lateral_subdomains - 1 - subdomain_x,
1204 rank_will_be_overwritten_later };
1210 num_lateral_subdomains - 1 - subdomain_y,
1211 num_lateral_subdomains - 1,
1215 rank_will_be_overwritten_later };
1218 Kokkos::abort(
"This should not happen." );
1223 Kokkos::abort(
"Invalid diamond id." );
1230 switch ( boundary_face )
1233 neighborhood_face_[boundary_face] = {
1234 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y, subdomain_r ),
1237 rank_will_be_overwritten_later };
1240 neighborhood_face_[boundary_face] = {
1241 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y, subdomain_r ),
1244 rank_will_be_overwritten_later };
1247 neighborhood_face_[boundary_face] = {
1248 SubdomainInfo( diamond_id, subdomain_x, subdomain_y - 1, subdomain_r ),
1251 rank_will_be_overwritten_later };
1254 neighborhood_face_[boundary_face] = {
1255 SubdomainInfo( diamond_id, subdomain_x, subdomain_y + 1, subdomain_r ),
1258 rank_will_be_overwritten_later };
1261 if ( subdomain_r > 0 )
1263 neighborhood_face_[boundary_face] = {
1264 SubdomainInfo( diamond_id, subdomain_x, subdomain_y, subdomain_r - 1 ),
1267 rank_will_be_overwritten_later };
1271 if ( subdomain_r < num_radial_subdomains - 1 )
1273 neighborhood_face_[boundary_face] = {
1274 SubdomainInfo( diamond_id, subdomain_x, subdomain_y, subdomain_r + 1 ),
1277 rank_will_be_overwritten_later };
1285 void setup_neighborhood_edges(
const DomainInfo& domain_info,
const SubdomainInfo& subdomain_info )
1287 const int diamond_id = subdomain_info.diamond_id();
1288 const int subdomain_x = subdomain_info.subdomain_x();
1289 const int subdomain_y = subdomain_info.subdomain_y();
1290 const int subdomain_r = subdomain_info.subdomain_r();
1292 const int num_lateral_subdomains = domain_info.num_subdomains_per_diamond_side();
1293 const int num_radial_subdomains = domain_info.num_subdomains_in_radial_direction();
1299 if ( diamond_id >= 0 && diamond_id <= 4 )
1303 if ( subdomain_x == 0 && subdomain_y == 0 )
1306 neighborhood_edge_[boundary_edge].emplace_back(
1307 SubdomainInfo( ( diamond_id + 2 ) % 5, 0, 0, subdomain_r ),
1311 neighborhood_edge_[boundary_edge].emplace_back(
1312 SubdomainInfo( ( diamond_id + 3 ) % 5, 0, 0, subdomain_r ),
1317 else if ( subdomain_x == 0 && subdomain_y > 0 )
1320 neighborhood_edge_[boundary_edge].emplace_back(
1321 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y - 1, 0, subdomain_r ),
1326 else if ( subdomain_x > 0 && subdomain_y == 0 )
1329 neighborhood_edge_[boundary_edge].emplace_back(
1330 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x - 1, subdomain_r ),
1338 if ( subdomain_x == 0 && subdomain_y < num_lateral_subdomains - 1 )
1341 neighborhood_edge_[boundary_edge].emplace_back(
1342 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y + 1, 0, subdomain_r ),
1347 else if ( subdomain_x > 0 && subdomain_y == num_lateral_subdomains - 1 )
1350 neighborhood_edge_[boundary_edge].emplace_back(
1353 num_lateral_subdomains - 1,
1354 num_lateral_subdomains - subdomain_x,
1363 if ( subdomain_y == 0 && subdomain_x < num_lateral_subdomains - 1 )
1366 neighborhood_edge_[boundary_edge].emplace_back(
1367 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x + 1, subdomain_r ),
1372 else if ( subdomain_y > 0 && subdomain_x == num_lateral_subdomains - 1 )
1375 neighborhood_edge_[boundary_edge].emplace_back(
1377 ( diamond_id + 4 ) % 5 + 5,
1378 num_lateral_subdomains - subdomain_y,
1379 num_lateral_subdomains - 1,
1388 if ( subdomain_x < num_lateral_subdomains - 1 && subdomain_y == num_lateral_subdomains - 1 )
1391 neighborhood_edge_[boundary_edge].emplace_back(
1394 num_lateral_subdomains - 1,
1395 num_lateral_subdomains - subdomain_x - 2,
1401 else if ( subdomain_y < num_lateral_subdomains - 1 && subdomain_x == num_lateral_subdomains - 1 )
1404 neighborhood_edge_[boundary_edge].emplace_back(
1406 ( diamond_id + 4 ) % 5 + 5,
1407 num_lateral_subdomains - subdomain_y - 2,
1408 num_lateral_subdomains - 1,
1416 else if ( diamond_id >= 5 && diamond_id <= 9 )
1420 if ( subdomain_x == 0 && subdomain_y == 0 )
1423 neighborhood_edge_[boundary_edge].emplace_back(
1424 SubdomainInfo( ( diamond_id + 2 ) % 5 + 5, 0, 0, subdomain_r ),
1428 neighborhood_edge_[boundary_edge].emplace_back(
1429 SubdomainInfo( ( diamond_id + 3 ) % 5 + 5, 0, 0, subdomain_r ),
1435 if ( subdomain_x == 0 && subdomain_y > 0 )
1438 neighborhood_edge_[boundary_edge].emplace_back(
1439 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y - 1, 0, subdomain_r ),
1444 else if ( subdomain_x > 0 && subdomain_y == 0 )
1447 neighborhood_edge_[boundary_edge].emplace_back(
1448 SubdomainInfo( ( diamond_id + 4 ) % 5 + 5, 0, subdomain_x - 1, subdomain_r ),
1457 if ( subdomain_x == 0 && subdomain_y < num_lateral_subdomains - 1 )
1460 neighborhood_edge_[boundary_edge].push_back(
1461 { SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y + 1, 0, subdomain_r ),
1466 else if ( subdomain_x > 0 && subdomain_y == num_lateral_subdomains - 1 )
1469 neighborhood_edge_[boundary_edge].push_back(
1471 ( diamond_id + 1 ) % 5,
1472 num_lateral_subdomains - 1,
1473 num_lateral_subdomains - subdomain_x,
1483 if ( subdomain_y == 0 && subdomain_x < num_lateral_subdomains - 1 )
1486 neighborhood_edge_[boundary_edge].emplace_back(
1487 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x + 1, subdomain_r ),
1492 else if ( subdomain_y > 0 && subdomain_x == num_lateral_subdomains - 1 )
1495 neighborhood_edge_[boundary_edge].emplace_back(
1498 num_lateral_subdomains - subdomain_y,
1499 num_lateral_subdomains - 1,
1509 if ( subdomain_x < num_lateral_subdomains - 1 && subdomain_y == num_lateral_subdomains - 1 )
1512 neighborhood_edge_[boundary_edge].emplace_back(
1514 ( diamond_id - 4 ) % 5,
1515 num_lateral_subdomains - 1,
1516 num_lateral_subdomains - subdomain_x - 2,
1522 else if ( subdomain_y < num_lateral_subdomains - 1 && subdomain_x == num_lateral_subdomains - 1 )
1525 neighborhood_edge_[boundary_edge].emplace_back(
1528 num_lateral_subdomains - subdomain_y - 2,
1529 num_lateral_subdomains - 1,
1539 Kokkos::abort(
"Invalid diamond ID." );
1544 if ( diamond_id >= 0 && diamond_id <= 4 )
1549 neighborhood_edge_[boundary_edge].emplace_back(
1550 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y, 0, subdomain_r - 1 ),
1557 subdomain_r < num_radial_subdomains - 1 )
1560 neighborhood_edge_[boundary_edge].emplace_back(
1561 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y, 0, subdomain_r + 1 ),
1569 neighborhood_edge_[boundary_edge].emplace_back(
1570 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x, subdomain_r - 1 ),
1577 subdomain_r < num_radial_subdomains - 1 )
1580 neighborhood_edge_[boundary_edge].emplace_back(
1581 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x, subdomain_r + 1 ),
1592 neighborhood_edge_[boundary_edge].emplace_back(
1595 num_lateral_subdomains - 1,
1596 num_lateral_subdomains - 1 - subdomain_x,
1604 subdomain_r < num_radial_subdomains - 1 )
1607 neighborhood_edge_[boundary_edge].emplace_back(
1610 num_lateral_subdomains - 1,
1611 num_lateral_subdomains - 1 - subdomain_x,
1622 neighborhood_edge_[boundary_edge].emplace_back(
1624 ( diamond_id + 4 ) % 5 + 5,
1625 num_lateral_subdomains - 1 - subdomain_y,
1626 num_lateral_subdomains - 1,
1634 subdomain_r < num_radial_subdomains - 1 )
1637 neighborhood_edge_[boundary_edge].emplace_back(
1639 ( diamond_id + 4 ) % 5 + 5,
1640 num_lateral_subdomains - 1 - subdomain_y,
1641 num_lateral_subdomains - 1,
1648 else if ( diamond_id >= 5 && diamond_id <= 9 )
1653 neighborhood_edge_[boundary_edge].emplace_back(
1654 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y, 0, subdomain_r - 1 ),
1661 subdomain_r < num_radial_subdomains - 1 )
1664 neighborhood_edge_[boundary_edge].emplace_back(
1665 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y, 0, subdomain_r + 1 ),
1673 neighborhood_edge_[boundary_edge].emplace_back(
1674 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x, subdomain_r - 1 ),
1681 subdomain_r < num_radial_subdomains - 1 )
1684 neighborhood_edge_[boundary_edge].emplace_back(
1685 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x, subdomain_r + 1 ),
1696 neighborhood_edge_[boundary_edge].emplace_back(
1698 ( diamond_id - 4 ) % 5,
1699 num_lateral_subdomains - 1,
1700 num_lateral_subdomains - 1 - subdomain_x,
1708 subdomain_r < num_radial_subdomains - 1 )
1711 neighborhood_edge_[boundary_edge].emplace_back(
1713 ( diamond_id - 4 ) % 5,
1714 num_lateral_subdomains - 1,
1715 num_lateral_subdomains - 1 - subdomain_x,
1726 neighborhood_edge_[boundary_edge].emplace_back(
1729 num_lateral_subdomains - 1 - subdomain_y,
1730 num_lateral_subdomains - 1,
1738 subdomain_r < num_radial_subdomains - 1 )
1741 neighborhood_edge_[boundary_edge].emplace_back(
1744 num_lateral_subdomains - 1 - subdomain_y,
1745 num_lateral_subdomains - 1,
1754 Kokkos::abort(
"Invalid diamond ID" );
1763 neighborhood_edge_[boundary_edge].emplace_back(
1764 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y - 1, subdomain_r ),
1770 boundary_edge ==
BoundaryEdge::E_10R && subdomain_x < num_lateral_subdomains - 1 && subdomain_y > 0 )
1772 neighborhood_edge_[boundary_edge].emplace_back(
1773 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y - 1, subdomain_r ),
1779 boundary_edge ==
BoundaryEdge::E_01R && subdomain_x > 0 && subdomain_y < num_lateral_subdomains - 1 )
1781 neighborhood_edge_[boundary_edge].emplace_back(
1782 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y + 1, subdomain_r ),
1789 subdomain_y < num_lateral_subdomains - 1 )
1791 neighborhood_edge_[boundary_edge].emplace_back(
1792 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y + 1, subdomain_r ),
1802 neighborhood_edge_[boundary_edge].emplace_back(
1803 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y, subdomain_r - 1 ),
1809 boundary_edge ==
BoundaryEdge::E_1Y0 && subdomain_x < num_lateral_subdomains - 1 && subdomain_r > 0 )
1811 neighborhood_edge_[boundary_edge].emplace_back(
1812 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y, subdomain_r - 1 ),
1818 boundary_edge ==
BoundaryEdge::E_0Y1 && subdomain_x > 0 && subdomain_r < num_radial_subdomains - 1 )
1820 neighborhood_edge_[boundary_edge].emplace_back(
1821 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y, subdomain_r + 1 ),
1828 subdomain_r < num_radial_subdomains - 1 )
1830 neighborhood_edge_[boundary_edge].emplace_back(
1831 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y, subdomain_r + 1 ),
1841 neighborhood_edge_[boundary_edge].emplace_back(
1842 SubdomainInfo( diamond_id, subdomain_x, subdomain_y - 1, subdomain_r - 1 ),
1848 boundary_edge ==
BoundaryEdge::E_X10 && subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
1850 neighborhood_edge_[boundary_edge].emplace_back(
1851 SubdomainInfo( diamond_id, subdomain_x, subdomain_y + 1, subdomain_r - 1 ),
1857 boundary_edge ==
BoundaryEdge::E_X01 && subdomain_y > 0 && subdomain_r < num_radial_subdomains - 1 )
1859 neighborhood_edge_[boundary_edge].emplace_back(
1860 SubdomainInfo( diamond_id, subdomain_x, subdomain_y - 1, subdomain_r + 1 ),
1867 subdomain_r < num_radial_subdomains - 1 )
1869 neighborhood_edge_[boundary_edge].emplace_back(
1870 SubdomainInfo( diamond_id, subdomain_x, subdomain_y + 1, subdomain_r + 1 ),
1878 void setup_neighborhood_vertices(
const DomainInfo& domain_info,
const SubdomainInfo& subdomain_info )
1880 const int diamond_id = subdomain_info.diamond_id();
1881 const int subdomain_x = subdomain_info.subdomain_x();
1882 const int subdomain_y = subdomain_info.subdomain_y();
1883 const int subdomain_r = subdomain_info.subdomain_r();
1885 const int num_lateral_subdomains = domain_info.num_subdomains_per_diamond_side();
1886 const int num_radial_subdomains = domain_info.num_subdomains_in_radial_direction();
1891 if ( diamond_id >= 0 && diamond_id <= 4 )
1898 neighborhood_vertex_[boundary_vertex].emplace_back(
1900 neighborhood_vertex_[boundary_vertex].emplace_back(
1905 subdomain_r < num_radial_subdomains - 1 )
1907 neighborhood_vertex_[boundary_vertex].emplace_back(
1909 neighborhood_vertex_[boundary_vertex].emplace_back(
1920 neighborhood_vertex_[boundary_vertex].emplace_back(
1921 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y - 1, 0, subdomain_r - 1 ),
1927 subdomain_r < num_radial_subdomains - 1 )
1929 neighborhood_vertex_[boundary_vertex].emplace_back(
1930 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y - 1, 0, subdomain_r + 1 ),
1942 neighborhood_vertex_[boundary_vertex].emplace_back(
1943 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x - 1, subdomain_r - 1 ),
1949 subdomain_r < num_radial_subdomains - 1 )
1951 neighborhood_vertex_[boundary_vertex].emplace_back(
1952 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x - 1, subdomain_r + 1 ),
1962 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
1964 neighborhood_vertex_[boundary_vertex].emplace_back(
1965 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y + 1, 0, subdomain_r - 1 ),
1971 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
1973 neighborhood_vertex_[boundary_vertex].emplace_back(
1974 SubdomainInfo( ( diamond_id + 1 ) % 5, subdomain_y + 1, 0, subdomain_r + 1 ),
1984 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
1986 neighborhood_vertex_[boundary_vertex].emplace_back(
1989 num_lateral_subdomains - 1,
1990 num_lateral_subdomains - subdomain_x,
1997 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
1999 neighborhood_vertex_[boundary_vertex].emplace_back(
2002 num_lateral_subdomains - 1,
2003 num_lateral_subdomains - subdomain_x,
2014 subdomain_x < num_lateral_subdomains - 1 && subdomain_r > 0 )
2016 neighborhood_vertex_[boundary_vertex].emplace_back(
2017 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x + 1, subdomain_r - 1 ),
2023 subdomain_x < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2025 neighborhood_vertex_[boundary_vertex].emplace_back(
2026 SubdomainInfo( ( diamond_id + 4 ) % 5, 0, subdomain_x + 1, subdomain_r + 1 ),
2036 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2038 neighborhood_vertex_[boundary_vertex].emplace_back(
2040 ( diamond_id + 4 ) % 5 + 5,
2041 num_lateral_subdomains - subdomain_y,
2042 num_lateral_subdomains - 1,
2049 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2051 neighborhood_vertex_[boundary_vertex].emplace_back(
2053 ( diamond_id + 4 ) % 5 + 5,
2054 num_lateral_subdomains - subdomain_y,
2055 num_lateral_subdomains - 1,
2066 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
2068 neighborhood_vertex_[boundary_vertex].emplace_back(
2071 num_lateral_subdomains - 1,
2072 num_lateral_subdomains - subdomain_x - 2,
2079 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2081 neighborhood_vertex_[boundary_vertex].emplace_back(
2084 num_lateral_subdomains - 1,
2085 num_lateral_subdomains - subdomain_x - 2,
2096 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2098 neighborhood_vertex_[boundary_vertex].emplace_back(
2100 ( diamond_id + 4 ) % 5 + 5,
2101 num_lateral_subdomains - subdomain_y - 2,
2102 num_lateral_subdomains - 1,
2109 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2111 neighborhood_vertex_[boundary_vertex].emplace_back(
2113 ( diamond_id + 4 ) % 5 + 5,
2114 num_lateral_subdomains - subdomain_y - 2,
2115 num_lateral_subdomains - 1,
2122 else if ( diamond_id >= 5 && diamond_id <= 9 )
2129 neighborhood_vertex_[boundary_vertex].emplace_back(
2130 SubdomainInfo( ( diamond_id + 2 ) % 5 + 5, 0, 0, subdomain_r - 1 ),
2133 neighborhood_vertex_[boundary_vertex].emplace_back(
2134 SubdomainInfo( ( diamond_id + 3 ) % 5 + 5, 0, 0, subdomain_r - 1 ),
2140 subdomain_r < num_radial_subdomains - 1 )
2142 neighborhood_vertex_[boundary_vertex].emplace_back(
2143 SubdomainInfo( ( diamond_id + 2 ) % 5 + 5, 0, 0, subdomain_r + 1 ),
2146 neighborhood_vertex_[boundary_vertex].emplace_back(
2147 SubdomainInfo( ( diamond_id + 3 ) % 5 + 5, 0, 0, subdomain_r + 1 ),
2159 neighborhood_vertex_[boundary_vertex].emplace_back(
2160 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y - 1, 0, subdomain_r - 1 ),
2166 subdomain_r < num_radial_subdomains - 1 )
2168 neighborhood_vertex_[boundary_vertex].emplace_back(
2169 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y - 1, 0, subdomain_r + 1 ),
2181 neighborhood_vertex_[boundary_vertex].emplace_back(
2182 SubdomainInfo( ( diamond_id + 4 ) % 5 + 5, 0, subdomain_x - 1, subdomain_r - 1 ),
2188 subdomain_r < num_radial_subdomains - 1 )
2190 neighborhood_vertex_[boundary_vertex].emplace_back(
2191 SubdomainInfo( ( diamond_id + 4 ) % 5 + 5, 0, subdomain_x - 1, subdomain_r + 1 ),
2201 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
2203 neighborhood_vertex_[boundary_vertex].emplace_back(
2204 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y + 1, 0, subdomain_r - 1 ),
2210 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2212 neighborhood_vertex_[boundary_vertex].emplace_back(
2213 SubdomainInfo( ( diamond_id + 1 ) % 5 + 5, subdomain_y + 1, 0, subdomain_r + 1 ),
2223 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
2225 neighborhood_vertex_[boundary_vertex].emplace_back(
2227 ( diamond_id + 1 ) % 5,
2228 num_lateral_subdomains - 1,
2229 num_lateral_subdomains - subdomain_x,
2236 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2238 neighborhood_vertex_[boundary_vertex].emplace_back(
2240 ( diamond_id + 1 ) % 5,
2241 num_lateral_subdomains - 1,
2242 num_lateral_subdomains - subdomain_x,
2253 subdomain_x < num_lateral_subdomains - 1 && subdomain_r > 0 )
2255 neighborhood_vertex_[boundary_vertex].emplace_back(
2256 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x + 1, subdomain_r - 1 ),
2262 subdomain_x < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2264 neighborhood_vertex_[boundary_vertex].emplace_back(
2265 SubdomainInfo( ( diamond_id - 1 ) % 5 + 5, 0, subdomain_x + 1, subdomain_r + 1 ),
2275 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2277 neighborhood_vertex_[boundary_vertex].emplace_back(
2280 num_lateral_subdomains - subdomain_y,
2281 num_lateral_subdomains - 1,
2288 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2290 neighborhood_vertex_[boundary_vertex].emplace_back(
2293 num_lateral_subdomains - subdomain_y,
2294 num_lateral_subdomains - 1,
2305 subdomain_y == num_lateral_subdomains - 1 && subdomain_r > 0 )
2307 neighborhood_vertex_[boundary_vertex].emplace_back(
2309 ( diamond_id - 4 ) % 5,
2310 num_lateral_subdomains - 1,
2311 num_lateral_subdomains - subdomain_x - 2,
2318 subdomain_y == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2320 neighborhood_vertex_[boundary_vertex].emplace_back(
2322 ( diamond_id - 4 ) % 5,
2323 num_lateral_subdomains - 1,
2324 num_lateral_subdomains - subdomain_x - 2,
2334 subdomain_x == num_lateral_subdomains - 1 && subdomain_r > 0 )
2336 neighborhood_vertex_[boundary_vertex].emplace_back(
2339 num_lateral_subdomains - subdomain_y - 2,
2340 num_lateral_subdomains - 1,
2347 subdomain_x == num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2349 neighborhood_vertex_[boundary_vertex].emplace_back(
2352 num_lateral_subdomains - subdomain_y - 2,
2353 num_lateral_subdomains - 1,
2362 Kokkos::abort(
"Invalid diamond ID." );
2367 if ( boundary_vertex ==
BoundaryVertex::V_000 && subdomain_x > 0 && subdomain_y > 0 && subdomain_r > 0 )
2369 neighborhood_vertex_[boundary_vertex].emplace_back(
2370 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y - 1, subdomain_r - 1 ),
2376 subdomain_y > 0 && subdomain_r > 0 )
2378 neighborhood_vertex_[boundary_vertex].emplace_back(
2379 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y - 1, subdomain_r - 1 ),
2385 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
2387 neighborhood_vertex_[boundary_vertex].emplace_back(
2388 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y + 1, subdomain_r - 1 ),
2394 subdomain_r < num_radial_subdomains - 1 )
2396 neighborhood_vertex_[boundary_vertex].emplace_back(
2397 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y - 1, subdomain_r + 1 ),
2403 subdomain_y < num_lateral_subdomains - 1 && subdomain_r > 0 )
2405 neighborhood_vertex_[boundary_vertex].emplace_back(
2406 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y + 1, subdomain_r - 1 ),
2412 subdomain_y > 0 && subdomain_r < num_radial_subdomains - 1 )
2414 neighborhood_vertex_[boundary_vertex].emplace_back(
2415 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y - 1, subdomain_r + 1 ),
2421 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2423 neighborhood_vertex_[boundary_vertex].emplace_back(
2424 SubdomainInfo( diamond_id, subdomain_x - 1, subdomain_y + 1, subdomain_r + 1 ),
2430 subdomain_y < num_lateral_subdomains - 1 && subdomain_r < num_radial_subdomains - 1 )
2432 neighborhood_vertex_[boundary_vertex].emplace_back(
2433 SubdomainInfo( diamond_id, subdomain_x + 1, subdomain_y + 1, subdomain_r + 1 ),
2440 void setup_neighborhood_ranks(
2441 const DomainInfo& domain_info,
2444 for (
auto& neighbors : neighborhood_vertex_ | std::views::values )
2446 for (
auto& [neighbor_subdomain_info, neighbor_boundary_vertex, neighbor_rank] : neighbors )
2448 neighbor_rank = subdomain_to_rank(
2449 neighbor_subdomain_info,
2450 domain_info.num_subdomains_per_diamond_side(),
2451 domain_info.num_subdomains_in_radial_direction() );
2455 for (
auto& neighbors : neighborhood_edge_ | std::views::values )
2457 for (
auto& [neighbor_subdomain_info, neighbor_boundary_edge, _, neighbor_rank] : neighbors )
2459 neighbor_rank = subdomain_to_rank(
2460 neighbor_subdomain_info,
2461 domain_info.num_subdomains_per_diamond_side(),
2462 domain_info.num_subdomains_in_radial_direction() );
2466 for (
auto& [neighbor_subdomain_info, neighbor_boundary_face, _, neighbor_rank] :
2467 neighborhood_face_ | std::views::values )
2469 neighbor_rank = subdomain_to_rank(
2470 neighbor_subdomain_info,
2471 domain_info.num_subdomains_per_diamond_side(),
2472 domain_info.num_subdomains_in_radial_direction() );
2476 void setup_neighborhood(
2477 const DomainInfo& domain_info,
2478 const SubdomainInfo& subdomain_info,
2481 setup_neighborhood_faces( domain_info, subdomain_info );
2482 setup_neighborhood_edges( domain_info, subdomain_info );
2483 setup_neighborhood_vertices( domain_info, subdomain_info );
2484 setup_neighborhood_ranks( domain_info, subdomain_to_rank );
2487 std::map< BoundaryVertex, std::vector< NeighborSubdomainTupleVertex > > neighborhood_vertex_;
2488 std::map< BoundaryEdge, std::vector< NeighborSubdomainTupleEdge > > neighborhood_edge_;
2489 std::map< BoundaryFace, NeighborSubdomainTupleFace > neighborhood_face_;