anchor.diff:  
   end module
   
  +! Converts a string into an integer
   subroutine str2int(str, i, stat)
       implicit none
       ! Arguments
  
positive.code:         
          integer :: j
          
          obj % ndims = size(velocity)
          obj % v = velocity
          obj % lengths = lengths
  
negative.code:     end subroutine
      
      ! Advance by one time step
      ! @param deltaTime time step
      subroutine upwind_advect(obj, deltaTime)
      
          type(upwind_type) :: obj
          real(r8), intent(in) :: deltaTime
  
          real(r8), allocatable :: oldF(:)
          integer :: i, j, oldIndex, upI
          integer :: inds(obj % ndims)
          
          ! allocate and copy the field (f95)
          oldF = obj % f
  
          ! iterate over the cells
          do i = 1, obj % ntot
  
              ! compute the index set of this cell
              call upwind_getIndexSet(obj, i, inds)
  
              ! iterate over the directions
              do j = 1, obj % ndims
                  
                  ! cache the cell index
                  oldIndex = inds(j)
                  
                  ! increment the cell index
                  inds(j) = inds(j) + obj % upDirection(j)
                  
                  ! apply periodic BCs
                  inds(j) = mod(inds(j) + obj % numCells(j) - 1, obj % numCells(j)) + 1
                    
                  ! compute the new flat index 
                  call upwind_getFlatIndex(obj, inds, upI)
                      
                  ! update the field
                  obj % f(upI) = obj % f(upI) - &
                &               deltaTime*obj % v(j)*obj % upDirection(j)*(oldF(upI) - oldF(i))/obj % deltas(j)
                      
                  ! reset the index
                  inds(j) = oldIndex
             enddo
          enddo
  
      end subroutine
  