handshake Subroutine

public subroutine handshake(this, paths)

identify and connect clients

Arguments

TypeIntentOptionalAttributesName
class(mimic_communicator), intent(inout) :: this
character(len=*), intent(in), dimension(:):: paths

array of paths to working folders of clients


Contents

Source Code


Source Code

subroutine handshake(this, paths)

    class(mimic_communicator), intent(inout) :: this
    !> array of paths to working folders of clients
    character(len=*), dimension(:), intent(in) :: paths

    integer :: n_client
    character(len=:), allocatable :: merged_paths
    integer :: n_char, i

    this%num_clients = size(paths)
    n_char = 0

    do n_client = 1, this%num_clients
        if (n_client > 1) then
            n_char = n_char + 1
        end if
        n_char = n_char + len_trim(paths(n_client))
    end do

    allocate(character(len = n_char) :: merged_paths)

    merged_paths = ""

    do n_client = 1, this%num_clients
        if (n_client > 1) then
            merged_paths = merged_paths // delimiter
        end if
        merged_paths = merged_paths // trim(paths(n_client))
    end do

    call mcl_handshake(merged_paths, delimiter, .true.)

end subroutine handshake