parse_contact Subroutine

private subroutine parse_contact(string, tiles, tile1, tile2)

Arguments

Type IntentOptional Attributes Name
character(len=*) :: string
character(len=*), intent(in), target :: tiles(:)
integer, intent(out) :: tile1
integer, intent(out) :: tile2

Source Code

subroutine parse_contact(string, tiles, tile1, tile2)

  character(len=*)                      :: string
  character(len=*), intent(in), target :: tiles(:)
  integer, intent(out) :: tile1, tile2

  integer :: pos, pos1, pos2
  integer :: length
  character(len=ESMF_MAXSTR) :: tempstr, tilestr
  integer :: i

  call trim_null(string)
  length = len_trim(string)
  pos=index(string, "::")
  pos1 = index(string(1:pos-1), ":")
  tilestr = string(pos1+1:pos-1)

  do i=1,size(tiles)
    if (trim(tilestr) .eq. trim(tiles(i))) then
       tile1 = i
       exit
    endif
  enddo
  tempstr = string(pos+2:length)
  pos1 = index(tempstr,":");
  tilestr = tempstr(pos1+1:len(trim(tempstr)))
  do i=1,size(tiles)
    if (tilestr .eq. trim(tiles(i))) then
       tile2 = i
       exit
    endif
  enddo
  return
end subroutine parse_contact