Function that generates a head key or heading to add to the top of output files for an observer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(:) | :: | rad | The radii for this observer. |
The return value is the key.
function generate_key ( rad ) result(key)
!! Function that generates a head key or heading to add to the top of
!! output files for an observer.
real(wp), dimension(:), intent(in) :: rad
!! The radii for this observer.
character(:), allocatable :: key
!! The return value is the key.
character(9+size(rad)*30+1) :: tmp
character(30) :: next
integer(ip) :: i
tmp = trim('#1: time')
! print*,'tmp = ', tmp
do i = 1, size(rad)
write(next,'(i1,a1,i1,a4,es23.15e3)') 2*i, ',', 2*i+1, ': r=', rad(i)
! print*,'next = ', next
tmp = trim(tmp)//' '//trim(next)
! print*,'tmp = ', tmp
end do
key = tmp
end function generate_key