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
99 real(kind=
rp),
intent(in) :: x
100 real(kind=
rp),
intent(in) :: y
101 real(kind=
rp),
intent(in) :: z
102 integer,
intent(in) :: j
103 integer,
intent(in) :: k
104 integer,
intent(in) :: l
105 integer,
intent(in) :: e
119 type(json_file),
intent(inout) :: json
120 integer,
intent(in) :: size
139 integer,
intent(in),
optional :: size
140 character(len=*),
intent(in) :: name
144 if (
present(size))
then
145 call this%scratch%init(size)
147 call this%scratch%init()
150 this%name = trim(name)
157 if (
allocated(this%mask))
then
158 deallocate(this%mask)
161 this%finalized = .false.
164 call this%scratch%free()
166 if (c_associated(this%mask_d))
then
175 integer,
pointer :: tp(:)
178 if (.not. this%finalized)
then
180 allocate(this%mask(this%scratch%size()))
182 tp => this%scratch%array()
183 do i = 1, this%scratch%size()
187 this%size = this%scratch%size()
189 call this%scratch%clear()
192 call device_map(this%mask, this%mask_d, this%size)
197 this%finalized = .true.
209 integer,
intent(inout) :: idx
211 if (this%finalized)
then
212 call neko_error(
'Point zone already finalized')
215 call this%scratch%push(idx)
226 integer :: i, ix, iy, iz, ie, nlindex(4), lx, idx
227 real(kind=
rp) :: x, y, z
233 x = dof%x(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
234 y = dof%y(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
235 z = dof%z(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
241 if (this%criterion(x, y, z, ix, iy, iz, ie))
then
__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_init_base(this, size, name)
Constructor 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_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.
Base abstract type for point zones.
A helper type to build a list of polymorphic point_zones.