mg_set_refinement_boundaries Subroutine

public subroutine mg_set_refinement_boundaries(boxes, level)

Create a list of refinement boundaries (from the coarse side)

Arguments

Type IntentOptional Attributes Name
type(mg_box_t), intent(in) :: boxes(:)
type(mg_lvl_t), intent(inout) :: level

Calls

proc~~mg_set_refinement_boundaries~2~~CallsGraph proc~mg_set_refinement_boundaries~2 mg_set_refinement_boundaries proc~mg_has_children~2 mg_has_children proc~mg_set_refinement_boundaries~2->proc~mg_has_children~2

Source Code

  subroutine mg_set_refinement_boundaries(boxes, level)
    type(mg_box_t), intent(in)    :: boxes(:)
    type(mg_lvl_t), intent(inout) :: level
    integer, allocatable       :: tmp(:)
    integer                    :: i, id, nb, nb_id, ix

    if (allocated(level%ref_bnds)) deallocate(level%ref_bnds)

    if (size(level%parents) == 0) then
       ! There are no refinement boundaries
       allocate(level%ref_bnds(0))
    else
       allocate(tmp(size(level%leaves)))
       ix = 0
       do i = 1, size(level%leaves)
          id = level%leaves(i)

          do nb = 1, mg_num_neighbors
             nb_id = boxes(id)%neighbors(nb)
             if (nb_id > mg_no_box) then
                if (mg_has_children(boxes(nb_id))) then
                   ix = ix + 1
                   tmp(ix) = id
                   exit
                end if
             end if
          end do
       end do

       allocate(level%ref_bnds(ix))
       level%ref_bnds(:) = tmp(1:ix)
    end if
  end subroutine mg_set_refinement_boundaries