tem_l2str_arr Function

private function tem_l2str_arr(val, sep, logger) result(str)

Converts an array of longs to a string according to the format provided in the logger.

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(in) :: val(:)
character(len=*), intent(in) :: sep
type(tem_logging_type), intent(in), optional :: logger

Return Value character(len=SolSpecLen)


Called by

proc~~tem_l2str_arr~~CalledByGraph proc~tem_l2str_arr tem_l2str_arr interface~tem_tostr tem_toStr interface~tem_tostr->proc~tem_l2str_arr proc~tem_stencilheader_dump tem_stencilHeader_dump proc~tem_stencilheader_dump->interface~tem_tostr proc~load_spatial_parabol load_spatial_parabol proc~load_spatial_parabol->interface~tem_tostr proc~tem_load_spatial tem_load_spatial proc~tem_load_spatial->interface~tem_tostr proc~load_spatial_predefined load_spatial_predefined proc~tem_load_spatial->proc~load_spatial_predefined proc~load_spatial_predefined->interface~tem_tostr proc~load_spatial_predefined->proc~load_spatial_parabol proc~tem_shape_load_level tem_shape_load_level proc~tem_shape_load_level->interface~tem_tostr proc~tem_load_onecanonicalnd tem_load_oneCanonicalND proc~tem_load_onecanonicalnd->interface~tem_tostr proc~tem_comm_dumptype tem_comm_dumpType proc~tem_comm_dumptype->interface~tem_tostr proc~identify_lists identify_lists proc~identify_lists->interface~tem_tostr proc~tem_shape_initbylevels tem_shape_initByLevels proc~tem_shape_initbylevels->interface~tem_tostr interface~tem_stencil_dump tem_stencil_dump interface~tem_stencil_dump->proc~tem_stencilheader_dump proc~tem_load_shape_single tem_load_shape_single proc~tem_load_shape_single->proc~tem_shape_load_level interface~tem_load_canonicalnd tem_load_canonicalND proc~tem_load_shape_single->interface~tem_load_canonicalnd proc~tem_load_canonicalnd_vec tem_load_canonicalND_vec proc~tem_load_canonicalnd_vec->proc~tem_load_onecanonicalnd proc~load_spacetime_predefined load_spacetime_predefined proc~load_spacetime_predefined->proc~tem_load_spatial interface~tem_load_canonicalnd->proc~tem_load_onecanonicalnd interface~tem_load_canonicalnd->proc~tem_load_canonicalnd_vec proc~tem_find_allelements tem_find_allElements proc~tem_find_allelements->proc~identify_lists proc~communicate_elements communicate_elements proc~tem_find_allelements->proc~communicate_elements proc~communicate_elements->proc~identify_lists proc~redefine_halos redefine_halos proc~communicate_elements->proc~redefine_halos proc~tem_load_ic tem_load_ic proc~tem_load_ic->proc~tem_load_spatial proc~redefine_halos->proc~tem_comm_dumptype proc~tem_shape2subtree tem_shape2subTree proc~tem_shape2subtree->proc~tem_shape_initbylevels proc~tem_load_shapes tem_load_shapes proc~tem_load_shapes->proc~tem_load_shape_single interface~tem_load_shape tem_load_shape interface~tem_load_shape->proc~tem_load_shape_single proc~tem_create_leveldesc tem_create_levelDesc proc~tem_create_leveldesc->proc~tem_find_allelements proc~tem_create_subtree_of tem_create_subTree_of proc~tem_create_subtree_of->proc~tem_shape2subtree proc~tem_element_dump tem_element_dump proc~tem_element_dump->interface~tem_stencil_dump proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_dimbydim_construction->interface~tem_stencil_dump proc~tem_load_spacetime_single tem_load_spacetime_single proc~tem_load_spacetime_single->proc~load_spacetime_predefined

Contents

Source Code


Source Code

  function tem_l2str_arr(val, sep, logger) result(str)
    ! ---------------------------------------------------------------------------
    !>
    integer(kind=long_k), intent(in) :: val(:)
    !>
    character(len=*), intent(in)     :: sep
    !>
    type(tem_logging_type), optional, intent(in) :: logger
    !>
    character(len=SolSpecLen) :: str
    ! ---------------------------------------------------------------------------
    character(len=SolSpecLen)     :: temp_str
    character(len=form_len)       :: form
    integer                       :: iter, idx, offset, off_sep
    ! ---------------------------------------------------------------------------
    if (present(logger)) then
      form = logger%int_form
    else
      form = primary%int_form
    end if

    off_sep = len(sep)
    offset = 0

    str = ''
    idx = 1
    do iter=1, size(val)
      ! Convert the ith element of array into character
      write(temp_str, '(' // trim(form) // ')') val(iter)
      ! Append the above obtained character to string followed by separator
      offset = len_trim(temp_str)
      str(idx:idx+offset-1) = trim(temp_str(1:offset) )
      if( iter .ne. size(val) ) then
        str(idx+offset:idx+offset+off_sep) = sep(1:off_sep)
      end if
      idx = idx + offset + off_sep + 1
    end do
    ! Clip the final string to removed unwanted stuff
    str = str(1:size(val)*(offset+off_sep+1)-off_sep-1)

  end function tem_l2str_arr