sc_push_arr_to_rows Subroutine

private subroutine sc_push_arr_to_rows(self, arr)

Uses

A routine to distribute an array to appropriate row blocks

Type Bound

supercell_type

Arguments

Type IntentOptional Attributes Name
class(supercell_type), intent(inout) :: self
complex, intent(in), dimension(self%nrow,self%ncol) :: arr

Contents

Source Code


Source Code

  subroutine sc_push_arr_to_rows(self,arr)
    use mp, only: broadcast_sub, mp_abort
    implicit none
    class(supercell_type), intent(inout) :: self
    complex, dimension(self%nrow,self%ncol), intent(in) :: arr
    integer :: ic, ir
    integer :: rl,ru,cl,cu
    !If empty don't have anywhere to store data so exit
    if(self%is_empty) return

    !Store all local sections
    !$OMP PARALLEL DO DEFAULT(none) &
    !$OMP PRIVATE(ic, ir, rl, ru, cl, cu) &
    !$OMP SHARED(self, arr) &
    !$OMP SCHEDULE(static)
    do ic = 1, self%ncell
       if (self%cells(ic)%is_empty) cycle

       do ir = 1, self%cells(ic)%nrb
          !Get row/col limits
          rl = self%cells(ic)%rb(ir)%row_llim
          ru = self%cells(ic)%rb(ir)%row_ulim
          cl = self%cells(ic)%rb(ir)%col_llim
          cu = self%cells(ic)%rb(ir)%col_ulim
          
          !Store data
          self%cells(ic)%rb(ir)%data = arr(cl:cu, rl:ru)
       end do
    end do
    !$OMP END PARALLEL DO
  end subroutine sc_push_arr_to_rows