aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/data.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2012-02-05 20:24:09 -0500
committerBarry Wardell <barry.wardell@gmail.com>2012-09-11 18:17:59 +0100
commit8554617595eb9f16608a52487ff142ca6fccb9f6 (patch)
treef162a22c99af86d69738cb513384b02561209c4f /Carpet/CarpetLib/src/data.cc
parent97e44e585ea966068eefb7e2e48cefad171d0d19 (diff)
Re-organise some refluxing internals
Re-organise some of the internal details of refluxing. Refluxing requires restricting fluxes from fine to coarse grids. Previously, Carpet would internally store bounding boxes that were offset by 1/2 grid point, and adjust (correct) these boxes in various places in a rather ad-hoc manner. This is now cleaned up. Remove the (unused) "accumulate" operator, and the (unused) "accumulate" prolongation type.
Diffstat (limited to 'Carpet/CarpetLib/src/data.cc')
-rw-r--r--Carpet/CarpetLib/src/data.cc75
1 files changed, 23 insertions, 52 deletions
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc
index 6b28c2e5d..c4f5adfcc 100644
--- a/Carpet/CarpetLib/src/data.cc
+++ b/Carpet/CarpetLib/src/data.cc
@@ -539,56 +539,28 @@ copy_from_innerloop (gdata const * const gsrc,
assert (proc() == src->proc());
assert (dist::rank() == proc());
- ibbox srcbox, dstbox;
- switch (cent) {
- case vertex_centered:
- srcbox = src->extent();
- dstbox = this->extent();
- break;
- case cell_centered: {
- ivect const ioff = dstbox.lower() - this->extent().lower();
- ivect const is_centered = ioff % this->extent().stride() == 0;
-
- // Shift bboxes to be face centred if necessary, since all grid
- // functions are stored as if they were cell-centered
- // srcbox = src->extent().shift(is_centered-1,2);
- srcbox = src->extent();
- dstbox = this->extent().shift(is_centered-1,2);
- break;
- }
- default:
- assert (0);
- }
+ ibbox const& srcbox = src->extent();
+ ibbox const& dstbox = this->extent();
- if (transport_operator != op_accumulate) {
#if CARPET_DIM == 3
- call_operator<T> (& copy_3d,
- static_cast <T const *> (src->storage()),
- src->shape(),
- static_cast <T *> (this->storage()),
- this->shape(),
- srcbox, dstbox,
- srcregbox, dstregbox, (void*)slabinfo);
+ call_operator<T> (& copy_3d,
+ static_cast <T const *> (src->storage()),
+ src->shape(),
+ static_cast <T *> (this->storage()),
+ this->shape(),
+ srcbox, dstbox,
+ srcregbox, dstregbox, (void*)slabinfo);
#elif CARPET_DIM == 4
- call_operator<T> (& copy_4d,
- static_cast <T const *> (src->storage()),
- src->shape(),
- static_cast <T *> (this->storage()),
- this->shape(),
- srcbox, dstbox,
- srcregbox, dstregbox, (void*)slabinfo);
+ call_operator<T> (& copy_4d,
+ static_cast <T const *> (src->storage()),
+ src->shape(),
+ static_cast <T *> (this->storage()),
+ this->shape(),
+ srcbox, dstbox,
+ srcregbox, dstregbox, (void*)slabinfo);
#else
# error "Value for CARPET_DIM not supported"
#endif
- } else {
- call_operator<T> (& accumulate_3d,
- static_cast <T const *> (src->storage()),
- src->shape(),
- static_cast <T *> (this->storage()),
- this->shape(),
- srcbox, dstbox,
- srcregbox, dstregbox, (void*)slabinfo);
- }
}
@@ -699,8 +671,7 @@ transfer_p_r (data const * const src,
} else if (all (src->extent().stride() < this->extent().stride())) {
// Restrict
assert (transport_operator != op_sync);
- assert (not slabinfo);
- transfer_restrict (src, dstbox, srcbox, order_space);
+ transfer_restrict (src, dstbox, srcbox, slabinfo, order_space);
} else {
assert (0);
}
@@ -1103,6 +1074,7 @@ data <T>::
transfer_restrict (data const * const src,
ibbox const & dstregbox,
ibbox const & srcregbox,
+ islab const * restrict const slabinfo,
int const /*order_space*/)
{
static Timer total ("restrict");
@@ -1122,6 +1094,7 @@ transfer_restrict (data const * const src,
// enum centering { vertex_centered, cell_centered };
switch (cent) {
case vertex_centered:
+ assert (not slabinfo);
call_operator<T> (& restrict_3d_rf2,
static_cast <T const *> (src->storage()),
src->shape(),
@@ -1133,13 +1106,10 @@ transfer_restrict (data const * const src,
break;
case cell_centered: {
assert (all (dstregbox.stride() == this->extent().stride()));
- ivect const ioff = dstregbox.lower() - this->extent().lower();
- ivect const is_centered = ioff % this->extent().stride() == 0;
+ ivect const is_centered = slabinfo ? slabinfo->is_centered : 1;
- // Shift bboxes to be face centred if necessary, since all grid
- // functions are stored as if they were cell-centered
- ibbox const srcbox = src->extent().shift(is_centered-1,2);
- ibbox const dstbox = this->extent().shift(is_centered-1,2);
+ ibbox const& srcbox = src->extent();
+ ibbox const& dstbox = this->extent();
if (all(is_centered == ivect(1,1,1))) {
call_operator<T> (& restrict_3d_cc_rf2,
@@ -1231,6 +1201,7 @@ data <CCTK_INT>::
transfer_restrict (data const * const /*src*/,
ibbox const & /*dstbox*/,
ibbox const & /*srcbox*/,
+ islab const *restrict const /*slabinfo*/,
int const /*order_space*/)
{
CCTK_WARN (0, "Data type not supported");