29 #include "sll_assert.h"
30 #include "sll_errors.h"
31 #include "sll_memory.h"
32 #include "sll_working_precision.h"
64 sll_real64,
dimension(:),
pointer :: interpolation_points
65 sll_int32 :: num_points
100 sll_int32,
intent(in) :: num_pts
101 sll_real64,
dimension(num_pts),
intent(in) :: coordinates
102 sll_real64,
dimension(:),
intent(in) ::
data
103 sll_real64,
dimension(num_pts),
intent(out) :: output_array
115 sll_int32,
intent(in) :: num_pts
116 sll_real64,
intent(in) :: alpha
117 sll_real64,
dimension(:),
intent(in) ::
data
118 sll_real64,
dimension(num_pts),
intent(out) :: output_array
131 sll_int32,
intent(in) :: num_pts
132 sll_real64,
intent(in) :: alpha
133 sll_real64,
dimension(num_pts),
intent(inout) ::
data
136 sll_real64,
dimension(num_pts) :: coordinates
137 sll_real64 :: length, delta
138 sll_real64 :: xmin, xmax
143 length = this%interpolation_points(this%num_points) - &
144 this%interpolation_points(1)
145 delta = this%interpolation_points(2) - this%interpolation_points(1)
146 xmin = this%interpolation_points(1)
147 xmax = this%interpolation_points(this%num_points)
148 if (this%bc_type == sll_p_periodic)
then
152 if (alpha == 0.0_f64)
then
153 coordinates(:) = this%interpolation_points(:)
156 coordinates(i) = xmin + &
157 modulo(this%interpolation_points(i) - xmin + alpha, length)
161 sll_assert(coordinates(i) >= xmin)
162 sll_assert(coordinates(i) <= xmax)
168 coordinates(i) = max(this%interpolation_points(i) + alpha, xmin)
169 sll_assert((xmin <= coordinates(i)) .and. (coordinates(i) <= xmax))
173 coordinates(i) = min(this%interpolation_points(i) + alpha, xmax)
174 sll_assert((xmin <= coordinates(i)) .and. (coordinates(i) <= xmax))
186 sll_real64,
dimension(:),
intent(in) :: data_array
187 sll_real64,
dimension(:),
intent(in),
optional :: eta_coords
188 sll_int32,
intent(in),
optional :: size_eta_coords
190 if (
present(eta_coords) .or.
present(size_eta_coords))
then
191 sll_error(
'compute_interpolants_cs1d',
'This case is not yet implemented')
206 vals_to_interpolate, &
209 sll_int32,
intent(in) :: num_pts
210 sll_real64,
dimension(num_pts),
intent(in) :: vals_to_interpolate
211 sll_real64,
dimension(num_pts),
intent(out) :: output_array
213 num_pts, interpolator%spline)
219 vals_to_interpolate, &
222 sll_int32,
intent(in) :: num_pts
223 sll_real64,
dimension(:),
intent(in) :: vals_to_interpolate
224 sll_real64,
dimension(:),
intent(out) :: output_array
226 num_pts, interpolator%spline)
232 sll_real64,
intent(in) :: eta1
239 sll_real64,
intent(in) :: eta1
259 fast_algorithm)
result(res)
262 sll_int32,
intent(in) :: num_points
263 sll_real64,
intent(in) :: xmin
264 sll_real64,
intent(in) :: xmax
265 sll_int32,
intent(in) :: bc_type
266 sll_real64,
intent(in),
optional :: slope_left
267 sll_real64,
intent(in),
optional :: slope_right
268 logical,
intent(in),
optional :: fast_algorithm
271 sll_allocate(res, ierr)
273 if (
present(slope_left) .and.
present(slope_right))
then
274 if (
present(fast_algorithm))
then
294 elseif (
present(fast_algorithm))
then
301 fast_algorithm=fast_algorithm)
328 sll_int32,
intent(in) :: num_points
329 sll_real64,
intent(in) :: xmin
330 sll_real64,
intent(in) :: xmax
331 sll_int32,
intent(in) :: bc_type
332 sll_real64,
intent(in),
optional :: slope_left
333 sll_real64,
intent(in),
optional :: slope_right
334 logical,
intent(in),
optional :: fast_algorithm
339 interpolator%num_points = num_points
340 sll_allocate(interpolator%interpolation_points(num_points), ierr)
341 interpolator%interpolation_points(1) = xmin
342 delta = (xmax - xmin)/(num_points - 1)
344 interpolator%interpolation_points(i) = &
345 interpolator%interpolation_points(i - 1) + delta
347 interpolator%interpolation_points(num_points) = xmax
348 interpolator%bc_type = bc_type
349 if (
present(slope_left) .and.
present(slope_right))
then
350 if (
present(fast_algorithm))
then
352 interpolator%spline, &
361 interpolator%spline, &
368 elseif (
present(fast_algorithm))
then
370 interpolator%spline, &
374 fast_algorithm=fast_algorithm)
377 interpolator%spline, &
378 num_points, xmin, xmax, bc_type)
390 sll_real64,
dimension(:),
intent(in),
optional :: coeffs
391 print *,
'#set_coefficients_cs1d(): ERROR: This function has not been ', &
393 if (
present(coeffs))
then
394 print *,
'#coefs are present'
396 print *, interpolator%num_points
404 print *,
'get_coefficients_cs1d(): ERROR: This function has not been ', &
407 print *, interpolator%num_points
Deallocate the interpolator object.
Describe different boundary conditions.
Interpolator 1d using cubic splines on regular mesh.
subroutine compute_interpolants_cs1d(interpolator, data_array, eta_coords, size_eta_coords)
subroutine set_coefficients_cs1d(interpolator, coeffs)
real(kind=f64) function, dimension(:), pointer get_coefficients_cs1d(interpolator)
subroutine interpolate_values_cs1d(interpolator, num_pts, vals_to_interpolate, output_array)
subroutine spline_interpolate1d_disp_inplace(this, num_pts, data, alpha)
subroutine initialize_cs1d_interpolator(interpolator, num_points, xmin, xmax, bc_type, slope_left, slope_right, fast_algorithm)
initialize cubic spline interpolator
real(kind=f64) function interpolate_deriv1_cs1d(interpolator, eta1)
subroutine spline_interpolate1d(this, num_pts, data, coordinates, output_array)
subroutine spline_interpolate1d_disp(this, num_pts, data, alpha, output_array)
Computes the interpolated values at each grid point replaced by alpha using cubic spline interpolatio...
real(kind=f64) function interpolate_value_cs1d(interpolator, eta1)
type(sll_t_cubic_spline_interpolator_1d) function, pointer, public sll_f_new_cubic_spline_interpolator_1d(num_points, xmin, xmax, bc_type, slope_left, slope_right, fast_algorithm)
subroutine interpolate_derivatives_cs1d(interpolator, num_pts, vals_to_interpolate, output_array)
subroutine delete_cs1d(obj)
Provides capabilities for data and derivative interpolation with cubic B-splines and different bounda...
real(kind=f64) function, public sll_f_cubic_spline_1d_eval_deriv(x, spline)
returns the value of the derivative at the image of the abscissa 'x', using the spline coefficients s...
subroutine, public sll_s_cubic_spline_1d_compute_interpolant(f, spline)
Computes the cubic spline coefficients corresponding to the 1D data array 'f'.
subroutine, public sll_s_cubic_spline_1d_init(self, num_points, xmin, xmax, bc_type, sl, sr, fast_algorithm)
Returns a pointer to a heap-allocated cubic spline object.
subroutine, public sll_s_cubic_spline_1d_eval_disp(spline, alpha, output_array)
Computes the interpolated values at each grid point replaced by alpha for the precomputed spline coef...
subroutine, public sll_s_cubic_spline_1d_eval_array(a_in, a_out, n, spline)
returns the values of the images of a collection of abscissae, represented by a 1D array in another o...
subroutine, public sll_s_cubic_spline_1d_eval_array_deriv(array_in, array_out, num_pts, spline)
returns the values of the derivatives evaluated at a collection of abscissae stored in the input 1D a...
real(kind=f64) function, public sll_f_cubic_spline_1d_eval(x, spline)
returns the value of the interpolated image of the abscissa x, using the spline coefficients stored i...
subroutine, public sll_s_cubic_spline_1d_free(spline)
deallocate the sll_t_cubic_spline_1d object
Module for 1D interpolation and reconstruction.
Pointer to cubic spline interpolator implementation 1D.
Cubic spline interpolator 1d regular grid.
basic type for one-dimensional cubic spline data.
Abstract class for 1D interpolation and reconstruction.