Restrict from lvl to lvl-1
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mg_t), | intent(inout) | :: | mg | |||
| integer, | intent(in) | :: | iv | |||
| integer, | intent(in) | :: | lvl |
subroutine mg_restrict_lvl(mg, iv, lvl) type(mg_t), intent(inout) :: mg integer, intent(in) :: iv integer, intent(in) :: lvl integer :: i, id, dsize, nc if (lvl <= mg%lowest_lvl) error stop "cannot restrict lvl <= lowest_lvl" nc = mg%box_size_lvl(lvl) if (lvl >= mg%first_normal_lvl) then dsize = (nc/2)**2 mg%buf(:)%i_send = 0 mg%buf(:)%i_ix = 0 do i = 1, size(mg%lvls(lvl)%my_ids) id = mg%lvls(lvl)%my_ids(i) call restrict_set_buffer(mg, id, iv) end do mg%buf(:)%i_recv = mg%comm_restrict%n_recv(:, lvl) * dsize call sort_and_transfer_buffers(mg, dsize) mg%buf(:)%i_recv = 0 end if do i = 1, size(mg%lvls(lvl-1)%my_parents) id = mg%lvls(lvl-1)%my_parents(i) call restrict_onto(mg, id, nc, iv) end do end subroutine mg_restrict_lvl