test04 Subroutine

public subroutine test04()

TEST04 plots vector data.

Arguments

None

Calls

proc~~test04~~CallsGraph proc~test04 test04 proc~run_gnuplot run_gnuplot proc~test04->proc~run_gnuplot proc~write_vector_data write_vector_data proc~test04->proc~write_vector_data proc~write_vector_plot write_vector_plot proc~test04->proc~write_vector_plot proc~get_unit get_unit proc~write_vector_data->proc~get_unit proc~write_vector_plot->proc~get_unit

Called by

proc~~test04~~CalledByGraph proc~test04 test04 program~test_gnufor test_gnufor program~test_gnufor->proc~test04

Source Code

subroutine test04
!
!*******************************************************************************
!
!! TEST04 plots vector data.
!
  implicit none
!
  integer, parameter :: nx = 21
  integer, parameter :: ny = 21
  integer, parameter :: n = nx * ny
!
  character ( len = 100 ) :: command_file_name = 'tmp/test04_commands.txt'
  character ( len = 100 ) :: data_file_name = 'tmp/test04_data.txt'
  real dx(n)
  real dy(n)
  integer i
  integer ierror
  integer j
  integer k
  real x(n)
  real, parameter :: xmax = 1.0E+00
  real, parameter :: xmin = -1.0E+00
  real xx
  real y(n)
  real, parameter :: ymax = 1.0E+00
  real, parameter :: ymin = -1.0E+00
  real yy
!
  write ( *, '(a)' ) ' '
  write ( *, '(a)' ) 'TEST04'
  write ( *, '(a)' ) '  To plot a vector field,'
  write ( *, '(a)' ) '  WRITE_VECTOR_DATA writes the data file,'
  write ( *, '(a)' ) '  WRITE_VECTOR_PLOT writes the plot command file.'

  k = 0

  do i = 1, nx

    do j = 1, ny

      k = k + 1

      xx = ( real ( nx - i ) * xmin + real ( i - 1 ) * xmax ) / real ( nx - 1 )
      yy = ( real ( ny - j ) * ymin + real ( j - 1 ) * ymax ) / real ( ny - 1 )

      dx(k) = - 0.10E+00 * yy
      dy(k) =   0.10E+00 * xx

      x(k) = xx - 0.5E+00 * dx(k)
      y(k) = yy - 0.5E+00 * dy(k)

    end do

  end do

  call write_vector_data ( data_file_name, n, x, y, dx, dy, ierror )

  if ( ierror /= 0 ) then
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'TEST04'
    write ( *, '(a,i6)' ) '  WRITE_VECTOR_DATA returned IERROR = ', ierror
  end if

  call write_vector_plot ( command_file_name, data_file_name, ierror )

  if ( ierror /= 0 ) then
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'TEST04'
    write ( *, '(a,i6)' ) '  WRITE_VECTOR_PLOT returned IERROR = ', ierror
  end if

  call run_gnuplot ( command_file_name )

  return
endsubroutine test04