D.2.6 Broadcast Procedure

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

  define([BROADCAST_ROUTINE],[
    ifelse([$1], [character],
      [pushdef([TYPE], [character,*])],
      [pushdef([TYPE], [$1])])
    pushdef([DIM], [$2])
    pushdef([Broadcast_TYPE_DIM], expand(Broadcast_$1_DIM))

    subroutine Broadcast_TYPE_DIM (Variable)

      ! Input/Output variable.
  
      type(TYPE,DIM,np), intent(inout) :: Variable  ! Variable to be broadcast.
  
      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      ! Verify requirements - none.
  
      ! Do the global broadcast.

      ifdef([USE_PGSLIB],[
    
        ! PGSLib parallel broadcast.

        call PGSLib_BCast (Variable)

      ],[

        ! Serial broadcast - no op.

      ])

      ! Verify guarantees - none.

      return
    end subroutine Broadcast_TYPE_DIM
  
    popdef([TYPE])
    popdef([DIM])
    popdef([Broadcast_TYPE_DIM])
  ])

  forloop([Dim],[0],[3],[
    fortext([Type],[real integer logical],[
      BROADCAST_ROUTINE(Type, Dim)
    ])
  ])

  forloop([Dim],[0],[2],[
    BROADCAST_ROUTINE(character, Dim)
  ])



Michael L. Hall