[cig-commits] commit: Fix a bug in Update_V_2D where it was not correctly interpolating when

Mercurial hg at geodynamics.org
Sun Apr 24 06:11:34 PDT 2011


changeset:   200:f62854e51fa7
user:        Walter Landry <wlandry at caltech.edu>
date:        Sun Apr 24 06:03:13 2011 -0700
files:       src/V_Boundary_Refine/Update_V_2D.C
description:
Fix a bug in Update_V_2D where it was not correctly interpolating when
on the low side.


diff -r ebdaba8b7126 -r f62854e51fa7 src/V_Boundary_Refine/Update_V_2D.C
--- a/src/V_Boundary_Refine/Update_V_2D.C	Sun Apr 24 06:01:09 2011 -0700
+++ b/src/V_Boundary_Refine/Update_V_2D.C	Sun Apr 24 06:03:13 2011 -0700
@@ -65,9 +65,10 @@ void SAMRAI::geom::V_Boundary_Refine::Up
   else
     {
       double v_center, v_plus;
+      hier::Index jp_s(boundary_positive ? jp : -jp);
 
       v_center=
-        quad_offset_interpolate(v(center-jp),v(center),v(center+jp));
+        quad_offset_interpolate(v(center-jp_s),v(center),v(center+jp_s));
 
       if(i%2==0)
         {
@@ -75,8 +76,12 @@ void SAMRAI::geom::V_Boundary_Refine::Up
 
           if(i<i_max)
             {
-              v_plus=quad_offset_interpolate(v(center+ip-jp),v(center+ip),
-                                             v(center+ip+jp));
+              /* This is a bit inefficient, because we compute v_plus
+               * twice.  Once for the in-between point, and again
+               * later for the actual point. */
+
+              v_plus=quad_offset_interpolate(v(center+ip-jp_s),v(center+ip),
+                                             v(center+ip+jp_s));
               v_fine(fine+ip)=(v_center+v_plus)/2;
 
               /* Since we update two points on 'i' at once, we increment 'i' again.
@@ -87,8 +92,8 @@ void SAMRAI::geom::V_Boundary_Refine::Up
         }
       else
         {
-          v_plus=quad_offset_interpolate(v(center+ip-jp),v(center+ip),
-                                         v(center+ip+jp));
+          v_plus=quad_offset_interpolate(v(center+ip-jp_s),v(center+ip),
+                                         v(center+ip+jp_s));
           v_fine(fine)=(v_center+v_plus)/2;
         }
     }



More information about the CIG-COMMITS mailing list