tem_horizontalSpacer Subroutine

public subroutine tem_horizontalSpacer(fUnit, before, after, toFile, str)

write out a message with the defined string+real content

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: fUnit

output unit

integer, intent(in), optional :: before

optional white lines before print

integer, intent(in), optional :: after

optional white lines after print

logical, intent(in), optional :: toFile

output goes to debug file

character(len=*), intent(in), optional :: str

String to be printed at the beginning of the spacer


Source Code

  subroutine tem_horizontalSpacer( fUnit, before, after, toFile, str )
    ! ---------------------------------------------------------------------------
    !> output unit
    integer,intent(in)          :: fUnit
    !> optional white lines before print
    integer,intent(in),optional :: before
    !> optional white lines after print
    integer,intent(in),optional :: after
    !> output goes to debug file
    logical,intent(in),optional :: toFile
    !> String to be printed at the beginning of the spacer
    character(*),intent(in),optional :: str
    ! ---------------------------------------------------------------------------
    ! loop variable
    integer :: i
    ! local temporary variable for the output unit
    integer :: nUnit
    ! ---------------------------------------------------------------------------

    nUnit = fUnit

    if( present( toFile)) then
      if( toFile ) nUnit = 66
    endif

    if( present(before) ) then
      do i=1,before
        write(nUnit,*)
      enddo
    endif

    if( present(str) ) then
      write(nUnit, '(5a)') repeat('=', (80-len_trim(str))/2 -1), &
        &                  ' ',                                  &
        &                  trim(str),                            &
        &                  repeat(' ', 1+mod(len_trim(str), 2)), &
        &                  repeat('=',(80-len_trim(str))/2 -1)
    else
      write(nUnit, '(a)') repeat('-', 80)
    end if

    if( present(after ) ) then
      do i=1,after
        write(nUnit,*)
      enddo
    endif
  end subroutine tem_horizontalSpacer