[cig-commits] commit: Make P_Boundary_Refine work when the overlap box does not align with the coarse grid.

Mercurial hg at geodynamics.org
Fri Feb 25 14:16:53 PST 2011


changeset:   87:b29d1a9dfc25
user:        Walter Landry <wlandry at caltech.edu>
date:        Sun Feb 13 11:47:45 2011 -0800
files:       P_Boundary_Refine.C
description:
Make P_Boundary_Refine work when the overlap box does not align with the coarse grid.


diff -r edcbbaafa78b -r b29d1a9dfc25 P_Boundary_Refine.C
--- a/P_Boundary_Refine.C	Sun Feb 13 11:45:47 2011 -0800
+++ b/P_Boundary_Refine.C	Sun Feb 13 11:47:45 2011 -0800
@@ -178,18 +178,31 @@ void SAMRAI::geom::P_Boundary_Refine::Up
   p_offset=
     quad_offset_interpolate((*p)(center-ip),(*p)(center),(*p)(center+ip));
 
-  (*p_fine)(fine)=p_minus + p_offset - (*p)(center)
+  const double p_low=p_minus + p_offset - (*p)(center)
     + ((*p)(center-ip-jp) + (*p)(center)
        - (*p)(center-ip) - (*p)(center-jp))/16;
 
-  (*p_fine)(fine+jp)=p_plus + p_offset - (*p)(center)
+  const double p_high=p_plus + p_offset - (*p)(center)
     + ((*p)(center-ip+jp) + (*p)(center)
        - (*p)(center-ip) - (*p)(center+jp))/16;
 
-  /* Since we update two points on j at once, we increment j again.
-     This is ok, since the box in the 'i' direction is defined to be
-     only one cell wide */
-  ++j;
+
+  /* If we are at an even index, update both of the elements in the cell */
+  if(j%2==0)
+    {
+      (*p_fine)(fine)=p_low;
+
+      (*p_fine)(fine+jp)=p_high;
+
+      /* Since we update two points on j at once, we increment j again.
+         This is ok, since the box in the 'i' direction is defined to be
+         only one cell wide */
+      ++j;
+    }
+  else
+    {
+      (*p_fine)(fine)=p_high;
+    }
 
   tbox::plog << "p bc "
              << fine[0] << " "
@@ -206,5 +219,9 @@ void SAMRAI::geom::P_Boundary_Refine::Up
              << (*p)(center+jp) << " "
              << (*p)(center) << " "
              << (*p)(center-jp) << " "
+             << (*p)(center+ip) << " "
+             << (*p)(center-ip) << " "
+             << (*p)(center-ip+jp) << " "
+             << (*p)(center-ip-jp) << " "
              << "\n";
 }



More information about the CIG-COMMITS mailing list