Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

65 changes: 64 additions & 1 deletion components/science/source/psy/sci_psykal_builtin_light_mod.f90
Original file line number Diff line number Diff line change
Expand Up @@ -737,4 +737,67 @@ subroutine invoke_copy_field_64_64(fsrce_64, fdest_64)
!
end subroutine invoke_copy_field_64_64

end module sci_psykal_builtin_light_mod
!---------------------------------------------------------------------
! This is a PSyKAl-lite implementation of a built-in that will be
! implemented under PSyclone issue #3398. See that issue for further
! details.
subroutine invoke_copy_field_halo(field_out, field_in)

use omp_lib, only: omp_get_thread_num
use omp_lib, only: omp_get_max_threads
use mesh_mod, only: mesh_type

implicit none

type(field_type), intent(in) :: field_in
type(field_type), intent(inout) :: field_out

integer(kind=i_def) :: df
integer(kind=i_def) :: loop0_start, loop0_stop
integer(kind=i_def) :: clean_halo_depth
type(field_proxy_type) :: field_in_proxy
type(field_proxy_type) :: field_out_proxy
integer(kind=i_def) :: max_halo_depth_mesh
type(mesh_type), pointer :: mesh => null()
!
! Initialise field and/or operator proxies
!
field_in_proxy = field_in%get_proxy()
field_out_proxy = field_out%get_proxy()
!
! Create a mesh object
!
mesh => field_out_proxy%vspace%get_mesh()
max_halo_depth_mesh = mesh%get_halo_depth()
!
! Set-up all of the loop bounds
!
clean_halo_depth = field_in_proxy%get_clean_depth()
loop0_start = 1
if (clean_halo_depth > 0) then
! only copy the clean halos
loop0_stop = field_out_proxy%vspace%get_last_dof_halo(clean_halo_depth)
else
! if there are no clean halos copy only owned DoFs
loop0_stop = field_out_proxy%vspace%get_last_dof_owned()
end if
!
! Call kernels and communication routines
!
!$omp parallel default(shared), private(df)
!$omp do schedule(static)
do df=loop0_start,loop0_stop
field_out_proxy%data(df) = field_in_proxy%data(df)
end do
!$omp end do
!$omp end parallel
!
! Set halos dirty for fields modified in the above loop
!
call field_out_proxy%set_dirty()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there not be a
call field_out_proxy%set_clean(clean_halo_depth)
included after this - otherwise the copying to a clean depth in the halo is entirely pointless, as it will just get halo exchanged anyway

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think you're right.

if (clean_halo_depth > 0) then
call field_out_proxy%set_clean(clean_halo_depth)
end if
end subroutine invoke_copy_field_halo

end module sci_psykal_builtin_light_mod

This file was deleted.

Loading