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~~CallsGraph proc~mg_restrict_lvl mg_restrict_lvl proc~restrict_onto restrict_onto proc~mg_restrict_lvl->proc~restrict_onto proc~restrict_set_buffer restrict_set_buffer proc~mg_restrict_lvl->proc~restrict_set_buffer proc~sort_and_transfer_buffers sort_and_transfer_buffers proc~mg_restrict_lvl->proc~sort_and_transfer_buffers proc~mg_get_child_offset mg_get_child_offset proc~restrict_onto->proc~mg_get_child_offset proc~mg_ix_to_ichild mg_ix_to_ichild proc~restrict_set_buffer->proc~mg_ix_to_ichild mpi_waitall mpi_waitall proc~sort_and_transfer_buffers->mpi_waitall proc~mpi_irecv_wrapper mpi_irecv_wrapper proc~sort_and_transfer_buffers->proc~mpi_irecv_wrapper proc~mpi_isend_wrapper mpi_isend_wrapper proc~sort_and_transfer_buffers->proc~mpi_isend_wrapper proc~sort_sendbuf sort_sendbuf proc~sort_and_transfer_buffers->proc~sort_sendbuf mpi_irecv mpi_irecv proc~mpi_irecv_wrapper->mpi_irecv mpi_isend mpi_isend proc~mpi_isend_wrapper->mpi_isend interface~mrgrnk mrgrnk proc~sort_sendbuf->interface~mrgrnk proc~i_mrgrnk I_mrgrnk interface~mrgrnk->proc~i_mrgrnk

Called by

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

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