D.2.3 Valid_State_Communication Procedure

The main documentation of the Valid_State_Communication Procedure contains additional explanation of this code listing.

  function Valid_State_Communication (Communication) result(Valid)

    ! Input variable.

    ! Place holder to allow generic procedure calls -- real data associated  
    ! with the communication is stored in global class variables for easy 
    ! access.
    type(Communication_type), intent(in) :: Communication

    ! Output variables.

    type(logical) :: Valid           ! Logical state.

    !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ! Start out true.

    Valid = .true.

    ! Must be either serial or parallel.

    Valid = Valid .and. (Parallel .neqv. Serial)

    ! Limits on this_PE.

    Valid = Valid .and. (this_PE .InInterval. (/ 1, NPEs /) )

    ! Limits on IO_PE.

    Valid = Valid .and. (IO_PE .InInterval. (/ 1, NPEs /) )
    Valid = Valid .and. ((IO_PE == this_PE) .eqv. this_is_IO_PE)
    Valid = Valid .and. ((delta_PE_IO_PE == 1) .eqv. this_is_IO_PE)

    ! Serial-only checks.

    if (Serial) then
      Valid = Valid .and. NPEs == 1
      Valid = Valid .and. this_PE == 1
      Valid = Valid .and. IO_PE == 1
      Valid = Valid .and. this_is_IO_PE
      Valid = Valid .and. Parallel_Library == 'None'
    end if

    return
  end function Valid_State_Communication



Michael L. Hall