this subroutine prints the double precision vector named vector. elements 1 thru ncols will be printed. name is a character variable that describes vector. note that if name is given in the call to print_vector, it must be enclosed in quotes. if there are more than 10 elements in vector, 10 elements will be printed on each line.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | iunit | |||
real(kind=wp), | intent(in), | dimension(ncols) | :: | vector | ||
integer, | intent(in) | :: | ncols | |||
character(len=*), | intent(in) | :: | name |
subroutine print_vector(iunit, vector, ncols, name) implicit none integer, intent(in) :: iunit integer, intent(in) :: ncols real(wp), dimension(ncols), intent(in) :: vector character(len=*), intent(in) :: name integer :: i, lines, ll write(iunit,'(/,25X,A)') trim(name) if (ncols > 10) then lines = int(ncols/10.0_wp) do i = 1, lines ll = 10*(i - 1) write(iunit,'(10(G12.5,1X))') vector(1+ll:10+ll) end do write(iunit,'(10(G12.5,1X))') vector(11+ll:ncols) else write(iunit,'(10(G12.5,1X))') vector(1:ncols) end if end subroutine print_vector