The main documentation of the Initialize_Trace Procedure contains additional explanation of this code listing.
define([INITIALIZE_ROUTINE],[ pushdef([DIM], [$1]) pushdef([Initialize_Trace_DIM], expand(Initialize_Trace_DIM)) subroutine Initialize_Trace_DIM (Trace, Index, Length_PE, status) ! Input variables. type(integer,DIM,np), intent(in) :: Index ! Indirect reference indices. type(integer) :: Length_PE ! Length of destination vector on this PE. ! Output variables. ! Trace to be initialized. type(Trace_type), intent(out) :: Trace type(Status_type), intent(out), optional :: status ! Exit status. ! Internal variables. type(Status_type), dimension(2) :: allocate_status ! Allocation Status. type(Status_type) :: consolidated_status ! Consolidated Status. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Verify requirements. VERIFY(Valid_State(Index),5) ! Index is valid. ! Set allocation status. call Initialize (allocate_status) call Initialize (consolidated_status) ! Initialize internal structures. ifelse(DIM, [1], [ call Initialize (Trace%Index1, SIZE(Index,1), allocate_status(1)) call Initialize (Trace%Mask1, SIZE(Index,1), allocate_status(2)) ],[ call Initialize (Trace%Index2, SIZE(Index,1), SIZE(Index,2), & allocate_status(1)) call Initialize (Trace%Mask2, SIZE(Index,1), SIZE(Index,2), & allocate_status(2)) ]) Trace%Index[]DIM = Index Trace%Dimensionality = DIM Trace%Mask[]DIM = Index /= 0 ! PGSLib Trace set-up. ifdef([USE_PGSLIB],[ NULLIFY(Trace%Trace) Trace%Trace => PGSLib_Setup_Trace (Trace%Index[]DIM, Length_PE, & Mask=Trace%Mask[]DIM) ]) ! Process status variables. consolidated_status = allocate_status if (PRESENT(status)) then WARN_IF(Error(consolidated_status), 5) status = consolidated_status else VERIFY(Normal(consolidated_status), 5) end if call Finalize (consolidated_status) call Finalize (allocate_status) ! Set initialization flag. call Initialize (Trace%Initialized, 0) ! Verify guarantees. VERIFY(Valid_State(Trace),5) ! Trace is now valid. return end subroutine Initialize_Trace_DIM popdef([DIM]) popdef([Initialize_Trace_DIM]) ]) forloop([Dim],[1],[2],[ INITIALIZE_ROUTINE(Dim) ])