64  subroutine mask_exterior_const_vec(vec, zone, const)
 
   65    type(vector_t), 
intent(inout) :: vec
 
   66    class(point_zone_t), 
intent(inout) :: zone
 
   67    real(kind=rp), 
intent(in) :: const
 
   68    type(field_t), 
pointer :: work
 
   69    integer :: temp_indices(1), i
 
   84    call neko_scratch_registry%request_field(work, temp_indices(1))
 
   86    if (vec%size() .ne. work%size()) 
then 
   87       call neko_error(
'vector and field are of incompatible dimension')
 
   91    call field_cfill(work, const)
 
   94    if (neko_bcknd_device .eq. 1) 
then 
   95       call device_copy_mask(work%x_d, vec%x_d, work%size(), zone%mask%get_d(), &
 
   99          work%x(zone%mask%get(i), 1, 1, 1) = vec%x(zone%mask%get(i))
 
  104    if (neko_bcknd_device .eq. 1) 
then 
  105       call device_copy(vec%x_d, work%x_d, work%size())
 
  107       call copy(vec%x, work%x, work%size())
 
  110    call neko_scratch_registry%relinquish_field(temp_indices)
 
 
  118  subroutine mask_exterior_const_fld(fld, zone, const)
 
  119    type(field_t), 
intent(inout) :: fld
 
  120    class(point_zone_t), 
intent(inout) :: zone
 
  121    real(kind=rp), 
intent(in) :: const
 
  122    type(field_t), 
pointer :: work
 
  123    integer :: temp_indices(1)
 
  125    call neko_scratch_registry%request_field(work , temp_indices(1))
 
  128    call field_cfill(work, const)
 
  131    if (neko_bcknd_device .eq. 1) 
then 
  132       call device_copy_mask(work%x_d, fld%x_d, fld%size(), zone%mask%get_d(), &
 
  135       call copy_mask(work%x, fld%x, fld%size(), zone%mask%get(), zone%size)
 
  139    call field_copy(fld, work)
 
  141    call neko_scratch_registry%relinquish_field(temp_indices)
 
 
  149  subroutine mask_exterior_fld(fld, zone, background)
 
  150    type(field_t), 
intent(inout) :: fld
 
  151    class(point_zone_t), 
intent(inout) :: zone
 
  152    type(field_t), 
intent(inout) :: background
 
  153    type(field_t), 
pointer :: work
 
  154    integer :: temp_indices(1)
 
  156    call neko_scratch_registry%request_field(work , temp_indices(1))
 
  159    call field_copy(work, background)
 
  162    if (neko_bcknd_device .eq. 1) 
then 
  163       call device_copy_mask(work%x_d, fld%x_d, fld%size(), zone%mask%get_d(), &
 
  166       call copy_mask(work%x, fld%x, fld%size(), zone%mask%get(), zone%size)
 
  170    call field_copy(fld, work)
 
  172    call neko_scratch_registry%relinquish_field(temp_indices)
 
 
  179  function compute_masked_volume(mask, coef)
 
  180    class(point_zone_t), 
intent(inout) :: mask 
 
  181    class(coef_t), 
intent(in) :: coef
 
  182    real(kind=rp) :: compute_masked_volume
 
  183    type(field_t), 
pointer :: work
 
  184    integer :: temp_indices(1)
 
  191    call neko_scratch_registry%request_field(work , temp_indices(1))
 
  193    call field_rone(work)
 
  194    call mask_exterior_const_fld(work, mask, 0.0_rp)
 
  195    if (neko_bcknd_device .eq. 1) 
then 
  196       tmp = device_glsc2(work%x_d, coef%B_d, n)
 
  198       tmp = glsc2(work%x, coef%B, n)
 
  200    call neko_scratch_registry%relinquish_field(temp_indices)
 
  201    compute_masked_volume = tmp