c %Z% %M% %I% (IDS) %G%

C+
C*
C*   This file contains the following routines in the host part 
C*   of the host-node program (only one subroutine is active -
C*   not commented out at a time. This enables performance 
C*   measurements to be made easily.) :
C*   
C*   1) subroutine bic1nu - stub for the bicubic interpolation.
C*   2) subroutine bill   - not used.
C*                              
C-

C+
C  subroutine bic1nu - This is a stub for the bicubic interpolation.    
C  It calls the routine hnint (host-node interface) which passes the      
C  input parameters to the nodes and fetches the output parameters
C  from the nodes.
C
C  Inputs : wina corresponds to yuupt
C           winb    "        "  yvvpt
C           rlatitude "      "  sphi
C           rlongitude "     "  slam
C           faclama   
C           faclamb    
C           facphia
C           facphib 
C           ja, jb      - range of indices
C           interpol    - bicubic
C  
C  Outputs : woua corresponds to yuupts or yvvpts
C            woub     "       "  yvupts or yuvpts
C  
C  For further details about the quantities one is referred to Yong Li's 
C  notes.
C-

      subroutine bic1nu (wina, woua,faclama,facphia,
     *                   winb, woub,faclamb,facphib,
     *                            rlatitude, rlongitude,ja,jb)

      include "slgcm.slgprm"
      include "slgcm.mp"


      real   wina ( imp3 ,jmp3 )   !first input field
      real   woua ( imp3 ,jm   )   !first output field
      real   winb ( imp3 ,jmp3 )   !second input field
      real   woub ( imp3 ,jm   )   !second output field
      real   rlatitude  ( imp3 ,jm   ) ! arrays with coordinates on
      real   rlongitude  ( imp3 ,jm   ) ! which the subroutine interpolates
      real   faclama
      real   faclamb
      real   facphia
      real   facphib
      integer ja, jb

CD
      integer icount
      common /serial/ icount
CD
      integer k,j

      print *, "Calling hnint for bic"
      icount = icount + 1                       ! number of requests made
      call hnint  (wina, woua,faclama,facphia,
     *             winb, woub,faclamb,facphib,
     *             rlatitude, rlongitude,ja,jb, MPBIC)

      call wrap(ja,jb,woua)                  
      call wrap(ja,jb,woub)
CD
 109  format ( 4F18.13 )
      print *, "Writing results 0"
D      open (unit = 14, file = 'woua64_n.out', status = 'scratch' )
D      close(14)
D      open (unit = 14, file = 'woua64_n.out', status = 'new' )
D      write (14,*), "ICOUNT : ", icount
D      write (14,*), "WOUA"
D      write (14,109), ((woua(k,j), k = 1, imp3), j = 1, jm)
D      close(14)
CC      if (icount .eq. 1) then
CC      do j = 1, jm
CC         do k = 1, imp3
CC            print *, woua(k,j)
CC         enddo
CC      enddo
CC      endif
      print *, "Writing results 2"
D      open (unit = 15, file = 'woub64_n.out', status = 'scratch' )
D      close(15)
D      open (unit = 15, file = 'woub64_n.out', status = 'new' )
D      write (15,*), "ICOUNT : ", icount
D      write (15,*), "WOUB"
D      write (15, 109), ((woub(k,j), k = 1, imp3), j = 1, jm)
D      close (15)

CD      if (icount .eq. 4) then
CD         open (unit = 13, file = 'wou64_4.out', status = 'scratch' )
CD         close(13)
CD         open (unit = 13, file = 'wou64_4.out', status = 'new' )
CD         write(13,*), "WOUA"
CD         write (13, 109), ((woua(k,j), k = 1, imp3), j = 1, jm)
CD         write(13,*), "WOUB"
CD         write (13, 109), ((woub(k,j), k = 1, imp3), j = 1, jm)
CD         close (13)
CD      endif
         
      return
      end


C1      subroutine bill(wina, woua,faclama, facphia,
C1     *                winb, woub,faclamb, facphib, 
C1     *                rlatitude,rlongitude, ja, jb)
C1
C1      include "slgcm.slgprm"
C1      include "slgcm.mp"
C1
C1
C1      call hnint  (wina, woua,faclama,facphia,
C1     *             winb, woub,faclamb,facphib,
C1     *             rlatitude, rlongitude,ja,jb, MPBILL)
C1
C1      end







