buffer_for_nb Subroutine

private subroutine buffer_for_nb(mg, box, nc, iv, nb_id, nb_rank, nb, dry_run)

Arguments

Type IntentOptional Attributes Name
type(mg_t), intent(inout) :: mg
type(mg_box_t), intent(inout) :: box
integer, intent(in) :: nc
integer, intent(in) :: iv
integer, intent(in) :: nb_id
integer, intent(in) :: nb_rank
integer, intent(in) :: nb
logical, intent(in) :: dry_run

Calls

proc~~buffer_for_nb~2~~CallsGraph proc~buffer_for_nb~2 buffer_for_nb proc~box_gc_for_neighbor~2 box_gc_for_neighbor proc~buffer_for_nb~2->proc~box_gc_for_neighbor~2

Called by

proc~~buffer_for_nb~2~~CalledByGraph proc~buffer_for_nb~2 buffer_for_nb proc~buffer_ghost_cells~2 buffer_ghost_cells proc~buffer_ghost_cells~2->proc~buffer_for_nb~2 proc~mg_fill_ghost_cells_lvl~2 mg_fill_ghost_cells_lvl proc~mg_fill_ghost_cells_lvl~2->proc~buffer_ghost_cells~2 proc~mg_ghost_cell_buffer_size~2 mg_ghost_cell_buffer_size proc~mg_ghost_cell_buffer_size~2->proc~buffer_ghost_cells~2 proc~mg_allocate_storage~2 mg_allocate_storage proc~mg_allocate_storage~2->proc~mg_ghost_cell_buffer_size~2 proc~mg_fas_fmg~2 mg_fas_fmg proc~mg_fas_fmg~2->proc~mg_fill_ghost_cells_lvl~2 proc~mg_fas_vcycle~2 mg_fas_vcycle proc~mg_fas_fmg~2->proc~mg_fas_vcycle~2 proc~update_coarse~2 update_coarse proc~mg_fas_fmg~2->proc~update_coarse~2 proc~mg_fas_vcycle~2->proc~mg_fill_ghost_cells_lvl~2 proc~smooth_boxes~2 smooth_boxes proc~mg_fas_vcycle~2->proc~smooth_boxes~2 proc~mg_fas_vcycle~2->proc~update_coarse~2 proc~mg_fill_ghost_cells~2 mg_fill_ghost_cells proc~mg_fill_ghost_cells~2->proc~mg_fill_ghost_cells_lvl~2 proc~smooth_boxes~2->proc~mg_fill_ghost_cells_lvl~2 proc~update_coarse~2->proc~mg_fill_ghost_cells_lvl~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 buffer_for_nb(mg, box, nc, iv, nb_id, nb_rank, nb, dry_run)
    type(mg_t), intent(inout)  :: mg
    type(mg_box_t), intent(inout) :: box
    integer, intent(in)        :: nc
    integer, intent(in)        :: iv
    integer, intent(in)        :: nb_id
    integer, intent(in)        :: nb_rank
    integer, intent(in)        :: nb
    logical, intent(in)        :: dry_run
    integer                    :: i, dsize
    real(dp)                   :: gc(1)

    i     = mg%buf(nb_rank)%i_send
    dsize = nc**(1-1)

    if (.not. dry_run) then
       call box_gc_for_neighbor(box, nb, nc, iv, gc)
       mg%buf(nb_rank)%send(i+1:i+dsize) = pack(gc, .true.)
    end if

    ! Later the buffer is sorted, using the fact that loops go from low to high
    ! box id, and we fill ghost cells according to the neighbor order
    i = mg%buf(nb_rank)%i_ix
    if (.not. dry_run) then
       mg%buf(nb_rank)%ix(i+1) = mg_num_neighbors * nb_id + mg_neighb_rev(nb)
    end if

    mg%buf(nb_rank)%i_send = mg%buf(nb_rank)%i_send + dsize
    mg%buf(nb_rank)%i_ix   = mg%buf(nb_rank)%i_ix + 1
  end subroutine buffer_for_nb