40 use json_module,
only: json_file
44 use,
intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr, c_associated
58 logical,
private :: finalized = .false.
60 character(len=80) :: name
62 logical :: invert = .false.
65 logical :: full_elements = .false.
110 real(kind=
rp),
intent(in) :: x
111 real(kind=
rp),
intent(in) :: y
112 real(kind=
rp),
intent(in) :: z
113 integer,
intent(in) :: j
114 integer,
intent(in) :: k
115 integer,
intent(in) :: l
116 integer,
intent(in) :: e
130 type(json_file),
intent(inout) :: json
131 integer,
intent(in) :: size
149 module subroutine point_zone_factory(object, json, dof)
150 class(point_zone_t),
allocatable,
intent(inout) :: object
151 type(json_file),
intent(inout) :: json
152 type(
dofmap_t),
intent(inout),
optional :: dof
153 end subroutine point_zone_factory
160 module subroutine point_zone_allocator(object, type_name)
161 class(point_zone_t),
allocatable,
intent(inout) :: object
162 character(len=:),
allocatable,
intent(in) :: type_name
163 end subroutine point_zone_allocator
174 subroutine point_zone_allocate(obj)
176 class(point_zone_t),
allocatable,
intent(inout) :: obj
177 end subroutine point_zone_allocate
182 module subroutine register_point_zone(type_name, allocator)
183 character(len=*),
intent(in) :: type_name
184 procedure(point_zone_allocate),
pointer,
intent(in) :: allocator
185 end subroutine register_point_zone
191 character(len=NEKO_TYPENAME_LEN) :: type_name
192 procedure(point_zone_allocate),
pointer,
nopass :: allocator
193 end type allocator_entry
199 integer :: point_zone_registry_size = 0
201 public :: point_zone_factory, point_zone_allocator, register_point_zone, &
213 subroutine point_zone_init_base(this, size, name, invert, full_elements)
214 class(point_zone_t),
intent(inout) :: this
215 integer,
intent(in),
optional :: size
216 character(len=*),
intent(in) :: name
217 logical,
intent(in) :: invert
218 logical,
intent(in) :: full_elements
220 call point_zone_free_base(this)
222 if (
present(size))
then
223 call this%scratch%init(size)
225 call this%scratch%init()
228 this%name = trim(name)
230 this%full_elements = full_elements
232 end subroutine point_zone_init_base
235 subroutine point_zone_free_base(this)
236 class(point_zone_t),
intent(inout) :: this
238 this%finalized = .false.
241 call this%scratch%free()
242 call this%mask%free()
244 end subroutine point_zone_free_base
247 subroutine point_zone_finalize(this)
248 class(point_zone_t),
intent(inout) :: this
249 integer,
pointer :: tp(:)
251 if (.not. this%finalized)
then
253 if (this%scratch%size() .ne. 0)
then
255 tp => this%scratch%array()
256 this%size = this%scratch%size()
257 call this%mask%init(tp, this%size)
259 call this%scratch%clear()
263 tp => this%scratch%array()
264 call this%mask%init(tp, this%size)
266 call this%scratch%clear()
270 this%finalized = .true.
274 end subroutine point_zone_finalize
280 subroutine point_zone_add(this, idx)
281 class(point_zone_t),
intent(inout) :: this
282 integer,
intent(inout) :: idx
284 if (this%finalized)
then
285 call neko_error(
'Point zone already finalized')
288 call this%scratch%push(idx)
290 end subroutine point_zone_add
295 subroutine point_zone_map(this, dof)
296 class(point_zone_t),
intent(inout) :: this
299 integer :: i, ix, iy, iz, ie, nlindex(4), lx, idx
300 real(kind=
rp) :: x, y, z
305 do while (i <= dof%size())
307 x = dof%x%x(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
308 y = dof%y%x(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
309 z = dof%z%x(nlindex(1), nlindex(2), nlindex(3), nlindex(4))
315 if (this%invert .neqv. this%criterion(x, y, z, ix, iy, iz, ie))
then
317 if (.not. this%full_elements)
then
338 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, :)
integer, parameter, public neko_typename_len
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.