Work out which cells are local
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pc_type), | intent(inout) | :: | self |
subroutine pc_find_locality(self)
use gs2_layouts, only: g_lo, ik_idx, it_idx
use mp, only: sum_allreduce
implicit none
class(pc_type),intent(inout) :: self
integer :: it,ik,iglo
!Initialise
self%is_local=0
!Fill in values, this may be fairly slow
do iglo=1,g_lo%ikitrange
ik=g_lo%local_ikit_points(iglo)%ik
it=g_lo%local_ikit_points(iglo)%it
self%is_local(it,ik)=1
end do
! do iglo=g_lo%llim_proc,g_lo%ulim_proc
! ik=ik_idx(g_lo,iglo)
! it=it_idx(g_lo,iglo)
! self%is_local(it,ik)=1
! enddo
!Now count how many procs have each cell
self%nproc_per_cell=self%is_local
call sum_allreduce(self%nproc_per_cell)
end subroutine pc_find_locality