addList
– put user defined attribute into a list.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
integer, | intent(in) | :: | count | |||
character(len=*), | intent(in), | optional | :: | vName | ||
integer, | intent(in), | optional | :: | attInt(*) | ||
character(len=MLEN), | intent(in), | optional | :: | attChar | ||
real, | intent(in), | optional | :: | attReal(*) | ||
type(iNode), | optional, | pointer | :: | iList |
int list |
|
type(rNode), | optional, | pointer | :: | rList |
real list |
|
type(cNode), | optional, | pointer | :: | cList |
char list |
subroutine addList(name, count, vName, attInt, attChar, attReal, & iList, rList, cList) ! ! !INPUT PARAMETERS: ! character(len=*), intent(in) :: name integer, intent(in) :: count character(len=*), intent(in), OPTIONAL :: vName integer, intent(in), OPTIONAL :: attInt(*) real, intent(in), OPTIONAL :: attReal(*) character(len=MLEN), intent(in), OPTIONAL :: attChar ! ! !OUTPUT PARAMETERS: ! type(iNode), pointer, OPTIONAL :: iList !! int list type(rNode), pointer, OPTIONAL :: rList !! real list type(cNode), pointer, OPTIONAL :: cList !! char list ! !------------------------------------------------------------------------------ type(iNode), pointer :: p, q type(rNode), pointer :: rp, rq type(cNode), pointer :: cp, cq integer :: i ! put int attribute into an integer list if ( present(attInt) .and. present(iList)) then if ( .not. associated(iList) ) then allocate(iList) iList%count = count iList%name = name if (present(vName)) iList%vName = vName allocate(iList%intData(count)) do i =1, count iList%intData(i) = attInt(i) end do iList%next => null() else q => iList p => iList%next do while ( associated(p) ) q => p p => p%next end do allocate(p) p%count = count p%name = name if (present(vName)) p%vName = vName allocate(p%intData(count)) do i =1, p%count p%intData(i) = attInt(i) end do q%next => p end if end if ! put real attribute into a real list if ( present(attReal) .and. present(rList)) then if ( .not. associated(rList) ) then allocate(rList) rList%count = count rList%name = name if (present(vName)) rList%vName = vName allocate(rList%realData(count)) do i =1, count rList%realData(i) = attReal(i) end do rList%next => null() else rq => rList rp => rList%next do while ( associated(rp) ) rq => rp rp => rp%next end do allocate(rp) rp%count = count rp%name = name if (present(vName)) rp%vName = vName allocate(rp%RealData(count)) do i =1, rp%count rp%realData(i) = attReal(i) end do rq%next => rp end if end if ! put char attribute into a char list if ( present(attChar) .and. present(cList)) then if ( .not. associated(cList) ) then allocate(cList) cList%count = count cList%name = name if (present(vName)) cList%vName = vName cList%charData = attChar(1:count) cList%next => null() else cq => cList cp => cList%next do while ( associated(cp) ) cq => cp cp => cp%next end do allocate(cp) cp%count = count cp%name = name if (present(vName)) cp%vName = vName cp%charData = attChar(1:count) cq%next => cp end if end if end subroutine addList