sc_get_field_update Subroutine

private subroutine sc_get_field_update(self, fq, fqa, fqp)

Get the field update DD>TAGGED

Type Bound

supercell_type

Arguments

Type IntentOptional Attributes Name
class(supercell_type), intent(inout) :: self
complex, intent(in), dimension(:,:) :: fq
complex, intent(in), dimension(:,:) :: fqa
complex, intent(in), dimension(:,:) :: fqp

Contents

Source Code


Source Code

  subroutine sc_get_field_update(self,fq,fqa,fqp)
    implicit none
    class(supercell_type), intent(inout) :: self
    complex, dimension(:,:), intent(in) :: fq,fqa,fqp
    integer :: ic, it_ind, ulim

    !Exit if we don't have any of the data locally
    if(.not.self%is_local) return

    if(.not.self%is_empty)then
       ! Now loop over cells and trigger field update. We add OpenMP here
       ! to help distribute the work. Note that cells%get_field_update ends
       ! up calling matmul, so in the situation where matmul is replaced
       ! with a call to equivalent BLAS routines _and_ an OpenMP enabled
       ! BLAS is linked this _could_ lead to an attempt to use nested
       ! parallelism, which might be slow.
       !$OMP PARALLEL DO DEFAULT(none) &
       !$OMP PRIVATE(ic, it_ind, ulim) &
       !$OMP SHARED(self, fq, fqa, fqp) &
       !$OMP SCHEDULE(static)
       do ic=1,self%ncell
          !Get cell properties
          it_ind=self%cells(ic)%it_ind
          ulim=self%cells(ic)%ncol
          !Do update
          call self%cells(ic)%get_field_update(fq(:ulim,it_ind),fqa(:ulim,it_ind),fqp(:ulim,it_ind))
       end do
       !$OMP END PARALLEL DO
    end if

    !<DD>TAGGED
    !/If we're going to reduce why not reduce once on the top level object --> If we do
    !local reduction and store in the top level ky_field_update then we can reduce the fields
    !in order to do everything. This may require a new class of subcommunicators

    !Now we need to reduce across cells
    !AJ If non-blocking collective communications are active then they are called here
    call self%reduce_tmpsum

  end subroutine sc_get_field_update