mg_copy_from_tree_gc Subroutine

public subroutine mg_copy_from_tree_gc(iw_from, iw_to, state_to)

Uses

  • proc~~mg_copy_from_tree_gc~~UsesGraph proc~mg_copy_from_tree_gc mg_copy_from_tree_gc module~mod_forest mod_forest proc~mg_copy_from_tree_gc->module~mod_forest module~mod_global_parameters mod_global_parameters proc~mg_copy_from_tree_gc->module~mod_global_parameters module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants module~mod_physicaldata mod_physicaldata module~mod_global_parameters->module~mod_physicaldata module~mod_variables mod_variables module~mod_global_parameters->module~mod_variables mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

Copy from multigrid tree with one layer of ghost cells. Corner ghost cells are not used/set.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iw_from

Variable to use as right-hand side

integer, intent(in) :: iw_to

Copy to this variable

type(state), intent(inout), optional, target :: state_to(max_blocks)

If present, use this as the output state


Source Code

  subroutine mg_copy_from_tree_gc(iw_from, iw_to, state_to)
    use mod_global_parameters
    use mod_forest
    integer, intent(in)      :: iw_from
    !< Variable to use as right-hand side
    integer, intent(in)      :: iw_to
    !< Copy to this variable
    !> If present, use this as the output state
    type(state), intent(inout), optional, target :: state_to(max_blocks)
    integer                  :: iigrid, igrid, id
    integer                  :: nc, lvl, ilo1,ilo2,ilo3, ihi1,ihi2,ihi3
    type(tree_node), pointer :: pnode

    if (.not. mg%is_allocated) error stop "mg_copy_from_tree_gc: tree not allocated yet"

    ilo1=ixMlo1-1;ilo2=ixMlo2-1;ilo3=ixMlo3-1;
    ihi1=ixMhi1+1;ihi2=ixMhi2+1;ihi3=ixMhi3+1;

    do iigrid = 1, igridstail
       igrid =  igrids(iigrid);
       pnode => igrid_to_node(igrid, mype)%node
       id    =  pnode%id
       lvl   =  mg%boxes(id)%lvl
       nc    =  mg%box_size_lvl(lvl)

       if (present(state_to)) then
          state_to(igrid)%w(ilo1:ihi1,ilo2:ihi2,ilo3:ihi3,&
              iw_to) = mg%boxes(id)%cc(0:nc+1,0:nc+1,0:nc+1, iw_from)
       else
          ps(igrid)%w(ilo1:ihi1,ilo2:ihi2,ilo3:ihi3,&
              iw_to) = mg%boxes(id)%cc(0:nc+1,0:nc+1,0:nc+1, iw_from)
       end if
    end do
  end subroutine mg_copy_from_tree_gc