tem_printArray Subroutine

public subroutine tem_printArray(me, itemLength, title, lineLength, nUnit)

print an array to the debugunit

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(in) :: me(:)

long array to write to debug file

integer, optional :: itemLength

how many characters needs each item of the array to output

character(len=*), optional :: title

Array title in debug output for easy identification in the file

integer, optional :: lineLength

how long should the line be

integer :: nUnit

to which unit to output


Called by

proc~~tem_printarray~~CalledByGraph proc~tem_printarray tem_printArray proc~tem_dumptreeidlists tem_dumpTreeIDlists proc~tem_dumptreeidlists->proc~tem_printarray proc~tem_stencilelement_dump tem_stencilElement_dump proc~tem_stencilelement_dump->proc~tem_printarray interface~tem_stencil_dump tem_stencil_dump interface~tem_stencil_dump->proc~tem_stencilelement_dump proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_dimbydim_construction->interface~tem_stencil_dump proc~tem_element_dump tem_element_dump proc~tem_element_dump->interface~tem_stencil_dump proc~tem_build_face_info tem_build_face_info proc~tem_build_face_info->proc~tem_dimbydim_construction proc~tem_elemlist_dump tem_elemList_dump proc~tem_elemlist_dump->proc~tem_element_dump

Source Code

  subroutine tem_printArray( me, itemLength, title, lineLength, nUnit )
    ! ---------------------------------------------------------------------------
    !> Array title in debug output for easy identification in the file
    character( len=* ),optional :: title
    !> long array to write to debug file
    integer(kind=long_k), intent(in) :: me(:)
    !> how many characters needs each item of the array to output
    integer,optional :: itemLength
    !> how long should the line be
    integer,optional :: lineLength
    !> to which unit to output
    integer :: nUnit
    ! ---------------------------------------------------------------------------
    integer :: iElem
    integer :: elemLength, meLength
    integer :: itemLength_loc, lineLength_loc
    character( len=128 ) :: buffer
    character( len=128 ) :: spacer
    ! ---------------------------------------------------------------------------

    if( present(linelength)) then
      linelength_loc = min( abs(linelength), 128 )
    else
      linelength_loc = 120
    endif
     if( present(itemlength)) then
      itemlength_loc = max( itemlength, 8 )
    else
      itemlength_loc =  8
    endif

    meLength = size( me(:) )
    if ( meLength > 0 ) then

      ! build spacer
      spacer = ''
      do iElem = 1, lineLength_loc -2
        write(spacer,'(2a)') trim(spacer),'-'
      enddo

      if( present(title)) then
        write(nUnit,*) trim(spacer)
        write(nUnit,'(2a,i0)') trim(title), ', size: ', size(me)
        ! write(nUnit,*) trim(spacer)
      endif
      buffer = ''
      elemLength = itemLength_loc + 3

      do iElem = 1, meLength
        write(buffer,'(2a,i8)') trim(buffer),' ',me( iElem )
        if( iElem == meLength .or. mod( iElem, elemLength ) == 0) then
          write(nUnit,*) trim(buffer)
          buffer = ''
        endif
      enddo
      write(nUnit,*) trim(spacer)
    end if ! meLength > 0

  end subroutine tem_printArray