append an entry at the end of the integer list If the first entry is zero, write into that one
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_longList), | pointer | :: | firstEntry |
linked list of resulting elements building the neighbor |
||
integer(kind=long_k), | intent(in) | :: | entryPos |
Add that element |
subroutine tem_appendLongList(firstEntry, entryPos) ! --------------------------------------------------------------------------- !> linked list of resulting elements building the neighbor type(tem_longList),pointer :: firstEntry !> Add that element integer(kind=long_k),intent(in) :: entryPos ! --------------------------------------------------------------------------- type(tem_longList),pointer :: currPos ! current position in linked list ! --------------------------------------------------------------------------- currPos => firstEntry if(currPos%elem .le. 0) then ! If the element entry of the current entry is zero ! write into that position currPos%elem = entryPos else ! If element entry /= 0 then find the end of the list do while(associated(currPos%next)) currPos => currPos%next enddo ! at the end of the list, append new list item allocate(currPos%next) currPos => currPos%next ! And write to the item currPos%elem = entryPos endif end subroutine tem_appendLongList