[cig-commits] commit: Fix an off-by-one error

Mercurial hg at geodynamics.org
Wed Apr 27 01:14:06 PDT 2011


changeset:   216:ed6c6530d07a
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Wed Apr 27 01:12:49 2011 -0700
files:       src/V_Boundary_Refine/Update_V_2D.C
description:
Fix an off-by-one error


diff -r 28d4f60f4c10 -r ed6c6530d07a src/V_Boundary_Refine/Update_V_2D.C
--- a/src/V_Boundary_Refine/Update_V_2D.C	Tue Apr 26 23:31:10 2011 -0700
+++ b/src/V_Boundary_Refine/Update_V_2D.C	Wed Apr 27 01:12:49 2011 -0700
@@ -17,9 +17,6 @@ void SAMRAI::geom::V_Boundary_Refine::Up
  SAMRAI::pdat::SideData<double> &v,
  SAMRAI::pdat::SideData<double> &v_fine) const
 {
-  pdat::SideIndex center(fine);
-  center.coarsen(hier::Index(2,2));
-
   /* Set the derivative for the normal direction
 
          i-1      i       i+1
@@ -62,6 +59,9 @@ void SAMRAI::geom::V_Boundary_Refine::Up
          then interpolate */
 
       hier::Index ip_s(boundary_positive ? ip : -ip);
+
+      pdat::SideIndex center(fine-ip_s);
+      center.coarsen(hier::Index(2,2));
 
       const double dv_plus=v(center+jp+ip_s)-v(center+jp-ip_s);
       const double dv_minus=v(center-jp+ip_s)-v(center-jp-ip_s);
@@ -116,6 +116,9 @@ void SAMRAI::geom::V_Boundary_Refine::Up
  */
   else
     {
+      pdat::SideIndex center(fine);
+      center.coarsen(hier::Index(2,2));
+
       double v_center, v_plus;
       hier::Index jp_s(boundary_positive ? jp : -jp);
 



More information about the CIG-COMMITS mailing list