diff -r a753e4844d1e Carpet/CarpetLib/src/dh.cc --- a/Carpet/CarpetLib/src/dh.cc Thu Sep 01 12:30:07 2011 -0500 +++ b/Carpet/CarpetLib/src/dh.cc Wed Sep 14 21:23:45 2011 -0400 @@ -1627,7 +1627,7 @@ (sendrecv_pseudoregion_t (send, cc, recv, c)); if (not on_this_oldproc (rl, cc)) { fast_dboxes & fast_level_otherproc = - fast_level_otherprocs.AT(this_proc(rl, cc)); + fast_level_otherprocs.AT(this_oldproc(rl, cc)); fast_level_otherproc.fast_old2new_sync_sendrecv.push_back (sendrecv_pseudoregion_t (send, cc, recv, c)); } diff -r a753e4844d1e Carpet/CarpetLib/src/ggf.cc --- a/Carpet/CarpetLib/src/ggf.cc Thu Sep 01 12:30:07 2011 -0500 +++ b/Carpet/CarpetLib/src/ggf.cc Wed Sep 14 21:23:45 2011 -0400 @@ -184,7 +184,7 @@ tl, rl, ml, & dh::fast_dboxes::fast_old2new_sync_sendrecv, tl, rl, ml, - & oldstorage); + true); } // for tl } // if rl @@ -360,7 +360,7 @@ tl,rl,ml, & dh::fast_dboxes::fast_sync_sendrecv, tl,rl,ml, - NULL, true); + false, true); timer.stop (0); } @@ -538,7 +538,7 @@ srpvect const dh::fast_dboxes::* sendrecvs, vector const & tl2s, int const rl2, int const ml2, CCTK_REAL const & time, - mdata * const srcstorage_, + bool const use_old_storage, bool const flip_send_recv) { assert (rl1>=0 and rl1=0 and rl2<(int)srcstorage.AT(ml2).size()); @@ -603,9 +603,15 @@ assert (all (recv.stride() == h.baseextent(ml1,rl1).stride())); int const c2 = psend.component; int const c1 = precv.component; - int const lc2 = h.get_local_component(rl2,c2); + int lc2, p2; + if (use_old_storage) { + lc2 = h.get_old_local_component(rl2,c2); + p2 = h.old_processor(rl2,c2); + } else { + lc2 = h.get_local_component(rl2,c2); + p2 = h.processor(rl2,c2); + } int const lc1 = h.get_local_component(rl1,c1); - int const p2 = h.processor(rl2,c2); int const p1 = h.processor(rl1,c1); // Ensure the communication schedule is consistent assert (p1==dist::rank() or p2==dist::rank()); diff -r a753e4844d1e Carpet/CarpetLib/src/ggf.hh --- a/Carpet/CarpetLib/src/ggf.hh Thu Sep 01 12:30:07 2011 -0500 +++ b/Carpet/CarpetLib/src/ggf.hh Wed Sep 14 21:23:45 2011 -0400 @@ -171,7 +169,7 @@ srpvect const dh::fast_dboxes::* sendrecvs, vector const & tl2s, int rl2, int ml2, CCTK_REAL const & time, - mdata * srcstorage = 0, + bool use_old_storage = false, bool flip_send_recv = false); void @@ -179,7 +177,7 @@ int tl1, int rl1, int ml1, srpvect const dh::fast_dboxes::* sendrecvs, int tl2, int rl2, int ml2, - mdata * srcstorage = 0, + bool use_old_storage = false, bool flip_send_recv = false) { vector tl2s(1); @@ -190,7 +188,7 @@ sendrecvs, tl2s, rl2, ml2, time, - srcstorage, + use_old_storage, flip_send_recv); } diff -r a753e4844d1e Carpet/CarpetLib/src/gh.cc --- a/Carpet/CarpetLib/src/gh.cc Thu Sep 01 12:30:07 2011 -0500 +++ b/Carpet/CarpetLib/src/gh.cc Wed Sep 14 21:23:45 2011 -0400 @@ -195,6 +195,10 @@ // Calculate global and local components + assert (old_global_components_.empty()); + assert (old_local_components_.empty()); + swap (old_global_components_, global_components_); + swap (old_local_components_, local_components_); global_components_.resize(reflevels()); local_components_.resize(reflevels()); for (int rl=0; rl::iterator t=ths.begin(); t!=ths.end(); ++t) { (*t)->regrid_free(); @@ -330,6 +336,30 @@ { return local_components_.AT(rl).AT(c); } + +int +gh:: +old_local_components (int const rl) + const +{ + return old_global_components_.AT(rl).size(); +} + +int +gh:: +get_old_component (int const rl, int const lc) + const +{ + return old_global_components_.AT(rl).AT(lc); +} + +int +gh:: +get_old_local_component (int const rl, int const c) + const +{ + return old_local_components_.AT(rl).AT(c); +} @@ -561,6 +591,10 @@ memoryof (boundary_width) + memoryof (regions) + memoryof (oldregions) + + memoryof (global_components_) + + memoryof (local_components_) + + memoryof (old_global_components_) + + memoryof (old_local_components_) + memoryof (ths) + memoryof (dhs); } diff -r a753e4844d1e Carpet/CarpetLib/src/gh.hh --- a/Carpet/CarpetLib/src/gh.hh Thu Sep 01 12:30:07 2011 -0500 +++ b/Carpet/CarpetLib/src/gh.hh Wed Sep 14 21:23:45 2011 -0400 @@ -53,6 +53,8 @@ private: vector > global_components_; // [rl][lc] vector > local_components_; // [rl][c] + vector > old_global_components_; // [rl][lc] + vector > old_local_components_; // [rl][c] public: // Extents of the regions before distributing them over the @@ -85,9 +87,18 @@ return processor(rl,c) == dist::rank(); } - int local_components (int rl) const CCTK_ATTRIBUTE_PURE; - int get_component (int rl, int lc) const CCTK_ATTRIBUTE_PURE; - int get_local_component (int rl, int c) const CCTK_ATTRIBUTE_PURE; + int local_components (int rl) const CCTK_MEMBER_ATTRIBUTE_PURE; + int get_component (int rl, int lc) const CCTK_MEMBER_ATTRIBUTE_PURE; + int get_local_component (int rl, int c) const CCTK_MEMBER_ATTRIBUTE_PURE; + + bool old_is_local (const int rl, const int c) const CCTK_MEMBER_ATTRIBUTE_PURE + { + return old_processor(rl,c) == dist::rank(); + } + + int old_local_components (int rl) const CCTK_MEMBER_ATTRIBUTE_PURE; + int get_old_component (int rl, int lc) const CCTK_MEMBER_ATTRIBUTE_PURE; + int get_old_local_component (int rl, int c) const CCTK_MEMBER_ATTRIBUTE_PURE; #if 0 // Convert between index positions and coordinate positions