mg_get_child_offset Function

public pure function mg_get_child_offset(mg, id) result(ix_offset)

Get the offset of a box with respect to its parent (e.g. in 2d, there can be a child at offset 0,0, one at n_cell/2,0, one at 0,n_cell/2 and one at n_cell/2, n_cell/2) n_cell / 2

Arguments

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

Return Value integer, (1)


Called by

proc~~mg_get_child_offset~2~~CalledByGraph proc~mg_get_child_offset~2 mg_get_child_offset proc~buffer_for_fine_nb~2 buffer_for_fine_nb proc~buffer_for_fine_nb~2->proc~mg_get_child_offset~2 proc~fill_refinement_bnd~2 fill_refinement_bnd proc~fill_refinement_bnd~2->proc~mg_get_child_offset~2 proc~prolong_onto~2 prolong_onto proc~prolong_onto~2->proc~mg_get_child_offset~2 proc~prolong_set_buffer~2 prolong_set_buffer proc~prolong_set_buffer~2->proc~mg_get_child_offset~2 proc~restrict_onto~2 restrict_onto proc~restrict_onto~2->proc~mg_get_child_offset~2 proc~buffer_refinement_boundaries~2 buffer_refinement_boundaries proc~buffer_refinement_boundaries~2->proc~buffer_for_fine_nb~2 proc~mg_prolong~2 mg_prolong proc~mg_prolong~2->proc~prolong_onto~2 proc~mg_prolong~2->proc~prolong_set_buffer~2 proc~mg_restrict_lvl~2 mg_restrict_lvl proc~mg_restrict_lvl~2->proc~restrict_onto~2 proc~set_ghost_cells~2 set_ghost_cells proc~set_ghost_cells~2->proc~fill_refinement_bnd~2 proc~correct_children~2 correct_children proc~correct_children~2->proc~mg_prolong~2 proc~mg_fill_ghost_cells_lvl~2 mg_fill_ghost_cells_lvl proc~mg_fill_ghost_cells_lvl~2->proc~buffer_refinement_boundaries~2 proc~mg_fill_ghost_cells_lvl~2->proc~set_ghost_cells~2 proc~mg_ghost_cell_buffer_size~2 mg_ghost_cell_buffer_size proc~mg_ghost_cell_buffer_size~2->proc~buffer_refinement_boundaries~2 proc~mg_ghost_cell_buffer_size~2->proc~set_ghost_cells~2 proc~mg_restrict~2 mg_restrict proc~mg_restrict~2->proc~mg_restrict_lvl~2 proc~update_coarse~2 update_coarse proc~update_coarse~2->proc~mg_restrict_lvl~2 proc~update_coarse~2->proc~mg_fill_ghost_cells_lvl~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~correct_children~2 proc~mg_fas_fmg~2->proc~mg_fill_ghost_cells_lvl~2 proc~mg_fas_fmg~2->proc~update_coarse~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~mg_fas_vcycle~2->proc~mg_fill_ghost_cells_lvl~2 proc~mg_fas_vcycle~2->proc~update_coarse~2 proc~smooth_boxes~2 smooth_boxes proc~mg_fas_vcycle~2->proc~smooth_boxes~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~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

  pure function mg_get_child_offset(mg, id) result(ix_offset)
    type(mg_t), intent(in) :: mg
    integer, intent(in)    :: id
    integer                :: ix_offset(1)

    if (mg%boxes(id)%lvl <= mg%first_normal_lvl) then
       ix_offset(:) = 0
    else
       ix_offset = iand(mg%boxes(id)%ix-1, 1) * ishft(mg%box_size, -1)
       !* n_cell / 2
    end if
  end function mg_get_child_offset