mg_restrict_lvl Subroutine

public subroutine mg_restrict_lvl(mg, iv, lvl)

Restrict from lvl to lvl-1

Arguments

Type IntentOptional Attributes Name
type(mg_t), intent(inout) :: mg
integer, intent(in) :: iv
integer, intent(in) :: lvl

Calls

proc~~mg_restrict_lvl~3~~CallsGraph proc~mg_restrict_lvl~3 mg_restrict_lvl proc~restrict_onto~3 restrict_onto proc~mg_restrict_lvl~3->proc~restrict_onto~3 proc~restrict_set_buffer~3 restrict_set_buffer proc~mg_restrict_lvl~3->proc~restrict_set_buffer~3 proc~sort_and_transfer_buffers~3 sort_and_transfer_buffers proc~mg_restrict_lvl~3->proc~sort_and_transfer_buffers~3 proc~mg_get_child_offset~3 mg_get_child_offset proc~restrict_onto~3->proc~mg_get_child_offset~3 proc~mg_ix_to_ichild~3 mg_ix_to_ichild proc~restrict_set_buffer~3->proc~mg_ix_to_ichild~3 mpi_waitall mpi_waitall proc~sort_and_transfer_buffers~3->mpi_waitall proc~mpi_irecv_wrapper mpi_irecv_wrapper proc~sort_and_transfer_buffers~3->proc~mpi_irecv_wrapper proc~mpi_isend_wrapper mpi_isend_wrapper proc~sort_and_transfer_buffers~3->proc~mpi_isend_wrapper proc~sort_sendbuf~3 sort_sendbuf proc~sort_and_transfer_buffers~3->proc~sort_sendbuf~3 mpi_irecv mpi_irecv proc~mpi_irecv_wrapper->mpi_irecv mpi_isend mpi_isend proc~mpi_isend_wrapper->mpi_isend interface~mrgrnk~3 mrgrnk proc~sort_sendbuf~3->interface~mrgrnk~3 proc~i_mrgrnk~3 I_mrgrnk interface~mrgrnk~3->proc~i_mrgrnk~3

Called by

proc~~mg_restrict_lvl~3~~CalledByGraph proc~mg_restrict_lvl~3 mg_restrict_lvl proc~mg_restrict~3 mg_restrict proc~mg_restrict~3->proc~mg_restrict_lvl~3 proc~update_coarse~3 update_coarse proc~update_coarse~3->proc~mg_restrict_lvl~3 proc~mg_copy_to_tree mg_copy_to_tree proc~mg_copy_to_tree->proc~mg_restrict~3 proc~mg_fas_fmg~3 mg_fas_fmg proc~mg_fas_fmg~3->proc~update_coarse~3 proc~mg_fas_vcycle~3 mg_fas_vcycle proc~mg_fas_fmg~3->proc~mg_fas_vcycle~3 proc~mg_fas_vcycle~3->proc~update_coarse~3 proc~diffusion_solve_acoeff~3 diffusion_solve_acoeff proc~diffusion_solve_acoeff~3->proc~mg_fas_fmg~3 proc~diffusion_solve_acoeff~3->proc~mg_fas_vcycle~3 proc~diffusion_solve_vcoeff~3 diffusion_solve_vcoeff proc~diffusion_solve_vcoeff~3->proc~mg_fas_fmg~3 proc~diffusion_solve_vcoeff~3->proc~mg_fas_vcycle~3 proc~diffusion_solve~3 diffusion_solve proc~diffusion_solve~3->proc~mg_fas_fmg~3 proc~diffusion_solve~3->proc~mg_fas_vcycle~3

Source Code

  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)**3

       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