prolong_onto Subroutine

private subroutine prolong_onto(mg, id, nc, iv, iv_to, add, method)

Prolong onto a child box

Arguments

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

Prolong from this variable

integer, intent(in) :: iv_to

Prolong to this variable

logical, intent(in) :: add

If true, add to current values

procedure(mg_box_prolong) :: method

Calls

proc~~prolong_onto~~CallsGraph proc~prolong_onto prolong_onto proc~mg_get_child_offset mg_get_child_offset proc~prolong_onto->proc~mg_get_child_offset

Called by

proc~~prolong_onto~~CalledByGraph proc~prolong_onto prolong_onto proc~mg_prolong mg_prolong proc~mg_prolong->proc~prolong_onto proc~correct_children correct_children proc~correct_children->proc~mg_prolong proc~mg_fas_fmg mg_fas_fmg proc~mg_fas_fmg->proc~correct_children proc~mg_fas_vcycle mg_fas_vcycle proc~mg_fas_fmg->proc~mg_fas_vcycle proc~mg_fas_vcycle->proc~correct_children 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 prolong_onto(mg, id, nc, iv, iv_to, add, method)
    type(mg_t), intent(inout) :: mg
    integer, intent(in)       :: id
    integer, intent(in)       :: nc
    integer, intent(in)       :: iv
    !< Prolong from this variable
    integer, intent(in)       :: iv_to
    !< Prolong to this variable
    logical, intent(in)       :: add
    !< If true, add to current values
    procedure(mg_box_prolong) :: method
    integer                   :: hnc, p_id, p_rank, i, dix(2), dsize
    real(dp)                  :: tmp(nc, nc)

    hnc    = nc/2
    p_id   = mg%boxes(id)%parent
    p_rank = mg%boxes(p_id)%rank

    if (p_rank == mg%my_rank) then
       dix    = mg_get_child_offset(mg, id)
       call method(mg, p_id, dix, nc, iv, tmp)
    else
       dsize  = nc**2
       i = mg%buf(p_rank)%i_recv
       tmp = reshape(mg%buf(p_rank)%recv(i+1:i+dsize), [nc, nc])
       mg%buf(p_rank)%i_recv = mg%buf(p_rank)%i_recv + dsize
    end if

    if (add) then
       mg%boxes(id)%cc(1:nc, 1:nc, iv_to) = mg%boxes(id)%cc(1:nc, 1:nc,&
           iv_to) + tmp
    else
       mg%boxes(id)%cc(1:nc, 1:nc, iv_to) = tmp
    end if

  end subroutine prolong_onto