merged initialize routine

This commit is contained in:
Bryan Herman 2012-04-02 11:37:54 -07:00
commit c75821c236

View file

@ -221,19 +221,24 @@ contains
integer :: argc ! number of command line arguments
integer :: last_flag ! index of last flag
character(MAX_FILE_LEN) :: pwd ! present working directory
character(MAX_WORD_LEN) :: argv(20) ! command line arguments
character(MAX_WORD_LEN), allocatable :: argv(:) ! command line arguments
! Get working directory
call GET_ENVIRONMENT_VARIABLE("PWD", pwd)
! Check number of command line arguments
! Check number of command line arguments and allocate argv
argc = COMMAND_ARGUMENT_COUNT()
! Get all command line arguments
last_flag = 0
! Allocate and retrieve command arguments
allocate(argv(argc))
do i = 1, argc
call GET_COMMAND_ARGUMENT(i, argv(i))
end do
! Process command arguments
last_flag = 0
i = 1
do while (i <= argc)
! Check for flags
if (starts_with(argv(i), "-")) then
select case (argv(i))
@ -245,7 +250,9 @@ contains
case ('-v', '-version', '--version')
call print_version()
stop
case('-eps_tol','-ksp_gmres_restart')
case ('-eps_tol', '-ksp_gmres_restart')
! Handle options that would be based to PETSC
i = i + 1
case default
message = "Unknown command line option: " // argv(i)
call fatal_error()
@ -266,6 +273,8 @@ contains
last_flag = last_flag + 1
path_input = pwd
end if
! Increment counter
i = i + 1
end do
if (last_flag == 0) path_input = pwd
@ -275,6 +284,9 @@ contains
path_input = trim(path_input) // "/"
end if
! Free memory from argv
deallocate(argv)
! TODO: Check that directory exists
end subroutine read_command_line