anchor.diff:        is_manifold = manifold .eq. 1
   
         r2 = refratio*refratio
  -      do mq = 1,meqn
  -c        # Loop over four corner cells on coarse grid
  -         do ibc = 1,mbc
  -            do jbc = 1,mbc
  -c              # Average fine grid corners onto coarse grid ghost corners
  -               if (icorner_coarse .eq. 0) then
  -    1             i1 = 1-ibc
  -                  j1 = 1-jbc
  -               elseif (icorner_coarse .eq. 1) then
  -                  i1 = mx+ibc
  -                  j1 = 1-jbc
  -               elseif (icorner_coarse .eq. 2) then
  -                  i1 = 1-ibc
  -                  j1 = my+jbc
  -               elseif (icorner_coarse .eq. 3) then
  -                  i1 = mx+ibc
  -                  j1 = my+jbc
  -               endif
  -
  -c              # Again, a fake routine until the real one is
  -c              # available (be sure to pass in (i1,j1)
  -               call fclaw2d_transform_corner_half(i1,j1,i2,j2,
  -     &               transform_cptr)
  -               if (is_manifold) then
  +c     # Loop over four corner cells on coarse grid
  +      do ibc = 1,mbc
  +         do jbc = 1,mbc
  +c           # Average fine grid corners onto coarse grid ghost corners
  +            if (icorner_coarse .eq. 0) then
  +    1          i1 = 1-ibc
  +               j1 = 1-jbc
  +            elseif (icorner_coarse .eq. 1) then
  +               i1 = mx+ibc
  +               j1 = 1-jbc
  +            elseif (icorner_coarse .eq. 2) then
  +               i1 = 1-ibc
  +               j1 = my+jbc
  +            elseif (icorner_coarse .eq. 3) then
  +               i1 = mx+ibc
  +               j1 = my+jbc
  +            endif
  +
  +c           # Again, a fake routine until the real one is
  +c           # available (be sure to pass in (i1,j1)
  +            call fclaw2d_transform_corner_half(i1,j1,i2,j2,
  +     &            transform_cptr)
  +            if (is_manifold) then
  +               do mq = 1,meqn
                     sum = 0
                     af_sum = 0
                     do m = 0,r2-1
  
positive.code: 
  c                       # Use areas of the fine grid mesh cells instead.
                          qcoarse(ic,jc,mq) = sum/af_sum
                       else
                          sum = 0
                          do m = 0,r2-1
                             sum = sum + qfine(i2(m),j2(m),mq)
                          enddo
                          qcoarse(ic,jc,mq) = sum/dble(r2)
                       endif
                    endif
                 enddo
              enddo
           else
  c           # idir = 1 (faces 2,3)
              do ic = 1,mx
                 do jbc = 1,mbc
  
                    if (iface_coarse .eq. 2) then
                       jc = 1-jbc
                    elseif (iface_coarse .eq. 3) then
                       jc = my+jbc
                    endif
  
                    call fclaw2d_transform_face_half(ic,jc,i2,j2,
       &                  transform_cptr)
                    skip_this_grid = .false.
                    do m = 0,r2-1
                       if (.not. is_valid_average(i2(m),j2(m),mx,my))
       &                     then
                          skip_this_grid = .true.
                       endif
                    enddo
                    if (.not. skip_this_grid) then
                       if (is_manifold) then
                          sum = 0
                          af_sum = 0
                          do m = 0,r2-1
  
negative.code:                         kc = areacoarse(ic,jc)
  c                        qcoarse(ic,jc,mq) = sum/kc
                          qcoarse(ic,jc,mq) = sum/af_sum
                       enddo
                    else
                       do mq = 1,meqn
                          sum = 0
                          do m = 0,r2-1
                             sum = sum + qfine(i2(m),j2(m),mq)
                          enddo
                          qcoarse(ic,jc,mq) = sum/dble(r2)
                       enddo  !! end meqn
                    endif  !! manifold loop
                 endif !! skip grid loop
              enddo
           enddo
        endif
  
        end
  
  