getMaxLenCnt Subroutine

public subroutine getMaxLenCnt(maxLen, count, iList, rList, cList)

getMaxLenCnt – get length of a list and max number of data in the nodes

Get length of a list and max number of data in the nodes so that maxLen/count can been used to allocate array.

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: maxLen
integer, intent(out) :: count
type(iNode), optional, pointer :: iList
type(rNode), optional, pointer :: rList
type(cNode), optional, pointer :: cList

Called by

proc~~getmaxlencnt~~CalledByGraph proc~getmaxlencnt getMaxLenCnt proc~esmf_cfioeosfilecreate ESMF_CFIOEosFileCreate proc~esmf_cfioeosfilecreate->proc~getmaxlencnt proc~getlist getList proc~esmf_cfioeosfilecreate->proc~getlist proc~esmf_cfiosdffilecreate ESMF_CFIOSdfFileCreate proc~esmf_cfiosdffilecreate->proc~getmaxlencnt proc~esmf_cfiosdffilecreate->proc~getlist proc~getlist->proc~getmaxlencnt proc~esmf_cfiofilecreate ESMF_CFIOFileCreate proc~esmf_cfiofilecreate->proc~esmf_cfiosdffilecreate proc~mapl_cfiocreatewrite MAPL_CFIOCreatewrite proc~mapl_cfiocreatewrite->proc~esmf_cfiofilecreate program~test~10 test program~test~10->proc~esmf_cfiofilecreate program~test~11 test program~test~11->proc~esmf_cfiofilecreate program~test~12 test program~test~12->proc~esmf_cfiofilecreate program~test~13 test program~test~13->proc~esmf_cfiofilecreate program~test~14 test program~test~14->proc~esmf_cfiofilecreate program~test~3 test program~test~3->proc~esmf_cfiofilecreate program~test~5 test program~test~5->proc~esmf_cfiofilecreate program~test~7 test program~test~7->proc~esmf_cfiofilecreate program~test~8 test program~test~8->proc~esmf_cfiofilecreate program~test~9 test program~test~9->proc~esmf_cfiofilecreate

Source Code

        subroutine getMaxLenCnt(maxLen, count, iList, rList, cList)
!
! !INPUT PARAMETERS:
!
           type(iNode), pointer, OPTIONAL :: iList
           type(cNode), pointer, OPTIONAL :: cList
           type(rNode), pointer, OPTIONAL :: rList
!
! !OUTPUT PARAMETERS:
!
           integer, intent(out) :: maxLen
           integer, intent(out) :: count
!
!------------------------------------------------------------------------------
           type(iNode), pointer :: p     ! int pointer for int list
           type(rNode), pointer :: rp    ! real pointer for real list
           type(cNode), pointer :: cp    ! char pointer for char list

           count = 0
           maxLen = 0

!          get maxLen/count from  a integer list
           if ( present(iList) ) then
              allocate(p)
              p = iList
              do while ( associated(p) )
                  if (p%count .gt. maxLen) maxLen = p%count
                  count = count + 1
                  p => p%next
              end do
           end if

!          get maxLen/count from  a real list
           if ( present(rList) ) then
              allocate(rp)
              rp = rList
              do while ( associated(rp) )
                  if (rp%count .gt. maxLen) maxLen = rp%count
                  count = count + 1
                  rp => rp%next
              end do
           end if

!          get maxLen/count from  a character list
           if ( present(cList) ) then
              allocate(cp)
              cp = cList
              do while ( associated(cp) )
                  if (cp%count .gt. maxLen) maxLen = cp%count
                  count = count + 1
                  cp => cp%next
              end do
           end if

        end subroutine getMaxLenCnt