test_connect_multi Subroutine

public subroutine test_connect_multi(this)

Arguments

Type IntentOptional Attributes Name
class(MpiTestMethod), intent(inout) :: this

Calls

proc~~test_connect_multi~~CallsGraph proc~test_connect_multi test_connect_multi assertequal assertequal proc~test_connect_multi->assertequal getmpicommunicator getmpicommunicator proc~test_connect_multi->getmpicommunicator getprocessrank getprocessrank proc~test_connect_multi->getprocessrank mpi_comm_split mpi_comm_split proc~test_connect_multi->mpi_comm_split none~connect_to_client~2 DirectoryService%connect_to_client proc~test_connect_multi->none~connect_to_client~2 none~connect_to_server~2 DirectoryService%connect_to_server proc~test_connect_multi->none~connect_to_server~2 none~free_directory_resources~2 DirectoryService%free_directory_resources proc~test_connect_multi->none~free_directory_resources~2 none~publish~2 DirectoryService%publish proc~test_connect_multi->none~publish~2

Source Code

   subroutine test_connect_multi(this)
      class (MpiTestMethod), intent(inout) :: this

      type (DirectoryService) :: ds
      integer :: comm
      integer :: ierror

      integer :: color, key
      type (MockServer) :: mock_server
      type (MockClient) :: mock_client

      ds = DirectoryService(this%getMpiCommunicator())

      color = this%getProcessRank()/3
      key = 0
      call MPI_Comm_split(this%getMpiCommunicator(), color, key, comm, ierror)
      @assertEqual(0, ierror)

      select case (color)
      case (1) ! server
         mock_server = MockServer(comm)
         call ds%publish(PortInfo('input', mock_server), mock_server)

         select case (this%getProcessRank())
         case (3) ! have one
            call ds%connect_to_client('input', mock_server)
         case (4)
            call ds%connect_to_client('input', mock_server)
         end select
      case (0) ! client
         mock_client = MockClient()
         call ds%connect_to_server('input', mock_client, comm)
      end select

      call ds%free_directory_resources()

   end subroutine test_connect_multi