39  use json_module, 
only: json_file
 
   42  use, 
intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr
 
   49     integer, 
allocatable :: mask(:)
 
   51     type(c_ptr) :: mask_d = c_null_ptr
 
   58     logical, 
private :: finalized = .false.
 
   60     character(len=80) :: name
 
   62     logical :: invert = .false.
 
 
  107       real(kind=
rp), 
intent(in) :: x
 
  108       real(kind=
rp), 
intent(in) :: y
 
  109       real(kind=
rp), 
intent(in) :: z
 
  110       integer, 
intent(in) :: j
 
  111       integer, 
intent(in) :: k
 
  112       integer, 
intent(in) :: l
 
  113       integer, 
intent(in) :: e
 
 
  127       type(json_file), 
intent(inout) :: json
 
  128       integer, 
intent(in) :: size
 
 
  146     module subroutine point_zone_factory(object, json, dof)
 
  147       class(point_zone_t), 
allocatable, 
intent(inout) :: object
 
  148       type(json_file), 
intent(inout) :: json
 
  149       type(
dofmap_t), 
intent(inout), 
optional :: dof
 
  150     end subroutine point_zone_factory
 
  153  public :: point_zone_factory
 
  162  subroutine point_zone_init_base(this, size, name, invert)
 
  163    class(point_zone_t), 
intent(inout) :: this
 
  164    integer, 
intent(in), 
optional :: size
 
  165    character(len=*), 
intent(in) :: name
 
  166    logical, 
intent(in) :: invert
 
  168    call point_zone_free_base(this)
 
  170    if (
present(size)) 
then 
  171       call this%scratch%init(size)
 
  173       call this%scratch%init()
 
  176    this%name = trim(name)
 
 
  179  end subroutine point_zone_init_base
 
  182  subroutine point_zone_free_base(this)
 
  183    class(point_zone_t), 
intent(inout) :: this
 
  184    if (
allocated(this%mask)) 
then 
  185       deallocate(this%mask)
 
  188    this%finalized = .false.
 
  191    call this%scratch%free()
 
  193    if (c_associated(this%mask_d)) 
then 
 
  197  end subroutine point_zone_free_base
 
  200  subroutine point_zone_finalize(this)
 
  201    class(point_zone_t), 
intent(inout) :: this
 
  202    integer, 
pointer :: tp(:)
 
  205    if (.not. this%finalized) 
then 
  207       if (this%scratch%size() .ne. 0) 
then 
  209          allocate(this%mask(this%scratch%size()))
 
  211          tp => this%scratch%array()
 
  212          do i = 1, this%scratch%size()
 
  216          this%size = this%scratch%size()
 
  218          call this%scratch%clear()
 
  221             call device_map(this%mask, this%mask_d, this%size)
 
  229          call this%scratch%clear()
 
  233       this%finalized = .true.
 
 
  237  end subroutine point_zone_finalize
 
  243  subroutine point_zone_add(this, idx)
 
  244    class(point_zone_t), 
intent(inout) :: this
 
  245    integer, 
intent(inout) :: idx
 
  247    if (this%finalized) 
then 
  248       call neko_error(
'Point zone already finalized')
 
  251    call this%scratch%push(idx)
 
 
  253  end subroutine point_zone_add
 
  258  subroutine point_zone_map(this, dof)
 
  259    class(point_zone_t), 
intent(inout) :: this
 
  262    integer :: i, ix, iy, iz, ie, nlindex(4), lx, idx
 
  263    real(kind=
rp) :: x, y, z
 
  269       x = dof%x(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
 
  270       y = dof%y(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
 
  271       z = dof%z(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
 
  277       if (this%invert .neqv. this%criterion(x, y, z, ix, iy, iz, ie)) 
then 
 
  283  end subroutine point_zone_map
 
__device__ void nonlinear_index(const int idx, const int lx, int *index)
 
Map a Fortran array to a device (allocate and associate)
 
Copy data between host and device (or device and device)
 
Defines the criterion of selection of a GLL point to the point_zone.
 
The common constructor using a JSON object.
 
Device abstraction, common interface for various accelerators.
 
integer, parameter, public host_to_device
 
subroutine, public device_free(x_d)
Deallocate memory on the device.
 
Defines a mapping of the degrees of freedom.
 
integer, parameter neko_bcknd_device
 
integer, parameter, public rp
Global precision used in computations.
 
subroutine point_zone_free_base(this)
Destructor for the point_zone_t base type.
 
subroutine point_zone_add(this, idx)
Adds a point's linear index to the scratch stack.
 
subroutine point_zone_finalize(this)
Builds the mask from the scratch stack.
 
subroutine point_zone_init_base(this, size, name, invert)
Point zone factory. Constructs, initializes, and maps the point zone object.
 
subroutine point_zone_map(this, dof)
Maps the GLL points that verify a point_zone's criterion by adding them to the stack.
 
Implements a dynamic stack ADT.
 
A helper type to build a list of pointers to point_zones.
 
Base abstract type for point zones.
 
A helper type to build a list of polymorphic point_zones.