read_parameters Subroutine

public subroutine read_parameters()

Read in the run-time parameters from a file. The name of the file is read from the first command line option. If no command line options are given, use 'input.par'.

The parameters are read in one go using the namelist mechanism.

Arguments

None

Called by

proc~~read_parameters~~CalledByGraph proc~read_parameters read_parameters program~test test program~test->proc~read_parameters

Contents

Source Code


Source Code

    subroutine read_parameters ()
    !! Read in the run-time parameters from a file. The name of the file
    !! is read from the first command line option. If no command line options
    !! are given, use 'input.par'.
    !!
    !! The parameters are read in one go using the namelist mechanism.

      implicit none
      integer :: argc, arglen, errno
      character(len=256) :: inputpar

      argc = command_argument_count()
      if (argc == 0) then
        inputpar = 'input.par'
      else
        call get_command_argument(1, inputpar, arglen, errno)
        if (errno .ne. 0) then
          write(*,*) "Error retrieving command line argument"
          stop
        endif
      endif

      open(1, file = inputpar, status='old', form = 'formatted', &
              action = 'read' )
      read(1, nml=params)
      close(1)
    end subroutine read_parameters