generate_key Function

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.

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in), dimension(:):: rad

The radii for this observer.

Return Value character(len=:), allocatable

The return value is the key.


Called by

proc~~generate_key~~CalledByGraph proc~generate_key generate_key proc~cobs_output cobs_output proc~cobs_output->proc~generate_key interface~cobs_output cobs_output interface~cobs_output->proc~cobs_output

Contents

Source Code


Source Code

  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