anchor.diff:        integer rr2
         parameter(rr2 = 4)
         integer i2(0:rr2-1),j2(0:rr2-1)
  +
  +      integer a(2,2)
  +      integer ii,jj,iff,jff,dc(2),df(2,0:rr2-1)
  +      double precision shiftx(0:rr2-1), shifty(0:rr2-1)
  +      logical check_indices
   
         r2 = refratio*refratio
         if (r2 .ne. rr2) then
  
positive.code:       double precision qfine(1-mbc:mx+mbc,1-mbc:my+mbc,meqn)
  
        integer ic, jc, mq, ibc,jbc, mth,i,j
        double precision qc, sl, sr, gradx, grady, shiftx, shifty
        double precision compute_slopes, value
  
  c     # This should be refratio*refratio.
  
negative.code:                   sr = (qcoarse(ic,jc+1,mq) - qc)
                    grady = compute_slopes(sl,sr,mth)
  
                    do m = 0,rr2-1
                       iff = i2(0) + df(1,m)
                       jff = j2(0) + df(2,m)
                       value = qc + gradx*shiftx(m) + grady*shifty(m)
                       qfine(iff,jff,mq) = value
                    enddo
  
                 endif                    !! Don't skip this grid
              enddo                       !! i loop
           endif                          !! end idir branch
        enddo                             !! endo mq loop
  
        end
  
        logical function check_indices(iff,jff,i2,j2)
        implicit none
  
        integer iff,jff,i2(0:3),j2(0:3)
        integer m
        logical found_iff, found_jff
  
        found_iff = .false.
        do m = 0,3
           if (i2(m) .eq. iff) then
              found_iff = .true.
              exit
           endif
        enddo
  
        found_jff = .false.
        do m = 0,3
           if (j2(m) .eq. jff) then
              found_jff = .true.
              exit
           endif
        enddo
  
        check_indices = found_iff .and. found_jff
  
  
        end
  
  