!........................................................................ ! ! Subroutine : get_cl_input (con_file, con) ! ! Description: Gets command line parameters for BMADZ ! ! Arguments : ! ! Mod/Commons: ! ! Calls : ! ! Author : R. Helms ! ! Modified : ! !........................................................................ ! ! ! $Log$ ! Revision 1.9 2007/01/30 16:15:13 dcs ! merged with branch_bmad_1. ! ! Revision 1.6 2003/11/10 17:01:53 dcs ! removed lat symmetry ! ! Revision 1.5 2003/09/23 18:31:28 dlr ! with carriage return, uses lattice in constraint file ! ! Revision 1.4 2003/06/18 20:43:30 helms ! Fixed bug with longitudinal position calculation and -p flag. ! ! Revision 1.3 2003/06/17 21:04:08 helms ! Fixed "-p" option. ! Changed plotdo_bmadz to effeciently calculate logitudinal positions of ! elements on the fly. ! ! Revision 1.2 2003/06/07 20:44:29 cesrulib ! conform to the lahey f95 standard ! ! Revision 1.1 2003/05/30 14:19:41 helms ! Improved line command parsing. ! Extended structures for damping lattices. ! !........................................................................ ! subroutine get_cl_input (con_file, con) !---------------------------------------------------------- ! It works like this... ! ! You can enter nothing on the command line and bmadz will prompt you ! for a constraint file. Then it will prompt you for a lattice file ! with the default found in the constraint file. ! ! You can enter only a constraint file and bmadz will use the lattice ! file from the constraint file automatically ! ! You can enter both a constraint and lattice file, and an optional ! third argument which will somehow control plotting use constraints_mod use sim_utils implicit none character*(*), intent(out) :: con_file type (constraint_struct), intent(out) :: con character*20, parameter :: default_con_file = 'cons_nochange.in' integer nargs, iargc character(80) arg, dummy ! setup some default stuff con%ele_names(1) = ' ' nargs = command_argument_count() ! get constraint file if (nargs > 3) then print*, 'Usage: bmadz [cons_file [lattice_file [-p]]]' stop end if if (nargs == 0) then write(*,'("Enter constraint file <",A,">: ")',advance="no") & trim(default_con_file) read(*,'(A)') con_file if (con_file == '') con_file = default_con_file call read_constraints (con_file, con) write(*,'("Enter lattice file <",A,">: ")',advance="no") & trim(con%lat_file) read(*,'(A)') dummy if(dummy /= ' ')con%lat_file = dummy return end if if(nargs >= 1)then call get_command_argument(1, con_file) print*, "Using ", trim(con_file) call read_constraints (con_file, con) ! get lattice file (otherwise, use filename from constraint file if (nargs >= 2) then call get_command_argument(2, con%lat_file) print*, "Using ", trim(con%lat_file) ! look for '-p' if (nargs >=3) then call get_command_argument(3, arg) if (arg(:2) == '-p') then con%n_loops = 0 con%plot = .true. else print*, "Unrecognized option: ", trim(arg) end if end if end if end if end subroutine get_cl_input