The main documentation of the Output_Assembled_Vector Procedure contains additional explanation of this code listing.
subroutine Output_Assembled_Vector (AV, First, Last, Unit) ! Input variables. type(Assembled_Vector_type), intent(in) :: AV ! Variable to be output. type(integer), intent(in), optional :: First ! Extents of value data type(integer), intent(in), optional :: Last ! to be output. type(integer), intent(in), optional :: Unit ! Output unit. ! Internal variables. type(integer) :: A_Unit ! Actual output unit. type(integer) :: A_First ! Actual first value. type(integer) :: A_Last ! Actual last value. type(integer) :: i ! Loop counter. type(character,80) :: Name_Name ! Name of the AV. type(integer) :: Version_Number ! Version of the AV. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! Verify requirements. VERIFY(Valid_State(AV),5) ! AV is valid. ! Set unit number. if (PRESENT(Unit)) then A_Unit = Unit else A_Unit = 6 end if ! These are evaluated on all PEs -- NOT inside an IO PE block -- because ! they contain validity checks on AV and thus require global communication. Version_Number = Version(AV) Name_Name = Name(AV) ! Output Identification Info. if (this_is_IO_PE) then write (A_Unit,100) 'Assembled Vector Information:' write (A_Unit,*) ' Name = ', TRIM(Name_Name) write (A_Unit,*) ' Initialized = ', Initialized(AV) write (A_Unit,*) ' Version = ', Version_Number write (A_Unit,*) ' Dimensionality = ', AV%Dimensionality write (A_Unit,*) ' Dimensions = ', AV%Dimensions write (A_Unit,*) ' NValues_Total = ', AV%NValues_Total end if ! Output internal structure info. call Output (AV%Structure, A_Unit, 'Base', Indent=2) ! Output values. if (this_is_IO_PE) then write (A_Unit,100) ' Internal Values:' if (PRESENT(First)) then A_First = First else A_First = 1 end if if (PRESENT(Last)) then A_Last = Last else A_Last = Length_Total(AV%Structure) end if select case (AV%Dimensionality) case (1) do i = A_First, A_Last write (A_Unit,101) 'Values1(', i, ') = ', AV%Values1(i) end do case (2) do i = A_First, A_Last write (A_Unit,101) 'Values2(:,', i, ') = ', AV%Values2(:,i) end do case (3) do i = A_First, A_Last write (A_Unit,101) 'Values3(:,:,', i, ') = ', AV%Values3(:,:,i) end do case (4) do i = A_First, A_Last write (A_Unit,101) 'Values4(:,:,:,', i, ') = ', AV%Values4(:,:,:,i) end do !case (-1) ! do i = A_First, A_Last ! write (A_Unit,*) 'ValuesRR(:,', i, ') = ', AV%ValuesRR(:,i) ! end do end select end if ! Format statements. With these formats, this should work up to ! (10^6 - 1) PEs. 100 format (/,a,/) 101 format (2x,a,i11,a,1p,e11.3e3,:,3(',',e11.3e3,:),',',/,& (27x,e11.3e3,:,3(',',e11.3e3,:),',')) ! Verify guarantees - none. return end subroutine Output_Assembled_Vector