46 use,
intrinsic :: iso_c_binding
54 character(len=64) :: filter_type
60 real(kind=
rp),
allocatable :: fh(:,:), fht(:,:)
61 type(c_ptr) :: fh_d = c_null_ptr
62 type(c_ptr) :: fht_d = c_null_ptr
64 real(kind=
rp),
allocatable :: trnsfr(:)
82 character(len=*) :: filter_type
87 this%filter_type = filter_type
89 allocate(this%fh(nx, nx))
90 allocate(this%fht(nx, nx))
91 allocate(this%trnsfr(nx))
93 call rzero(this%fh, nx*nx)
94 call rzero(this%fht, nx*nx)
95 call rone(this%trnsfr, nx)
98 call device_map(this%fh, this%fh_d, this%nx * this%nx)
99 call device_map(this%fht, this%fht_d, this%nx * this%nx)
101 call device_cfill(this%fht_d, 0.0_rp, this%nx * this%nx)
110 if (
allocated(this%fh))
then
114 if (
allocated(this%fht))
then
118 if (
allocated(this%trnsfr))
then
119 deallocate(this%trnsfr)
122 if (c_associated(this%fh_d))
then
126 if (c_associated(this%fht_d))
then
130 this%filter_type =
""
141 this%nx, this%filter_type)
154 integer,
intent(inout) :: nelv
155 real(kind=
rp),
intent(inout),
dimension(this%nx, this%nx, this%nx, nelv) :: v
156 real(kind=
rp),
intent(in),
dimension(this%nx, this%nx, this%nx, nelv) :: u
159 call tnsr3d(v, this%nx, u, this%nx, this%fh, this%fht, this%fht, nelv)
Map a Fortran array to a device (allocate and associate)
Copy data between host and device (or device and device)
subroutine, public device_cfill(a_d, c, n)
Set all elements to a constant c .
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
subroutine, public device_free(x_d)
Deallocate memory on the device.
Implements the CPU kernel for the elementwise_filter_t type.
subroutine, public build_1d_cpu(fh, fht, trnsfr, nx, filter_type)
Build the 1d filter for an element on the CPU. Suppose field x is filtered into x_hat by x_hat = fh*x...
Implements explicit_filter_t.
subroutine elementwise_field_filter_3d(this, v, u, nelv)
Filter a 3D field.
subroutine elementwise_filter_free(this)
Destructor.
subroutine build_1d(this)
Build the 1d filter for an element.
subroutine elementwise_filter_init(this, nx, filter_type)
Constructor.
subroutine, public rone(a, n)
Set all elements to one.
subroutine, public rzero(a, n)
Zero a real vector.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
subroutine, public tnsr3d(v, nv, u, nu, a, bt, ct, nelv)
Tensor product performed on nelv elements.
Implements the explicit filter for SEM.