aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/data.cc
diff options
context:
space:
mode:
authorChristian Reisswig <reisswig@tapir.caltech.edu>2010-08-27 23:05:53 -0700
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 18:25:17 +0000
commita54aeac2cd92d6742efee10bb8f4c08affe25e24 (patch)
treec111593ac52d19a1b9e4a6170781a937f1f20ab5 /Carpet/CarpetLib/src/data.cc
parent2205c4de243d010b29f651a4ecd51c32e7b161bb (diff)
parentbed54e5df6d3f29d0d2ad473018fa35b0f994a2a (diff)
Merge.
Diffstat (limited to 'Carpet/CarpetLib/src/data.cc')
-rw-r--r--Carpet/CarpetLib/src/data.cc54
1 files changed, 45 insertions, 9 deletions
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc
index 484582073..2c76c6a3b 100644
--- a/Carpet/CarpetLib/src/data.cc
+++ b/Carpet/CarpetLib/src/data.cc
@@ -975,16 +975,52 @@ transfer_restrict (data const * const src,
this->extent(),
box);
break;
- case cell_centered:
- call_operator<T> (& restrict_3d_cc_rf2,
- static_cast <T const *> (src->storage()),
- src->shape(),
- static_cast <T *> (this->storage()),
- this->shape(),
- src->extent(),
- this->extent(),
- box);
+ case cell_centered: {
+ assert (all (box.stride() == this->extent().stride()));
+ ivect const izero (0);
+ ivect const ioff = box.lower() - this->extent().lower();
+ ivect const is_centered = ioff % this->extent().stride() == izero;
+ if (all(is_centered == ivect(1,1,1))) {
+ call_operator<T> (& restrict_3d_cc_rf2,
+ static_cast <T const *> (src->storage()),
+ src->shape(),
+ static_cast <T *> (this->storage()),
+ this->shape(),
+ src->extent(),
+ this->extent(),
+ box);
+ } else if (all(is_centered == ivect(0,1,1))) {
+ call_operator<T> (& restrict_3d_vc_rf2<T,0,1,1>,
+ static_cast <T const *> (src->storage()),
+ src->shape(),
+ static_cast <T *> (this->storage()),
+ this->shape(),
+ src->extent(),
+ this->extent(),
+ box);
+ } else if (all(is_centered == ivect(1,0,1))) {
+ call_operator<T> (& restrict_3d_vc_rf2<T,1,0,1>,
+ static_cast <T const *> (src->storage()),
+ src->shape(),
+ static_cast <T *> (this->storage()),
+ this->shape(),
+ src->extent(),
+ this->extent(),
+ box);
+ } else if (all(is_centered == ivect(1,1,0))) {
+ call_operator<T> (& restrict_3d_vc_rf2<T,1,1,0>,
+ static_cast <T const *> (src->storage()),
+ src->shape(),
+ static_cast <T *> (this->storage()),
+ this->shape(),
+ src->extent(),
+ this->extent(),
+ box);
+ } else {
+ assert (0);
+ }
break;
+ }
default:
assert (0);
}