39 use json_module,
only: json_file
43 use,
intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_associated
57 logical,
private :: finalized = .false.
59 character(len=80) :: name
61 logical :: invert = .false.
64 logical :: full_elements = .false.
109 real(kind=
rp),
intent(in) :: x
110 real(kind=
rp),
intent(in) :: y
111 real(kind=
rp),
intent(in) :: z
112 integer,
intent(in) :: j
113 integer,
intent(in) :: k
114 integer,
intent(in) :: l
115 integer,
intent(in) :: e
129 type(json_file),
intent(inout) :: json
130 integer,
intent(in) :: size
148 module subroutine point_zone_factory(object, json, dof)
149 class(point_zone_t),
allocatable,
intent(inout) :: object
150 type(json_file),
intent(inout) :: json
151 type(
dofmap_t),
intent(inout),
optional :: dof
152 end subroutine point_zone_factory
159 module subroutine point_zone_allocator(object, type_name)
160 class(point_zone_t),
allocatable,
intent(inout) :: object
161 character(len=:),
allocatable,
intent(in) :: type_name
162 end subroutine point_zone_allocator
173 subroutine point_zone_allocate(obj)
175 class(point_zone_t),
allocatable,
intent(inout) :: obj
176 end subroutine point_zone_allocate
181 module subroutine register_point_zone(type_name, allocator)
182 character(len=*),
intent(in) :: type_name
183 procedure(point_zone_allocate),
pointer,
intent(in) :: allocator
184 end subroutine register_point_zone
190 character(len=20) :: type_name
191 procedure(point_zone_allocate),
pointer,
nopass :: allocator
192 end type allocator_entry
198 integer :: point_zone_registry_size = 0
200 public :: point_zone_factory, point_zone_allocator, register_point_zone, &
212 subroutine point_zone_init_base(this, size, name, invert, full_elements)
213 class(point_zone_t),
intent(inout) :: this
214 integer,
intent(in),
optional :: size
215 character(len=*),
intent(in) :: name
216 logical,
intent(in) :: invert
217 logical,
intent(in) :: full_elements
219 call point_zone_free_base(this)
221 if (
present(size))
then
222 call this%scratch%init(size)
224 call this%scratch%init()
227 this%name = trim(name)
229 this%full_elements = full_elements
231 end subroutine point_zone_init_base
234 subroutine point_zone_free_base(this)
235 class(point_zone_t),
intent(inout) :: this
237 this%finalized = .false.
240 call this%scratch%free()
241 call this%mask%free()
243 end subroutine point_zone_free_base
246 subroutine point_zone_finalize(this)
247 class(point_zone_t),
intent(inout) :: this
248 integer,
pointer :: tp(:)
250 if (.not. this%finalized)
then
252 if (this%scratch%size() .ne. 0)
then
254 tp => this%scratch%array()
255 this%size = this%scratch%size()
256 call this%mask%init(tp, this%size)
258 call this%scratch%clear()
262 tp => this%scratch%array()
263 call this%mask%init(tp, this%size)
265 call this%scratch%clear()
269 this%finalized = .true.
273 end subroutine point_zone_finalize
279 subroutine point_zone_add(this, idx)
280 class(point_zone_t),
intent(inout) :: this
281 integer,
intent(inout) :: idx
283 if (this%finalized)
then
284 call neko_error(
'Point zone already finalized')
287 call this%scratch%push(idx)
289 end subroutine point_zone_add
294 subroutine point_zone_map(this, dof)
295 class(point_zone_t),
intent(inout) :: this
298 integer :: i, ix, iy, iz, ie, nlindex(4), lx, idx
299 real(kind=
rp) :: x, y, z
304 do while (i <= dof%size())
306 x = dof%x(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
307 y = dof%y(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
308 z = dof%z(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
314 if (this%invert .neqv. this%criterion(x, y, z, ix, iy, iz, ie))
then
316 if (.not. this%full_elements)
then
337 end subroutine point_zone_map
__inline__ __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.
subroutine, public device_free(x_d)
Deallocate memory on the device.
Defines a mapping of the degrees of freedom.
Object for handling masks in Neko.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
subroutine point_zone_init_base(this, size, name, invert, full_elements)
Constructor for the point_zone_t base type.
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_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.
pure integer function, public linear_index(i, j, k, l, lx, ly, lz)
Compute the address of a (i,j,k,l) array with sizes (1:lx, 1:ly, 1:lz, :)
Type for consistently handling masks in Neko. This type encapsulates the mask array and its associate...
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.