2 #define HALO_DTYPE sll_real32
4 #define HALO_DTYPE sll_real64
15 #define PBA_POW(i) pba_pow(i)
36 #include "sll_assert.h"
37 #include "sll_memory.h"
38 #include "sll_working_precision.h"
51 sll_real64,
parameter ::
p_a = sqrt((2.0_f64 + sqrt(3.0_f64))/6.0_f64)
53 sll_real64,
parameter ::
p_b = sqrt((2.0_f64 - sqrt(3.0_f64))/6.0_f64)
55 sll_real64,
parameter ::
p_sqrt3 = sqrt(3.0_f64)
56 sll_real64,
parameter ::
p_inv_6 = 1._f64/6._f64
60 sll_real64,
dimension(0:27),
parameter ::
pba_pow = [ &
72 sll_real64,
intent(in) :: fdata(:)
73 sll_int32,
intent(in) :: si
74 sll_int32,
intent(in) :: num_points
75 halo_dtype,
intent(out) :: d_0
76 halo_dtype,
intent(out) :: c_np2
78 sll_int32 :: i, ind_min
81 sll_assert_always(num_points > num_terms)
87 d_0 = fdata(num_points + si)
90 do i = ind_min, num_terms
91 d_0 = d_0 +
pba_pow(i)*fdata(num_points + si - i)
100 do i = ind_min, num_terms
101 c_np2 = c_np2 +
pba_pow(i)*fdata(2 + si + i)
104 c_np2 = c_np2 +
pba_pow(i)*fdata(2 + si - i)
111 sll_real64,
intent(in) :: fdata(:)
112 sll_int32,
intent(in) :: si
113 sll_int32,
intent(in) :: num_points
114 halo_dtype,
intent(out) :: d_0
115 halo_dtype,
intent(inout) :: c_np2
117 sll_int32 :: i, ind_min
120 d_0 = d_0 + fdata(si)
123 d_0 = d_0 +
pba_pow(i)*fdata(si - i)
127 c_np2 = c_np2 + fdata(num_points + 2 + si)
133 c_np2 = c_np2 +
pba_pow(i)*fdata(num_points + 2 + si + i)
135 do i = ind_min, num_terms
136 c_np2 = c_np2 +
pba_pow(i)*fdata(num_points + 2 + si - i)
144 sll_real64,
intent(in) :: f(0:)
145 sll_int32,
intent(in) :: num_points
146 sll_real64,
intent(out) :: d(0:)
147 sll_real64,
intent(out) :: coeffs(0:)
151 logical,
save :: first_call = .true.
153 if ((first_call) .and. (num_terms < 27))
then
154 write (*, *)
"WARNING: sll_s_cubic_spline_halo_1d uses NUM_TERMS=", num_terms
158 sll_assert(
size(f) .ge. num_points - 1)
159 sll_assert(
size(d) .ge. num_points)
160 sll_assert(
size(coeffs) .ge. num_points)
162 sll_assert_always(num_points > num_terms)
170 coeffs(np + 2) = f(np + 2)
173 coeffs(i) =
p_r_a*(d(i) -
p_b*coeffs(i + 1))
180 sll_real64,
intent(in) :: coeffs(0:)
181 sll_real64,
intent(in) :: alpha
182 sll_int32,
intent(in) :: num_points
183 sll_real64,
intent(out) :: fout(:)
185 sll_real64 :: calpha, cim1, ci, cip1, cip2, t1, t2, t3, t4
188 calpha = 1.0_f64 - alpha
190 do cell = 1, num_points
191 cim1 = coeffs(cell - 1)
193 cip1 = coeffs(cell + 1)
194 cip2 = coeffs(cell + 2)
197 t2 = calpha*(calpha*(calpha*(cim1 - t1) + t1) + t1) + ci
198 t4 = alpha*(alpha*(alpha*(cip2 - t3) + t3) + t3) + cip1
205 sll_real64,
intent(inout) :: fin(0:)
206 sll_real64,
intent(in) :: alpha
207 sll_int32,
intent(in) :: num_cells
208 sll_real64,
intent(out) :: fout(:)
217 sll_int32,
intent(in) :: num_points
218 sll_real64,
intent(out) :: d(0:)
219 sll_real64,
intent(inout) :: f_coeffs(0:)
223 sll_assert(
size(d) .ge. num_points)
224 sll_assert(
size(f_coeffs) .ge. num_points)
226 sll_assert_always(num_points > num_terms)
231 d(0) = d(0) +
pba_pow(i)*f_coeffs(num_points - i)
236 d(i) =
p_r_a*(f_coeffs(i) -
p_b*d(i - 1))
239 f_coeffs(np) = d(np - 1)
241 f_coeffs(np) = f_coeffs(np) + d(i - 1)*
pba_pow(i)
243 f_coeffs(np) = f_coeffs(np)*
p_r_a
247 f_coeffs(i) =
p_r_a*(d(i - 1) -
p_b*f_coeffs(i + 1))
250 f_coeffs(0) = f_coeffs(np)
251 f_coeffs(np + 1:np + 2) = f_coeffs(1:2)
Interpolator 1d using cubic splines on regular mesh with halo cells.
real(kind=f64), parameter p_b_a
subroutine, public sll_s_cubic_spline_halo_1d_compute_interpolant(f, num_points, d, coeffs)
Compute the coefficients of the local interpolating spline (after d(0) and c(num_points+2) have been ...
subroutine, public sll_s_cubic_spline_halo_1d_finish_boundary_conditions(fdata, si, num_points, d_0, c_np2)
Complete d(0) and c(num_points+2) with local data after their values have been received from the neig...
subroutine sll_s_cubic_spline_halo_1d_compute_periodic(num_points, d, f_coeffs)
Compute the coefficients of the local interpolating spline (after d(0) and c(num_points+2) have been ...
real(kind=f64), dimension(0:27), parameter pba_pow
real(kind=f64), parameter p_r_a
real(kind=f64), parameter p_sqrt3
real(kind=f64), parameter p_b
real(kind=f64), parameter p_inv_6
real(kind=f64), parameter p_a
subroutine, public sll_s_cubic_spline_halo_1d_periodic(fin, alpha, num_cells, fout)
subroutine, public sll_s_cubic_spline_halo_1d_prepare_exchange(fdata, si, num_points, d_0, c_np2)
Compute the part of d(0) and c(num_points+2) that need to be send to neighboring processors.
subroutine, public sll_s_cubic_spline_halo_1d_eval_disp(coeffs, alpha, num_points, fout)
This function corresponds to the interpolate_array_disp function of the interpolators but the displac...