3 #include "sll_assert.h"
4 #include "sll_memory.h"
5 #include "sll_working_precision.h"
39 sll_real64,
dimension(:, :),
pointer :: deriv
40 sll_int32 :: continuity
41 sll_int32 :: deriv_size
58 eta_hermite_continuity, &
60 const_eta_min_slope, &
61 const_eta_max_slope, &
67 sll_int32,
intent(in) :: npts
68 sll_real64,
intent(in) :: eta_min
69 sll_real64,
intent(in) :: eta_max
70 sll_int32,
intent(in) :: degree
71 sll_int32,
intent(in) :: eta_hermite_continuity
72 sll_int32,
intent(in) :: eta_bc_type
73 sll_real64,
intent(in),
optional :: const_eta_min_slope
74 sll_real64,
intent(in),
optional :: const_eta_max_slope
75 sll_real64,
dimension(:),
intent(in),
optional :: eta_min_slopes
76 sll_real64,
dimension(:),
intent(in),
optional :: eta_max_slopes
79 sll_allocate(interp, ierr)
87 eta_hermite_continuity, &
89 const_eta_min_slope, &
90 const_eta_max_slope, &
102 eta_hermite_continuity, &
104 const_eta_min_slope, &
105 const_eta_max_slope, &
111 sll_int32,
intent(in) :: npts
112 sll_real64,
intent(in) :: eta_min
113 sll_real64,
intent(in) :: eta_max
114 sll_int32,
intent(in) :: degree
115 sll_int32,
intent(in) :: eta_hermite_continuity
116 sll_int32,
intent(in) :: eta_bc_type
117 sll_real64,
intent(in),
optional :: const_eta_min_slope
118 sll_real64,
intent(in),
optional :: const_eta_max_slope
119 sll_real64,
dimension(:),
intent(in),
optional :: eta_min_slopes
120 sll_real64,
dimension(:),
intent(in),
optional :: eta_max_slopes
122 sll_int32 :: deriv_size
126 interp%degree = degree
127 interp%continuity = eta_hermite_continuity
128 interp%bc = eta_bc_type
129 interp%eta_min = eta_min
130 interp%eta_max = eta_max
132 select case (interp%continuity)
134 interp%deriv_size = 3
136 interp%deriv_size = 2
138 print *,
'#bad value for hermite_continuity', interp%continuity
139 print *,
'#in initialize_hermite_interpolation_1d'
141 sll_assert(
present(const_eta_min_slope))
142 sll_assert(
present(const_eta_max_slope))
143 sll_assert(
present(eta_min_slopes))
144 sll_assert(
present(eta_max_slopes))
146 deriv_size = interp%deriv_size
148 sll_allocate(interp%deriv(deriv_size, npts), ierr)
156 sll_real64,
dimension(:),
intent(in) :: f
158 if ((interp%bc == sll_p_hermite))
then
162 print *,
'#interp%continuity=', interp%continuity
164 print *,
'#not implemented for the moment'
165 print *,
'#in sll_s_compute_interpolants_hermite_1d'
168 else if ((interp%bc == sll_p_periodic))
then
172 print *,
'#interp%continuity=', interp%continuity
174 print *,
'#not implemented for the moment'
175 print *,
'#in sll_s_compute_interpolants_hermite_1d'
181 print *,
'#interp%bc=', interp%bc
182 print *,
'#possible_value=', sll_p_hermite, sll_p_periodic
183 print *,
'#not implemented for the moment'
184 print *,
'#in sll_s_compute_interpolants_hermite_1d'
191 sll_int32,
intent(in)::r, s
192 sll_real64,
dimension(r:s),
intent(out)::w
210 tmp = tmp*real(i - j, f64)
213 tmp = tmp*real(i - j, f64)
217 tmp = tmp*real(-j, f64)
220 tmp = tmp*real(-j, f64)
223 tmp = tmp*real(-j, f64)
231 tmp = tmp*real(i - j, f64)
234 tmp = tmp*real(i - j, f64)
238 tmp = tmp*real(-j, f64)
241 tmp = tmp*real(-j, f64)
244 tmp = tmp*real(-j, f64)
266 sll_int32,
intent(in)::n, d
267 sll_real64,
dimension(N + 1),
intent(in)::f
268 sll_real64,
dimension(3, N + 1),
intent(out)::buf2d
269 sll_real64 ::w_left(-d/2:(d + 1)/2), w_right((-d + 1)/2:d/2 + 1)
271 sll_int32 ::i, ii, r_left, r_right, s_left, s_right, ind
278 if ((2*(d/2) - d) == 0)
then
279 w_right(r_right:s_right) = w_left(r_left:s_left)
281 w_right(r_right:s_right) = -w_left(s_left:r_left:-1)
285 buf2d(1, i) = f(modulo(i - 1 + n, n) + 1)
287 do ii = r_left, s_left
288 ind = modulo(i + ii - 1 + n, n) + 1
289 tmp = tmp + w_left(ii)*f(ind)
293 do ii = r_right, s_right
294 ind = modulo(i + ii - 1 + n, n) + 1
295 tmp = tmp + w_right(ii)*f(ind)
307 sll_int32,
intent(in)::n, d
308 sll_real64,
dimension(N + 1),
intent(in)::f
309 sll_real64,
dimension(3, N + 1),
intent(out)::buf2d
310 sll_real64 ::w_left(-d/2:(d + 1)/2), w_right((-d + 1)/2:d/2 + 1)
312 sll_int32 ::i, ii, r_left, r_right, s_left, s_right, ind
319 if ((2*(d/2) - d) == 0)
then
320 w_right(r_right:s_right) = w_left(r_left:s_left)
322 w_right(r_right:s_right) = -w_left(s_left:r_left:-1)
328 do ii = r_left, s_left
330 ind = i + ii;
if (ind > n + 1) ind = 2*(n + 1) - ind;
if (ind < 1) ind = 2 - ind
331 tmp = tmp + w_left(ii)*f(ind)
335 do ii = r_right, s_right
337 ind = i + ii;
if (ind > n + 1) ind = 2*(n + 1) - ind;
if (ind < 1) ind = 2 - ind
338 tmp = tmp + w_right(ii)*f(ind)
346 sll_real64,
intent(in) :: eta
349 sll_real64 :: eta_tmp
354 call localize_per_1d(ii, eta_tmp, interp%eta_min, interp%eta_max, interp%Nc)
360 sll_real64,
intent(in) :: eta
363 sll_real64 :: eta_tmp
371 call localize_per_1d(ii, eta_tmp, interp%eta_min, interp%eta_max, interp%Nc)
377 sll_real64,
intent(in) :: eta
380 sll_real64 :: eta_tmp
385 call localize_nat_1d(ii, eta_tmp, interp%eta_min, interp%eta_max, interp%Nc)
391 sll_int32,
intent(in)::i, n
393 sll_real64,
intent(in)::x
394 sll_real64,
intent(out)::fval
395 sll_real64,
dimension(0:2, 0:N)::f
405 w(0) = (2._f64*x + 1)*(1._f64 - x)*(1._f64 - x);
406 w(1) = x*x*(3._f64 - 2._f64*x)
407 w(2) = x*(1._f64 - x)*(1._f64 - x)
408 w(3) = x*x*(x - 1._f64)
422 fval = w(0)*g(0) + w(1)*g(1) + w(2)*g(2) + w(3)*g(3)
428 sll_int32,
intent(out)::i
429 sll_real64,
intent(inout)::x
430 sll_real64,
intent(in)::xmin, xmax
431 sll_int32,
intent(in)::n
432 x = (x - xmin)/(xmax - xmin)
433 x = x - real(floor(x), f64)
444 sll_int32,
intent(out)::i
445 sll_real64,
intent(inout)::x
446 sll_real64,
intent(in)::xmin, xmax
447 sll_int32,
intent(in)::n
448 x = (x - xmin)/(xmax - xmin)
450 if (x >= real(n, f64))
then
453 if (x <= 0._f64)
then
Describe different boundary conditions.
subroutine interpolate_hermite_1d(f, i, x, fval, N)
integer, parameter, public sll_p_hermite_1d_c0
real(kind=f64) function interpolate_value_hermite_nat_1d(eta, interp)
real(kind=f64) function, public sll_f_interpolate_value_hermite_1d(eta, interp)
subroutine hermite_coef_per_1d(f, buf2d, N, d)
real(kind=f64) function interpolate_value_hermite_per_1d(eta, interp)
subroutine, public sll_s_compute_w_hermite_1d(w, r, s)
subroutine initialize_hermite_interpolation_1d(interp, npts, eta_min, eta_max, degree, eta_hermite_continuity, eta_bc_type, const_eta_min_slope, const_eta_max_slope, eta_min_slopes, eta_max_slopes)
type(sll_t_hermite_interpolation_1d) function, pointer, public sll_f_new_hermite_interpolation_1d(npts, eta_min, eta_max, degree, eta_hermite_continuity, eta_bc_type, const_eta_min_slope, const_eta_max_slope, eta_min_slopes, eta_max_slopes)
subroutine hermite_coef_nat_1d(f, buf2d, N, d)
subroutine localize_per_1d(i, x, xmin, xmax, N)
subroutine, public sll_s_compute_interpolants_hermite_1d(interp, f)
subroutine localize_nat_1d(i, x, xmin, xmax, N)
integer, parameter sll_hermite_1d_c1