  !----------------------------------------------------------------------
  ! Plots a 2d plot of gf-subval at time "time". The plot is named "name".
  ! The 2d slice has constant "dir" coordinate equal to "val".
  !----------------------------------------------------------------------
  subroutine f_plot2(llb,ub,s,gf,name,time,dir,val,subval,params)
    use input_params
    implicit none
    integer, dimension(3)             :: llb,ub,s
    real*8, dimension(s(1),s(2),s(3)) :: gf
    character (LEN=20)                :: name
    real*8,dimension(100)             :: params
    real*8                            :: time,subval
    integer                           :: dir,val
    integer                           :: java_ser2d,java_bbser2d,i,j,k,l
    real*8, dimension(:), allocatable :: coord1,coord2
    real*8,dimension(4) :: bb
    
    integer                              :: gft_close,gft_write_brief,ret
    real*8, dimension(:),allocatable     :: temp
    integer, dimension(3)                :: sh,lb
    integer, dimension(2)                :: shp2


  write(6,*) "Sorry, subroutine f_plot2 is not yet available"
  return 

  end subroutine !f_plot2
  !----------------------------------------------------------------------
  ! Plots a 1d plot of gf-subval at time "time". The plot is named "name".
  ! The plot is along a 1d line
  !   with a constant "dir1" coordinate equal to "val1",
  !   and  a constant "dir2" coordinate equal to "val2"
  ! Assumes dir1<dir2.
  !----------------------------------------------------------------------
  subroutine f_plot1(llb,ub,s,gf,name,time,dir1,dir2,val1,val2,subval,params)
    use input_params
    implicit none
    integer, dimension(3)             :: llb,ub,s
    real*8, dimension(s(1),s(2),s(3)) :: gf
    character (LEN=20)                :: name
    real*8                            :: time,subval
    real*8, dimension(100)            :: params
    integer                           :: dir1,dir2,val1,val2,val1s,val2s
    
    integer                              :: vsrc,java_pser,java_fser,java_ser
    integer                              :: dir
    real*8, dimension(:), allocatable    :: temp,coord
    integer, dimension(3)                :: sh,lb
    integer                              :: i
    
    if(params(P_SCIVIZ)< 0.5) return

    sh = shape(gf)
    lb = lbound(gf)


    do dir = 1,3
      if(dir1 /= dir .and. dir2 /= dir) exit
    end do

    allocate(temp(sh(dir)),coord(sh(dir)))

    do i = 1,sh(dir)
      coord(i) = params(P_GRIDSPACING)*(i+llb(dir)-1)
    end do
! convert the values of val1,val2 for parallel processing too
		val1s = val1
		val2s = val2

		val1 = val1 +llb(dir1)
		val2 = val2 +llb(dir2)


    if ( (val1.eq.val1s).and.(val2.eq.val2s) ) then

    
    select case(dir)
    case(1)
      temp   = gf(:,val1,val2) - subval
      coord  = coord + params(P_XMIN)

    case(2)
      temp   = gf(val1,:,val2) - subval
      coord  = coord + params(P_YMIN)
    case(3)
      temp   = gf(val1,val2,:) - subval
      coord  = coord + params(P_ZMIN)
    end select


    vsrc = java_ser(name,time,coord,temp,shape(temp)) 

	end if

    deallocate(temp,coord)

  end subroutine !f_plot1

