25 #include "sll_errors.h"
26 #include "sll_assert.h"
27 #include "sll_memory.h"
28 #include "sll_working_precision.h"
59 sll_int32 :: num_cells1
60 sll_int32 :: num_cells2
62 sll_real64 :: eta1_min
63 sll_real64 :: eta1_max
64 sll_real64 :: eta2_min
65 sll_real64 :: eta2_max
122 sll_int32,
intent(in) :: npts1
123 sll_int32,
intent(in) :: npts2
124 sll_real64,
intent(in) :: eta1_min
125 sll_real64,
intent(in) :: eta1_max
126 sll_real64,
intent(in) :: eta2_min
127 sll_real64,
intent(in) :: eta2_max
129 interpolator%num_cells1 = npts1 - 1
130 interpolator%num_cells2 = npts2 - 1
131 interpolator%eta1_min = eta1_min
132 interpolator%eta1_max = eta1_max
133 interpolator%eta2_min = eta2_min
134 interpolator%eta2_max = eta2_max
137 interpolator%nufft, &
158 sll_real64,
dimension(:, :),
intent(in) :: data_array
159 sll_real64,
dimension(:),
intent(in),
optional :: eta1_coords
160 sll_real64,
dimension(:),
intent(in),
optional :: eta2_coords
161 sll_int32,
intent(in),
optional :: size_eta1_coords
162 sll_int32,
intent(in),
optional :: size_eta2_coords
163 sll_int32 :: nc1, nc2
165 nc1 = interpolator%num_cells1
166 nc2 = interpolator%num_cells2
169 data_array(1:nc1, 1:nc2))
178 sll_real64,
intent(in) :: eta1
179 sll_real64,
intent(in) :: eta2
192 sll_real64,
intent(in) :: eta1
193 sll_real64,
intent(in) :: eta2
198 sll_error(
'interpolate_deriv1_nufft2d',
'not implemented')
207 sll_real64,
intent(in) :: eta1
208 sll_real64,
intent(in) :: eta2
213 sll_error(
'interpolate_deriv2_nufft2d',
'not implemented')
228 sll_int32,
intent(in) :: num_points1
229 sll_int32,
intent(in) :: num_points2
230 sll_real64,
dimension(:, :),
intent(in) :: eta1
231 sll_real64,
dimension(:, :),
intent(in) :: eta2
232 sll_real64,
dimension(:, :),
intent(in) :: data_in
233 sll_real64,
intent(out):: data_out(num_points1, num_points2)
235 sll_int32 :: nc1, nc2
237 nc1 = this%num_cells1
238 nc2 = this%num_cells2
241 data_in(1:nc1, 1:nc2), &
242 eta1(1:nc1, 1:nc2), &
243 eta2(1:nc1, 1:nc2), &
244 data_out(1:nc1, 1:nc2))
246 data_out(nc1 + 1, :) = data_out(1, :)
247 data_out(:, nc2 + 1) = data_out(:, 1)
263 sll_int32,
intent(in) :: num_points1
264 sll_int32,
intent(in) :: num_points2
265 sll_real64,
dimension(:, :),
intent(in) :: alpha1
266 sll_real64,
dimension(:, :),
intent(in) :: alpha2
267 sll_real64,
dimension(:, :),
intent(in) :: data_in
268 sll_real64,
intent(out) :: data_out(num_points1, num_points2)
270 sll_real64,
dimension(:, :),
allocatable :: eta1
271 sll_real64,
dimension(:, :),
allocatable :: eta2
273 sll_real64 :: eta1_min
274 sll_real64 :: eta1_max
275 sll_real64 :: delta_eta1
276 sll_real64 :: eta2_min
277 sll_real64 :: eta2_max
278 sll_real64 :: delta_eta2
285 nc1 = this%num_cells1
286 nc2 = this%num_cells2
288 eta1_min = this%eta1_min
289 eta1_max = this%eta1_max
290 eta2_min = this%eta2_min
291 eta2_max = this%eta2_max
292 delta_eta1 = (this%eta1_max - this%eta1_min)/real(this%num_cells1, f64)
293 delta_eta2 = (this%eta2_max - this%eta2_min)/real(this%num_cells2, f64)
295 sll_allocate(eta1(1:nc1, 1:nc2), error)
296 sll_allocate(eta2(1:nc1, 1:nc2), error)
299 eta1(i, j) = real(i - 1, f64)*delta_eta1
300 eta2(i, j) = real(j - 1, f64)*delta_eta2
301 eta1(i, j) = eta1_min + modulo(eta1(i, j) + alpha1(i, j), eta1_max - eta1_min)
302 eta2(i, j) = eta2_min + modulo(eta2(i, j) + alpha2(i, j), eta2_max - eta2_min)
307 data_in(1:nc1, 1:nc2), &
310 data_out(1:nc1, 1:nc2))
312 data_out(nc1 + 1, :) = data_out(1, :)
313 data_out(:, nc2 + 1) = data_out(:, 1)
331 sll_real64,
dimension(:),
intent(in),
optional :: coeffs_1d
332 sll_real64,
dimension(:, :),
intent(in),
optional :: coeffs_2d
333 sll_int32,
intent(in),
optional :: coeff2d_size1
334 sll_int32,
intent(in),
optional :: coeff2d_size2
335 sll_real64,
dimension(:),
intent(in),
optional :: knots1
336 sll_real64,
dimension(:),
intent(in),
optional :: knots2
337 sll_int32,
intent(in),
optional :: size_knots1
338 sll_int32,
intent(in),
optional :: size_knots2
340 print *, interpolator%num_cells1, interpolator%num_cells2
342 if (
present(coeffs_1d)) print *,
'coeffs_1d present but not used'
343 if (
present(coeffs_2d)) print *,
'coeffs_2d present but not used'
344 if (
present(coeff2d_size1)) print *,
'coeff2d_size1 present but not used'
345 if (
present(coeff2d_size2)) print *,
'coeff2d_size2 present but not used'
346 if (
present(knots1)) print *,
'knots1 present but not used'
347 if (
present(knots2)) print *,
'knots2 present but not used'
348 if (
present(size_knots1)) print *,
'size_knots1 present but not used'
349 if (
present(size_knots2)) print *,
'size_knots2 present but not used'
351 sll_error(
'set_coefficients',
'Not implemented for nufft2d')
359 sll_real64,
pointer :: res(:, :)
363 sll_error(
'get_coefficients',
'Not implemented for nufft2d')
376 sll_error(
'coefficients_are_set',
'Not implemented for nufft2d')
abstract data type for 2d interpolation
subroutine sll_s_nufft_2d_compute_fft(self, f_in)
Compute the fft and prepare data for nufft call.
subroutine sll_s_nufft_2d_interpolate_array_values(self, f_in, x, y, f_out)
Compute the fft and interpolate array values.
subroutine sll_s_nufft_2d_free(self)
Delete the nufft object.
real(kind=f64) function sll_f_nufft_2d_interpolate_value_from_fft(self, x, y)
Interpolate single value when the fft is already compute.
subroutine sll_s_nufft_2d_init(self, nc_eta1, eta1_min, eta1_max, nc_eta2, eta2_min, eta2_max)
Allocate and initialize data and prepare the fft plan.
Nufft object for 2d interpolation. It contains fft plan and 1d array to pass data to nufft2d subrouti...
Class for the nufft inmplementation of sll_c_interpolator_2d.
real(kind=f64) function interpolate_deriv1_nufft2d(interpolator, eta1, eta2)
subroutine nufft_interpolate2d_disp(this, num_points1, num_points2, data_in, alpha1, alpha2, data_out)
real(kind=f64) function interpolate_deriv2_nufft2d(interpolator, eta1, eta2)
subroutine nufft_interpolate2d(this, num_points1, num_points2, data_in, eta1, eta2, data_out)
subroutine, public sll_s_nufft_interpolator_2d_init(interpolator, npts1, npts2, eta1_min, eta1_max, eta2_min, eta2_max)
subroutine, public sll_s_nufft_interpolator_2d_free(interpolator)
logical function coefficients_are_set_nufft2d(interpolator)
real(kind=f64) function interpolate_value_nufft2d(interpolator, eta1, eta2)
subroutine compute_interpolants_nufft2d(interpolator, data_array, eta1_coords, size_eta1_coords, eta2_coords, size_eta2_coords)
real(kind=f64) function, dimension(:, :), pointer get_coefficients_nufft2d(interpolator)
subroutine set_coefficients_nufft2d(interpolator, coeffs_1d, coeffs_2d, coeff2d_size1, coeff2d_size2, knots1, size_knots1, knots2, size_knots2)
Base class/basic interface for 2D interpolators.
Pointer to this interpolator derived type.
The nufft-based interpolator is only a wrapper around the capabilities of the nufft package.