Skip to content

Commit

Permalink
fixed issues if changing vertex metadata
Browse files Browse the repository at this point in the history
some cleanups
  • Loading branch information
jacobwilliams committed Dec 31, 2023
1 parent 6b49fa7 commit bcd15ef
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/dag_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,11 @@ subroutine dag_set_vertex_info(me,ivertex,label,attributes,metadata)

if (present(label)) me%vertices(ivertex)%label = label
if (present(attributes)) me%vertices(ivertex)%attributes = attributes
if (present(metadata)) allocate(me%vertices(ivertex)%metadata, source=metadata)

if (present(metadata)) then
if (allocated(me%vertices(ivertex)%metadata)) &
deallocate(me%vertices(ivertex)%metadata)
allocate(me%vertices(ivertex)%metadata, source=metadata)
end if
end subroutine dag_set_vertex_info
!*******************************************************************************

Expand Down Expand Up @@ -961,10 +964,10 @@ recursive subroutine quicksort(ilow,ihigh)
if ( ihigh-ilow<=max_size_for_insertion_sort .and. ihigh>ilow ) then

! do insertion sort:
do i = ilow + 1,ihigh
do j = i,ilow + 1,-1
if ( ivec(j)%ivertex < ivec(j-1)%ivertex ) then
call swap(ivec(j),ivec(j-1))
do i = ilow + 1_ip,ihigh
do j = i,ilow + 1_ip,-1_ip
if ( ivec(j)%ivertex < ivec(j-1_ip)%ivertex ) then
call swap(ivec(j),ivec(j-1_ip))
else
exit
end if
Expand Down Expand Up @@ -993,11 +996,11 @@ subroutine partition(ilow,ihigh,ipivot)

integer(ip) :: i,ii

call swap(ivec(ilow),ivec((ilow+ihigh)/2))
call swap(ivec(ilow),ivec((ilow+ihigh)/2_ip))
ii = ilow
do i = ilow + 1, ihigh
do i = ilow + 1_ip, ihigh
if ( ivec(i)%ivertex < ivec(ilow)%ivertex ) then
ii = ii + 1
ii = ii + 1_ip
call swap(ivec(ii),ivec(i))
end if
end do
Expand Down

0 comments on commit bcd15ef

Please sign in to comment.