@@ -204,9 +204,9 @@ contains
204204 !! computing the fields for
205205 subroutine compute_face_selectors(mesh)
206206
207- use reference_element_mod , only: S, W
208- use sci_set_any_int_dof_kernel_mod , only: set_any_int_dof_kernel_type
209- use sci_face_selector_kernel_mod, only: face_selector_kernel_type
207+ use sci_psykal_light_mod , only: invoke_deep_int_setval_c
208+ use sci_face_selector_kernel_mod , only: face_selector_kernel_type
209+ use sci_face_selector_halo_kernel_mod, only: face_selector_halo_kernel_type
210210
211211 implicit none
212212
@@ -220,35 +220,74 @@ contains
220220 type(integer_field_type) :: face_counter
221221 type(function_space_type), pointer :: w2h_2d_fs
222222 type(function_space_type), pointer :: w3_2d_fs
223- integer(tik) :: id
223+ integer(kind=i_def) :: depth, max_halo_depth
224+ integer(kind=tik) :: id
224225
225226 if ( LPROF ) call start_timing( id, 'runtime_constants.geometric' )
226227
227228 twod_mesh => mesh_collection%get_mesh(mesh, TWOD)
228229 local_mesh => mesh%get_local_mesh()
229230 w2h_2d_fs => function_space_collection%get_fs(twod_mesh, 0, 0, W2H)
230231 w3_2d_fs => function_space_collection%get_fs(twod_mesh, 0, 0, W3)
232+ max_halo_depth = twod_mesh%get_halo_depth()
231233
232234 ! Temporary W2H field, tracking the count for each face
233- call face_counter%initialise( w2h_2d_fs )
235+ call face_counter%initialise(w2h_2d_fs, halo_depth=max_halo_depth )
234236
235237 call face_selector_ew_inventory%add_field( &
236- face_selector_ew, w3_2d_fs, local_mesh &
238+ face_selector_ew, w3_2d_fs, local_mesh, halo_depth=max_halo_depth &
237239 )
238240 call face_selector_ns_inventory%add_field( &
239- face_selector_ns, w3_2d_fs, local_mesh &
241+ face_selector_ns, w3_2d_fs, local_mesh, halo_depth=max_halo_depth &
242+ )
243+
244+ ! ------------------------------------------------------------------------ !
245+ ! Initialise face selectors to zero
246+ ! ------------------------------------------------------------------------ !
247+
248+ call invoke_deep_int_setval_c(face_selector_ew, 0, max_halo_depth)
249+ call invoke_deep_int_setval_c(face_selector_ns, 0, max_halo_depth)
250+
251+ ! ------------------------------------------------------------------------ !
252+ ! Setting face selectors in owned cells
253+ ! ------------------------------------------------------------------------ !
254+
255+ ! Set face counter to be one for halo DoFs, but zero for owned (and annexed,
256+ ! if using) DoFs. The use of annexed DoFs will be picked up by using normal
257+ ! int_setval_c invoke, but need to use psykal-lite implementation to ensure
258+ ! halo DoFs are set to the correct value
259+ call invoke_deep_int_setval_c(face_counter, 1, max_halo_depth)
260+ call invoke( int_setval_c(face_counter, 0) )
261+
262+ ! Compute face selector in owned cell region
263+ call invoke( &
264+ face_selector_kernel_type( &
265+ face_selector_ew, face_selector_ns, &
266+ face_counter &
267+ ) &
240268 )
241269
242- call invoke( int_setval_c(face_counter, 0), &
243- ! Do West and South faces for every cell
244- int_setval_c(face_selector_ew, 1), &
245- int_setval_c(face_selector_ns, 1), &
246- set_any_int_dof_kernel_type(face_counter, W, 1), &
247- set_any_int_dof_kernel_type(face_counter, S, 1), &
248- ! Determine where North and East faces are needed
249- face_selector_kernel_type(face_selector_ew, &
250- face_selector_ns, &
251- face_counter ) )
270+ ! ------------------------------------------------------------------------ !
271+ ! Setting face selectors in halos
272+ ! ------------------------------------------------------------------------ !
273+
274+ ! Set face counter to be zero for halo DoFs, but one for owned (and annexed,
275+ ! if using) DoFs. The use of annexed DoFs will be picked up by using normal
276+ ! int_setval_c invoke, but need to use psykal-lite implementation to ensure
277+ ! halo DoFs are set to the correct value
278+ call invoke_deep_int_setval_c(face_counter, 0, max_halo_depth)
279+ call invoke( int_setval_c(face_counter, 1) )
280+
281+ ! Loop through different halo depths, setting the face selectors in the
282+ ! halos at each depth as we go
283+ do depth = 1, max_halo_depth
284+ call invoke( &
285+ face_selector_halo_kernel_type( &
286+ face_selector_ew, face_selector_ns, &
287+ face_counter, depth &
288+ ) &
289+ )
290+ end do
252291
253292 if ( LPROF ) call stop_timing( id, 'runtime_constants.geometric' )
254293
0 commit comments