Copy a variable from the multigrid tree
| Type | Intent | Optional | 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 |
subroutine mg_copy_from_tree(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 type(tree_node), pointer :: pnode if (.not. mg%is_allocated) error stop "mg_copy_from_tree: tree not allocated yet" 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(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,& iw_to) = mg%boxes(id)%cc(1:nc,1:nc,1:nc, iw_from) else ps(igrid)%w(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo3:ixMhi3,& iw_to) = mg%boxes(id)%cc(1:nc,1:nc,1:nc, iw_from) end if end do end subroutine mg_copy_from_tree