Converts an array of doubles to a string according to the format provided in the logger.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=double_k), | intent(in) | :: | val(:) | |||
character(len=*), | intent(in) | :: | sep | |||
type(tem_logging_type), | intent(in), | optional | :: | logger |
function tem_d2str_arr(val, sep, logger) result(str) ! --------------------------------------------------------------------------- !> real(kind=double_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%real_form else form = primary%real_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_d2str_arr