anchor.diff:     CHARACTER(1024)                         :: FileName
      CHARACTER(1024)                         :: descr                ! Line describing the contents of the file
      CHARACTER(1024)                         :: vecLabel
  -   INTEGER(IntKi)                          :: n
  +   INTEGER(IntKi)                          :: ir, iOutDist, i_plane, iVelPt
  +   REAL(ReKi)                              :: vel(3), pt(3)
      INTEGER(IntKi)                          :: Un                   ! unit number of opened file   
      
      ErrStat = ErrID_None
  
positive.code:       ! TODO: Encapsulate all of this into a subroutine call
        !--------------------
        ! If requested write output channel data
     
     
     
  
     
     
     
  
negative.code:    
     CONTAINS
  
     subroutine TrilinearInterpRegGrid(V, pt, dims, val)
     
        real(ReKi),     intent(in   ) :: V(:,:,:,:)
        real(ReKi),     intent(in   ) :: pt(3)
        integer(IntKi), intent(in   ) :: dims(3)
        real(ReKi),     intent(  out) :: val(3)
     
        integer(IntKi) :: x0,x1,y0,y1,z0,z1
        real(ReKi) :: xd,yd,zd,c00(3),c01(3),c10(3),c11(3),c0(3),c1(3)
        
        x0 = floor(pt(1))
  
        x1 = x0 + 1
        if (x0 == dims(1)) x1 = x0  ! Handle case where x0 is the last index in the grid, in this case xd = 0.0, so the 2nd term in the interpolation will not contribute
        xd = pt(1) - x0
        y0 = floor(pt(2))
        y1 = y0 + 1
        if (y0 == dims(2)) y1 = y0  ! Handle case where y0 is the last index in the grid, in this case yd = 0.0, so the 2nd term in the interpolation will not contribute
        yd = pt(2) - y0
        z0 = floor(pt(3))
        z1 = z0 + 1
        if (z0 == dims(3)) z1 = z0  ! Handle case where z0 is the last index in the grid, in this case zd = 0.0, so the 2nd term in the interpolation will not contribute
        zd = pt(3) - z0
        
  
        c00 = V(:,x0,y0,z0)*(1.0_ReKi-xd) + V(:,x1,y0,z0)*xd
        c01 = V(:,x0,y0,z1)*(1.0_ReKi-xd) + V(:,x1,y0,z1)*xd
        c10 = V(:,x0,y1,z0)*(1.0_ReKi-xd) + V(:,x1,y1,z0)*xd
        c11 = V(:,x0,y1,z1)*(1.0_ReKi-xd) + V(:,x1,y1,z1)*xd
        
        c0  = c00*(1.0_ReKi-yd) + c10*yd
        c1  = c01*(1.0_ReKi-yd) + c11*yd
        
        val = c0 *(1.0_ReKi-zd) + c1 *zd
        
     end subroutine TrilinearInterpRegGrid
  
     
  !----------------------------------------------------------------------------------------------------------------------------------
  