diff options
Diffstat (limited to 'Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc')
-rw-r--r-- | Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc b/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc index dd419cb92..13b59a7f8 100644 --- a/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc +++ b/Carpet/CarpetLib/src/restrict_3d_cc_rf2.cc @@ -5,7 +5,6 @@ #include <cassert> #include <cmath> -#include "gdata.hh" #include "operator_prototypes_3d.hh" #include "typeprops.hh" @@ -19,9 +18,11 @@ namespace CarpetLib { #define SRCIND3(i,j,k) \ index3 (srcioff + (i), srcjoff + (j), srckoff + (k), \ + srcipadext, srcjpadext, srckpadext, \ srciext, srcjext, srckext) #define DSTIND3(i,j,k) \ index3 (dstioff + (i), dstjoff + (j), dstkoff + (k), \ + dstipadext, dstjpadext, dstkpadext, \ dstiext, dstjext, dstkext) @@ -29,8 +30,10 @@ namespace CarpetLib { template <typename T> void restrict_3d_cc_rf2 (T const * restrict const src, + ivect3 const & restrict srcpadext, ivect3 const & restrict srcext, T * restrict const dst, + ivect3 const & restrict dstpadext, ivect3 const & restrict dstext, ibbox3 const & restrict srcbbox, ibbox3 const & restrict dstbbox, @@ -71,12 +74,6 @@ namespace CarpetLib { CCTK_WARN (0, "Internal error: region extent is not contained in array extent"); } - if (any (srcext != gdata::allocated_memory_shape(srcbbox.shape() / srcbbox.stride()) or - dstext != gdata::allocated_memory_shape(dstbbox.shape() / dstbbox.stride()))) - { - CCTK_WARN (0, "Internal error: array sizes don't agree with bounding boxes"); - } - ivect3 const regext = regbbox.shape() / regbbox.stride(); @@ -92,6 +89,14 @@ namespace CarpetLib { + int const srcipadext = srcpadext[0]; + int const srcjpadext = srcpadext[1]; + int const srckpadext = srcpadext[2]; + + int const dstipadext = dstpadext[0]; + int const dstjpadext = dstpadext[1]; + int const dstkpadext = dstpadext[2]; + int const srciext = srcext[0]; int const srcjext = srcext[1]; int const srckext = srcext[2]; @@ -127,6 +132,8 @@ namespace CarpetLib { for (int j=0; j<regjext; ++j) { for (int i=0; i<regiext; ++i) { + // TODO: Introduce higher-order restriction operators (but + // don't use these for hydro!) dst [DSTIND3(i, j, k)] = + f1*f1*f1 * src [SRCIND3(2*i , 2*j , 2*k )] + f2*f1*f1 * src [SRCIND3(2*i+1, 2*j , 2*k )] @@ -145,17 +152,19 @@ namespace CarpetLib { -#define TYPECASE(N,T) \ - template \ - void \ - restrict_3d_cc_rf2 (T const * restrict const src, \ - ivect3 const & restrict srcext, \ - T * restrict const dst, \ - ivect3 const & restrict dstext, \ - ibbox3 const & restrict srcbbox, \ - ibbox3 const & restrict dstbbox, \ - ibbox3 const & restrict, \ - ibbox3 const & restrict regbbox, \ +#define TYPECASE(N,T) \ + template \ + void \ + restrict_3d_cc_rf2 (T const * restrict const src, \ + ivect3 const & restrict srcpadext, \ + ivect3 const & restrict srcext, \ + T * restrict const dst, \ + ivect3 const & restrict dstpadext, \ + ivect3 const & restrict dstext, \ + ibbox3 const & restrict srcbbox, \ + ibbox3 const & restrict dstbbox, \ + ibbox3 const & restrict, \ + ibbox3 const & restrict regbbox, \ void * extraargs); #include "typecase.hh" #undef TYPECASE |