@@ -99,16 +99,17 @@ void InitializeBufferCache(std::shared_ptr<MeshData<Real>> &md, COMM_MAP *comm_m
9999 std::vector<std::tuple<int , int , Mesh::channel_key_t >> key_order;
100100
101101 int boundary_idx = 0 ;
102- ForEachBoundary<bound_type>(md, [&](auto pmb, sp_mbd_t rc, nb_t &nb, const sp_cv_t v) {
103- auto key = KeyFunc (pmb, nb, v, bound_type);
104- PARTHENON_DEBUG_REQUIRE (comm_map->count (key) > 0 ,
105- " Boundary communicator does not exist" );
106- // Create a unique index by combining receiver gid (second element of the key
107- // tuple) and geometric element index (fourth element of the key tuple)
108- int recvr_idx = 27 * GetReceiverGid (key) + GetLocIdx (key);
109- key_order.push_back ({recvr_idx, boundary_idx, key});
110- ++boundary_idx;
111- });
102+ ForEachBoundary<bound_type>(
103+ md, [&](auto pmb, sp_mbd_t rc, const nb_t &nb, const sp_cv_t v) {
104+ auto key = KeyFunc (pmb, nb, v, bound_type);
105+ PARTHENON_DEBUG_REQUIRE (comm_map->count (key) > 0 ,
106+ " Boundary communicator does not exist" );
107+ // Create a unique index by combining receiver gid (second element of the key
108+ // tuple) and geometric element index (fourth element of the key tuple)
109+ int recvr_idx = 27 * GetReceiverGid (key) + GetLocIdx (key);
110+ key_order.push_back ({recvr_idx, boundary_idx, key});
111+ ++boundary_idx;
112+ });
112113
113114 // If desired, sort the keys and boundary indices by receiver_idx
114115 // std::sort(key_order.begin(), key_order.end(),
@@ -155,7 +156,8 @@ inline auto CheckSendBufferCacheForRebuild(std::shared_ptr<MeshData<Real>> md) {
155156 bool rebuild = false ;
156157 bool other_communication_unfinished = false ;
157158 int nbound = 0 ;
158- ForEachBoundary<BOUND_TYPE>(md, [&](auto pmb, sp_mbd_t rc, nb_t &nb, const sp_cv_t v) {
159+ ForEachBoundary<BOUND_TYPE>(md, [&](auto pmb, sp_mbd_t rc, const nb_t &nb,
160+ const sp_cv_t v) {
159161 const std::size_t ibuf = cache.idx_vec [nbound];
160162 auto &buf = *(cache.buf_vec [ibuf]);
161163
@@ -187,7 +189,8 @@ inline auto CheckReceiveBufferCacheForRebuild(std::shared_ptr<MeshData<Real>> md
187189 bool rebuild = false ;
188190 int nbound = 0 ;
189191
190- ForEachBoundary<BOUND_TYPE>(md, [&](auto pmb, sp_mbd_t rc, nb_t &nb, const sp_cv_t v) {
192+ ForEachBoundary<BOUND_TYPE>(md, [&](auto pmb, sp_mbd_t rc, const nb_t &nb,
193+ const sp_cv_t v) {
191194 const std::size_t ibuf = cache.idx_vec [nbound];
192195 auto &buf = *cache.buf_vec [ibuf];
193196 if (ibuf < cache.bnd_info_h .size ()) {
@@ -237,19 +240,20 @@ inline void RebuildBufferCache(std::shared_ptr<MeshData<Real>> md, int nbound,
237240 cache.prores_cache .Initialize (nbound, pkg);
238241
239242 int ibound = 0 ;
240- ForEachBoundary<BOUND_TYPE>(md, [&](auto pmb, sp_mbd_t rc, nb_t &nb, const sp_cv_t v) {
241- // bnd_info
242- const std::size_t ibuf = cache.idx_vec [ibound];
243- cache.bnd_info_h (ibuf) = BndInfoCreator (pmb, nb, v, cache.buf_vec [ibuf]);
244-
245- // subsets ordering is same as in cache.bnd_info
246- // RefinementFunctions_t owns all relevant functionality, so
247- // only one ParArray2D needed.
248- cache.prores_cache .RegisterRegionHost (ibuf, ProResInfoCreator (pmb, nb, v), v.get (),
249- pkg);
250-
251- ++ibound;
252- });
243+ ForEachBoundary<BOUND_TYPE>(
244+ md, [&](auto pmb, sp_mbd_t rc, const nb_t &nb, const sp_cv_t v) {
245+ // bnd_info
246+ const std::size_t ibuf = cache.idx_vec [ibound];
247+ cache.bnd_info_h (ibuf) = BndInfoCreator (pmb, nb, v, cache.buf_vec [ibuf]);
248+
249+ // subsets ordering is same as in cache.bnd_info
250+ // RefinementFunctions_t owns all relevant functionality, so
251+ // only one ParArray2D needed.
252+ cache.prores_cache .RegisterRegionHost (ibuf, ProResInfoCreator (pmb, nb, v),
253+ v.get (), pkg);
254+
255+ ++ibound;
256+ });
253257 Kokkos::deep_copy (cache.bnd_info , cache.bnd_info_h );
254258 cache.prores_cache .CopyToDevice ();
255259}
0 commit comments