[Commits] numrel/LSUThorns/PeriodicCarpet SVN commit 25: /trunk/src/

schnetter at cct.lsu.edu schnetter at cct.lsu.edu
Sun Sep 21 10:13:19 CDT 2014


User: eschnett
Date: 2014/09/21 10:13 AM

Modified:
 /trunk/src/
  periodic.cc

Log:
 Handle non-periodic boundaries correctly

File Changes:

Directory: /trunk/src/
======================

File [modified]: periodic.cc
Delta lines: +21 -6
===================================================================
--- trunk/src/periodic.cc	2014-05-21 15:50:54 UTC (rev 24)
+++ trunk/src/periodic.cc	2014-09-21 15:13:18 UTC (rev 25)
@@ -166,6 +166,21 @@
       dh::light_cboxes const& light_level
         = dd.light_boxes.AT(mglevel).AT(reflevel);
       
+      // Interior of the domain with respect to periodic boundaries,
+      // i.e. periodic boundaries cut off, but all other boundaries
+      // still included
+      ibbox domain_perint;
+      {
+        ivect lo, hi, str;
+        for (int d=0; d<dim; ++d) {
+          ibbox const& dom = do_periodic[d] ? domain_active : domain_exterior;
+          lo[d] = dom.lower()[d];
+          hi[d] = dom.upper()[d];
+          str[d] = dom.stride()[d];
+        }
+        domain_perint = ibbox(lo, hi, str);
+      }
+      
       // CCTK_INT width[2*dim];
       // CCTK_INT is_internal[2*dim];
       // CCTK_INT is_staggered[2*dim];
@@ -241,12 +256,12 @@
             if (not do_periodic[d]) {
               slab.offset[d] = 0;
             } else {
-              assert((dst_bbox1.lower()[d] - domain_active.lower()[d]) %
-                     domain_active.stride()[d] == 0);
+              assert((dst_bbox1.lower()[d] - domain_perint.lower()[d]) %
+                     domain_perint.stride()[d] == 0);
               slab.offset[d] =
-                - rounddn(dst_bbox1.lower()[d] - domain_active.lower()[d],
-                        domain_active.shape()[d]) /
-                domain_active.stride()[d];
+                - rounddn(dst_bbox1.lower()[d] - domain_perint.lower()[d],
+                          domain_perint.shape()[d]) /
+                domain_perint.stride()[d];
             }
           }
           assert(not all(slab.offset == 0)); // this would be trivial
@@ -256,7 +271,7 @@
           
           // Ensure we copy from within the domain, not from boundary
           // points
-          ibbox const src_bbox = src_bbox1 & domain_active;
+          ibbox const src_bbox = src_bbox1 & domain_perint;
           assert(not src_bbox.empty());
           ibbox const dst_bbox = src_bbox.shift(-slab.offset);
           assert(dst_bbox.is_contained_in(dst_bbox1));



More information about the Commits mailing list