diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2010-09-14 15:56:32 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 18:25:23 +0000 |
commit | 351d38c7a8b35e6b4250c098e007341b0f8e3001 (patch) | |
tree | 81505fd1c888ac0e68db467aaedeea7bc3a4ee2a /Carpet/CarpetLib/src/gdata.cc | |
parent | e281e21826f9667d9e7d1c559352bac450754992 (diff) |
CarpetLib: Correct refluxing errors
Diffstat (limited to 'Carpet/CarpetLib/src/gdata.cc')
-rw-r--r-- | Carpet/CarpetLib/src/gdata.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/gdata.cc b/Carpet/CarpetLib/src/gdata.cc index 0d8980a39..c9f9f8ad2 100644 --- a/Carpet/CarpetLib/src/gdata.cc +++ b/Carpet/CarpetLib/src/gdata.cc @@ -191,12 +191,21 @@ transfer_from (comm_state & state, if (is_src) { // copy the data into the send buffer if (interp_on_src) { + ivect ioffset (0); + if (src->cent == cell_centered) { + assert (all (srcbox.stride() == src->extent().stride())); + ivect const ioff = srcbox.lower() - src->extent().lower(); + ivect const is_centered = ioff % src->extent().stride() == 0; + ioffset = 1 - is_centered; + } + ibbox const bufbox = dstbox.shift(ioffset, 2); + assert (bufbox.size() == dstbox.size()); size_t const sendbufsize = src->c_datatype_size() * dstbox.size(); void * const sendbuf = state.send_buffer (src->c_datatype(), dstproc, dstbox.size()); gdata * const buf = src->make_typed (src->varindex, src->cent, src->transport_operator); - buf->allocate (dstbox, srcproc, sendbuf, sendbufsize); + buf->allocate (bufbox, srcproc, sendbuf, sendbufsize); buf->transfer_from_innerloop (srcs, times, dstbox, time, order_space, order_time); delete buf; @@ -241,6 +250,13 @@ transfer_from (comm_state & state, copy_from_innerloop (buf, dstbox); delete buf; } else { + if (cent == cell_centered) { + assert (all (dstbox.stride() == this->extent().stride())); + ivect const ioff = dstbox.lower() - this->extent().lower(); + ivect const is_centered = ioff % this->extent().stride() == 0; + ivect const ioffset = not is_centered; + assert (all (ioffset == 0)); + } gdata const * const null = NULL; vector <gdata const *> bufs (ntimelevels, null); vector <CCTK_REAL> timebuf (ntimelevels); |