write_xyzgrid_surface Subroutine

private subroutine write_xyzgrid_surface(command_file_name, data_file_name, ierror)

WRITE_XYZGRID_SURFACE writes a file of GNUPLOT commands to plot a 3D surface.

Arguments

Type IntentOptional Attributes Name
character(len=*) :: command_file_name
character(len=*) :: data_file_name
integer :: ierror

Calls

proc~~write_xyzgrid_surface~~CallsGraph proc~write_xyzgrid_surface write_xyzgrid_surface proc~get_unit get_unit proc~write_xyzgrid_surface->proc~get_unit

Called by

proc~~write_xyzgrid_surface~~CalledByGraph proc~write_xyzgrid_surface write_xyzgrid_surface proc~test05 test05 proc~test05->proc~write_xyzgrid_surface program~test_gnufor test_gnufor program~test_gnufor->proc~test05

Source Code

subroutine write_xyzgrid_surface ( command_file_name, data_file_name, ierror )
!
!*******************************************************************************
!
!! WRITE_XYZGRID_SURFACE writes a file of GNUPLOT commands to plot a 3D surface.
!
!
!  Discussion:
!
!    This routine tries to write a command file suitable for displaying
!    a surface Z(X,Y).  A grid data file, containing values of X, Y and Z,
!    will also be needed.  The routine WRITE_XYZGRID_DATA can write this file.
!
!  Modified:
!
!    22 February 2001
!
!  Author:
!
!    John Burkardt
!
!  Parameters:
!
!    Input, character ( len = * ) COMMAND_FILE_NAME, the name of the
!    command file.
!
!    Input, character ( len = * ) DATA_FILE_NAME, the name of the data file.
!
!    Output, integer IERROR, nonzero if an error occurred.
!
  implicit none
!
  character ( len = * ) command_file_name
  character ( len = * ) data_file_name
  integer file_unit
  !integer i
  integer ierror
  integer ios
  !integer ncol
!
!  Write the data file.
!
  ierror = 0

  call get_unit ( file_unit )

  if ( file_unit == 0 ) then
    ierror = 1
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'WRITE_XYZGRID_SURFACE - Fatal error!'
    write ( *, '(a)' ) '  Could not get a free FORTRAN unit.'
    return
  end if

  open ( unit = file_unit, file = command_file_name, status = 'replace', &
    iostat = ios )

  if ( ios /= 0 ) then
    ierror = 2
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'WRITE_XYZGRID_SURFACE - Fatal error!'
    write ( *, '(a)' ) '  Could not open the output file.'
    return
  end if

  write ( file_unit, '(a)' ) 'set title "GNUFOR plot"'
  write ( file_unit, '(a)' ) 'set xlabel "x"'
  write ( file_unit, '(a)' ) 'set ylabel "y"'
  write ( file_unit, '(a)' ) 'set parametric'
  write ( file_unit, '(a)' ) 'set pm3d implicit at s'!; set palette gray'
  write ( file_unit, '(a)' ) 'set hidden3d'
  !write ( file_unit, '(a)' ) 'set contour'
!~   write ( file_unit, '(a)' ) 'splot "' // trim ( data_file_name ) // &
!~     '" using 1:2:3 with lines'
  write ( file_unit, '(a)' ) 'splot "' // trim ( data_file_name ) // '"'
  write ( file_unit, '(a)' ) 'pause -1  "Hit return to continue"'
  write ( file_unit, '(a)' ) 'q'

  close ( unit = file_unit )

  write ( *, '(a)' ) ' '
  write ( *, '(a)' ) 'WRITE_SURFACE_COMMANDS:'
  write ( *, '(a)' ) '  Wrote the GNUPLOT surface plot command file "' // &
    trim ( command_file_name ) // '"'

  return
endsubroutine write_xyzgrid_surface