TABLE OF CONTENTS


ca_hx_input/ca_cmd_real [ Subroutines ]

[ Top ] [ ca_hx_input ] [ Subroutines ]

NAME

ca_cmd_real

SYNOPSIS

subroutine ca_cmd_real( n, data )

INPUTS

integer, intent( in ) :: n

!    n - number of command line arguments to read

OUTPUT

real(kind=rdef) :: data(n)

!      data - array of real of size n, which contains the N command
!    line arguments.

SIDE EFFECTS

None DESCIPTION Read all command line arguments, assume these are integer or floating point, and save them into a real array "data". Some simple checks are done, but possible other special cases will be missed. Use with caution!

USES

USED BY

ca_iter_tl, ca_run

SOURCE

character(len=100) :: value
character(len=10) :: fmt
integer i, arglen, ierr
do i = 1, n
   call get_command_argument( i, value, arglen, ierr )

   if (ierr .gt. 0) then
     write (*,'(a,i0,a)') "ERROR: ca_hx_input/ca_cmd_input: argument ",&
                          i, " cannot be retrieved"
     error stop
   elseif (ierr .eq. -1) then
     write (*,'(a,i0,a)') "ERROR: ca_hx_input/ca_cmd_input: argument ",&
                i, " length is longer than the string to store it"
     error stop
   elseif (ierr .lt. -1) then
     write (*,'(3(a,i0))') "ERROR: ca_hx_input/ca_cmd_input:" //       &
                " get_command_argument( ", i, " ) returned ", ierr,    &
                "unknown error, should never end up here"
     error stop
   end if

   write(fmt,"(a,i0,a)") "(f", arglen, ")"
   read (value,fmt) data(i)

end do

end subroutine ca_cmd_real

CASUP/ca_hx_input [ Modules ]

[ Top ] [ Modules ]

NAME

ca_hx_input

SYNOPSIS

!$Id: ca_hx_input.f90 561 2018-10-14 20:48:19Z mexas $

module ca_hx_input

DESCRIPTION

Module with routines to input command line data into programs.

AUTHOR

Anton Shterenlikht

COPYRIGHT

See LICENSE

CONTAINS

Public subroutines: ca_cmd_real

USES

USED BY

SOURCE

use cgca_m1co, only : rdef
implicit none

private
public :: ca_cmd_real

contains