get_next_token_parallel Subroutine

public subroutine get_next_token_parallel(handler, buf)

Extract the next token from the layout file

Each token is on a separate line. There may be multiple comments (lines beginning with #) and blank lines in between. The purpose of this subroutine is to ignore all these lines and return the next "useful" line.

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: handler
character(len=STRING_BUFFER_LENGTH), intent(out) :: buf

Called by

proc~~get_next_token_parallel~~CalledByGraph proc~get_next_token_parallel get_next_token_parallel proc~read_layout_file read_layout_file proc~read_layout_file->proc~get_next_token_parallel proc~setup_solver setup_solver proc~setup_solver->proc~read_layout_file proc~start_run start_run proc~start_run->proc~setup_solver program~main main program~main->proc~start_run

Contents


Source Code

  subroutine get_next_token_parallel(handler, buf)
    !< Extract the next token from the layout file
    !<
    !< Each token is on a separate line.
    !< There may be multiple comments (lines beginning with #) 
    !< and blank lines in between.
    !< The purpose of this subroutine is to ignore all these 
    !< lines and return the next "useful" line.
    !-----------------------------------------------------------

    implicit none
    integer, intent(in) :: handler
    character(len=STRING_BUFFER_LENGTH), intent(out) :: buf
    integer :: ios

    do
       !read(CONFIG_FILE_UNIT, '(A)', iostat=ios) buf
       read(handler, '(A)', iostat=ios) buf
       if (ios /= 0) then
          print *, 'Error while reading config file.'
          print *, 'Current buffer length is set to: ', &
               STRING_BUFFER_LENGTH
          stop
       end if
       if (index(buf, '#') == 1) then
          ! The current line begins with a hash
          ! Ignore it
          continue
       else if (len_trim(buf) == 0) then
          ! The current line is empty
          ! Ignore it
          continue
       else
          ! A new token has been found
          ! Break out
          exit
       end if
    end do

  end subroutine get_next_token_parallel