9 #include "sll_assert.h"
10 #include "sll_errors.h"
11 #include "sll_memory.h"
12 #include "sll_working_precision.h"
44 sll_real64,
dimension(:),
pointer :: interpolation_points
45 sll_int32 :: num_points
87 sll_int32,
intent(in) :: num_pts
88 sll_real64,
dimension(num_pts),
intent(in) :: coordinates
89 sll_real64,
dimension(:),
intent(in) ::
data
90 sll_real64,
dimension(num_pts),
intent(out) :: output_array
100 sll_int32,
intent(in) :: num_pts
101 sll_real64,
intent(in) :: alpha
102 sll_real64,
dimension(:),
intent(in) ::
data
103 sll_real64,
dimension(num_pts),
intent(out) :: output_array
105 sll_real64,
dimension(num_pts) :: coordinates
106 sll_real64 :: length, delta
107 sll_real64 :: xmin, xmax
112 length = this%interpolation_points(num_pts) - &
113 this%interpolation_points(1)
114 delta = this%interpolation_points(2) - this%interpolation_points(1)
115 xmin = this%interpolation_points(1)
116 xmax = this%interpolation_points(num_pts)
117 if (this%bc_type == sll_p_periodic)
then
119 coordinates(i) = xmin + modulo(this%interpolation_points(i) - xmin - alpha, length)
120 sll_assert(coordinates(i) >= xmin)
121 sll_assert(coordinates(i) <= xmax)
126 coordinates(i) = max(this%interpolation_points(i) + alpha, xmin)
127 sll_assert((xmin <= coordinates(i)) .and. (coordinates(i) <= xmax))
131 coordinates(i) = min(this%interpolation_points(i) + alpha, xmax)
132 sll_assert((xmin <= coordinates(i)) .and. (coordinates(i) <= xmax))
143 sll_int32,
intent(in) :: num_pts
144 sll_real64,
intent(in) :: alpha
145 sll_real64,
dimension(num_pts),
intent(inout) ::
data
147 sll_real64,
dimension(num_pts) :: coordinates
148 sll_real64 :: length, delta
149 sll_real64 :: xmin, xmax
154 length = this%interpolation_points(num_pts) - &
155 this%interpolation_points(1)
156 delta = this%interpolation_points(2) - this%interpolation_points(1)
157 xmin = this%interpolation_points(1)
158 xmax = this%interpolation_points(num_pts)
159 if (this%bc_type == sll_p_periodic)
then
161 coordinates(i) = xmin + modulo(this%interpolation_points(i) - xmin - alpha, length)
162 sll_assert(coordinates(i) >= xmin)
163 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))
192 sll_real64,
dimension(:),
intent(in) :: data_array
193 sll_real64,
dimension(:),
intent(in),
optional :: eta_coords
194 sll_int32,
intent(in),
optional :: size_eta_coords
196 if (
present(eta_coords) .or.
present(size_eta_coords))
then
197 sll_error(
'compute_interpolants_cs1d',
'This case is not yet implemented')
212 vals_to_interpolate, &
215 sll_int32,
intent(in) :: num_pts
216 sll_real64,
dimension(num_pts),
intent(in) :: vals_to_interpolate
217 sll_real64,
dimension(num_pts),
intent(out) :: output_array
219 num_pts, interpolator%spline)
225 vals_to_interpolate, &
228 sll_int32,
intent(in) :: num_pts
229 sll_real64,
dimension(:),
intent(in) :: vals_to_interpolate
230 sll_real64,
dimension(:),
intent(out) :: output_array
232 num_pts, interpolator%spline)
238 sll_real64,
intent(in) :: eta1
245 sll_real64,
intent(in) :: eta1
271 sll_int32,
intent(in) :: num_points
272 sll_real64,
intent(in) :: xmin
273 sll_real64,
intent(in) :: xmax
274 sll_int32,
intent(in) :: bc_type
275 sll_real64,
intent(in),
optional :: slope_left
276 sll_real64,
intent(in),
optional :: slope_right
281 interpolator%num_points = num_points
282 sll_allocate(interpolator%interpolation_points(num_points), ierr)
283 interpolator%interpolation_points(1) = xmin
284 delta = (xmax - xmin)/(num_points - 1)
286 interpolator%interpolation_points(i) = &
287 interpolator%interpolation_points(i - 1) + delta
289 interpolator%bc_type = bc_type
290 if (
present(slope_left) .and.
present(slope_right))
then
292 interpolator%spline, &
300 interpolator%spline, &
301 num_points, xmin, xmax, bc_type)
312 sll_real64,
dimension(:),
intent(in),
optional :: coeffs
313 print *,
'set_coefficients_cs1d(): ERROR: This function has not been ', &
315 print *, interpolator%num_points
316 if (
present(coeffs))
then
317 print *,
'coeffs are present'
326 print *,
'get_coefficients_cs1d(): ERROR: This function has not been ', &
328 print *, interpolator%num_points
Describe different boundary conditions.
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_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.
basic type for one-dimensional cubic spline data.
Abstract class for 1D interpolation and reconstruction.