Skip to content

Commit

Permalink
allocate globa listneigh for ptmass in linklist_kdtree
Browse files Browse the repository at this point in the history
  • Loading branch information
conradtchan committed Jul 19, 2021
1 parent f5cf7b4 commit a79497c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/main/linklist_kdtree.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module linklist
type(kdnode), public, allocatable :: node(:)
integer, allocatable :: nodemap(:)
integer, public , allocatable :: listneigh(:)
integer, public , allocatable :: listneigh_global(:)
!$omp threadprivate(listneigh)
integer(kind=8), public :: ncells
real, public :: dxcell
Expand Down Expand Up @@ -66,6 +67,7 @@ subroutine allocate_linklist
!$omp parallel
call allocate_array('listneigh',listneigh,maxp)
!$omp end parallel
call allocate_array('listneigh_global',listneigh_global,maxp)

end subroutine allocate_linklist

Expand All @@ -80,6 +82,7 @@ subroutine deallocate_linklist
!$omp parallel
if (allocated(listneigh)) deallocate(listneigh)
!$omp end parallel
if (allocated(listneigh_global)) deallocate(listneigh_global)
call deallocate_kdtree()

end subroutine deallocate_linklist
Expand Down
3 changes: 1 addition & 2 deletions src/main/ptmass.F90
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ subroutine ptmass_create(nptmass,npart,itest,xyzh,vxyzu,fxyzu,fext,divcurlv,pote
#ifdef IND_TIMESTEPS
use part, only:ibin,ibin_wake
#endif
use linklist, only:getneigh_pos,ifirstincell
use linklist, only:getneigh_pos,ifirstincell,listneigh=>listneigh_global
use eos, only:equationofstate,gamma,gamma_pwp,utherm
use options, only:ieos
use units, only:unit_density
Expand All @@ -844,7 +844,6 @@ subroutine ptmass_create(nptmass,npart,itest,xyzh,vxyzu,fxyzu,fext,divcurlv,pote
real, intent(in) :: time
integer(kind=1) :: iphasei,ibin_wakei
integer :: nneigh
integer :: listneigh(maxneigh)
integer, parameter :: maxcache = 12000
integer, parameter :: nneigh_thresh = 1024 ! approximate epot if neigh>neigh_thresh; (-ve for off)
#ifdef IND_TIMESTEPS
Expand Down

0 comments on commit a79497c

Please sign in to comment.