mg_prolong Subroutine

public subroutine mg_prolong(mg, lvl, iv, iv_to, method, add)

Prolong variable iv from lvl to variable iv_to at lvl+1

Arguments

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

Level to prolong from

integer, intent(in) :: iv

Source variable

integer, intent(in) :: iv_to

Target variable

procedure(mg_box_prolong) :: method

Prolongation method

logical, intent(in) :: add

If true, add to current values


Calls

proc~~mg_prolong~2~~CallsGraph proc~mg_prolong~2 mg_prolong proc~prolong_onto~2 prolong_onto proc~mg_prolong~2->proc~prolong_onto~2 proc~prolong_set_buffer~2 prolong_set_buffer proc~mg_prolong~2->proc~prolong_set_buffer~2 proc~sort_and_transfer_buffers~2 sort_and_transfer_buffers proc~mg_prolong~2->proc~sort_and_transfer_buffers~2 proc~mg_get_child_offset~2 mg_get_child_offset proc~prolong_onto~2->proc~mg_get_child_offset~2 proc~prolong_set_buffer~2->proc~mg_get_child_offset~2 mpi_waitall mpi_waitall proc~sort_and_transfer_buffers~2->mpi_waitall proc~mpi_irecv_wrapper mpi_irecv_wrapper proc~sort_and_transfer_buffers~2->proc~mpi_irecv_wrapper proc~mpi_isend_wrapper mpi_isend_wrapper proc~sort_and_transfer_buffers~2->proc~mpi_isend_wrapper proc~sort_sendbuf~2 sort_sendbuf proc~sort_and_transfer_buffers~2->proc~sort_sendbuf~2 mpi_irecv mpi_irecv proc~mpi_irecv_wrapper->mpi_irecv mpi_isend mpi_isend proc~mpi_isend_wrapper->mpi_isend interface~mrgrnk~2 mrgrnk proc~sort_sendbuf~2->interface~mrgrnk~2 proc~i_mrgrnk~2 I_mrgrnk interface~mrgrnk~2->proc~i_mrgrnk~2

Called by

proc~~mg_prolong~2~~CalledByGraph proc~mg_prolong~2 mg_prolong proc~correct_children~2 correct_children proc~correct_children~2->proc~mg_prolong~2 proc~mg_fas_fmg~2 mg_fas_fmg proc~mg_fas_fmg~2->proc~correct_children~2 proc~mg_fas_vcycle~2 mg_fas_vcycle proc~mg_fas_fmg~2->proc~mg_fas_vcycle~2 proc~mg_fas_vcycle~2->proc~correct_children~2 proc~diffusion_solve_acoeff~2 diffusion_solve_acoeff proc~diffusion_solve_acoeff~2->proc~mg_fas_fmg~2 proc~diffusion_solve_acoeff~2->proc~mg_fas_vcycle~2 proc~diffusion_solve_vcoeff~2 diffusion_solve_vcoeff proc~diffusion_solve_vcoeff~2->proc~mg_fas_fmg~2 proc~diffusion_solve_vcoeff~2->proc~mg_fas_vcycle~2 proc~diffusion_solve~2 diffusion_solve proc~diffusion_solve~2->proc~mg_fas_fmg~2 proc~diffusion_solve~2->proc~mg_fas_vcycle~2

Source Code

  subroutine mg_prolong(mg, lvl, iv, iv_to, method, add)

    type(mg_t), intent(inout) :: mg
    integer, intent(in)       :: lvl
    !< Level to prolong from
    integer, intent(in)       :: iv
    !< Source variable
    integer, intent(in)       :: iv_to
    !< Target variable
    procedure(mg_box_prolong) :: method
    !< Prolongation method
    logical, intent(in)       :: add
    !< If true, add to current values
    integer                   :: i, id, dsize, nc

    if (lvl == mg%highest_lvl) error stop "cannot prolong highest level"
    if (lvl < mg%lowest_lvl) error stop "cannot prolong below lowest level"

    ! Below the first normal level, all boxes are on the same CPU
    if (lvl >= mg%first_normal_lvl-1) then
       dsize            = mg%box_size**1
       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 prolong_set_buffer(mg, id, mg%box_size, iv, method)
       end do

       mg%buf(:)%i_recv = mg%comm_prolong%n_recv(:, lvl) * dsize
       call sort_and_transfer_buffers(mg, dsize)
       mg%buf(:)%i_recv = 0
    end if

    nc = mg%box_size_lvl(lvl+1)
    do i = 1, size(mg%lvls(lvl+1)%my_ids)
       id = mg%lvls(lvl+1)%my_ids(i)
       call prolong_onto(mg, id, nc, iv, iv_to, add, method)
    end do
  end subroutine mg_prolong