8 #include "sll_memory.h"
9 #include "sll_errors.h"
10 #include "sll_working_precision.h"
49 sll_int32 :: stencil_width
51 sll_int32 :: interval_selection
91 sll_int32,
intent(in) :: d, num_points, bc_type
92 sll_real64,
intent(in) :: xmin, xmax
93 sll_int32,
intent(in),
optional :: periodic_last
94 sll_int32,
intent(in),
optional :: interval_selection
98 if (
present(periodic_last))
then
113 if (
present(interval_selection))
then
114 interpolator%interval_selection = interval_selection
119 select case (interpolator%interval_selection)
121 interpolator%stencil_width = 2*d
123 interpolator%stencil_width = 2*d + 1
125 sll_error(
'interpolate_array_disp_li1d',
'Interval selection not implemented.')
128 interpolator%bc_type = bc_type
138 periodic_last)
result(res)
141 sll_int32,
intent(in) :: num_points
142 sll_real64,
intent(in) :: xmin
143 sll_real64,
intent(in) :: xmax
144 sll_int32,
intent(in) :: bc_type
145 sll_int32,
intent(in) :: d
147 sll_int32,
intent(in),
optional :: periodic_last
150 sll_allocate(res, ierr)
152 if (
present(periodic_last))
then
171 sll_real64,
intent(in) :: alpha
172 sll_int32,
intent(in) :: num_pts
173 sll_real64,
dimension(:),
intent(in) ::
data
174 sll_real64,
dimension(1:num_pts),
intent(out) :: output_array
176 select case (this%interval_selection)
179 output_array = this%lagrange%data_out
181 select case (this%bc_type)
182 case (sll_p_periodic)
183 if (this%lagrange%periodic_last == 0)
then
188 case (sll_p_one_sided)
193 sll_error(
'interpolate_array_disp_li1d',
'Boundary type not implemented.')
196 sll_error(
'interpolate_array_disp_li1d',
'Interval selection not implemented.')
203 sll_real64,
intent(in) :: alpha
204 sll_int32,
intent(in) :: num_pts
205 sll_real64,
dimension(num_pts),
intent(inout) ::
data
208 data = this%lagrange%data_out
221 vals_to_interpolate, &
224 sll_int32,
intent(in) :: num_pts
225 sll_real64,
dimension(num_pts),
intent(in) :: vals_to_interpolate
226 sll_real64,
dimension(num_pts),
intent(out) :: output_array
228 output_array = 0.0_f64
229 print *,
'sll_s_cubic_spline_1d_eval_array:', &
230 ' not implemented for lagrange interpolation'
232 print *, maxval(vals_to_interpolate)
233 output_array = 0._f64
234 print *, interpolator%bc_type
241 vals_to_interpolate, &
244 sll_int32,
intent(in) :: num_pts
245 sll_real64,
dimension(:),
intent(in) :: vals_to_interpolate
246 sll_real64,
dimension(:),
intent(out) :: output_array
248 output_array = 0.0_f64
249 print *,
'interpolate_from_interpolant_derivatives_eta1: ', &
250 'not implemented for lagrange interpolation'
252 print *, maxval(vals_to_interpolate)
253 print *, maxval(output_array)
254 print *, interpolator%bc_type
261 sll_real64,
intent(in) :: eta1
262 print *,
'interpolate_derivative_eta1_li1d: ', &
263 'not implemented for lagrange interpolation'
264 print *, interpolator%bc_type
273 sll_real64,
intent(in) :: eta1
274 print *,
'interpolate_value_li1d: ', &
275 'not implemented for lagrange interpolation'
278 print *, interpolator%bc_type
285 sll_int32,
intent(in) :: num_pts
286 sll_real64,
dimension(num_pts),
intent(in) :: coordinates
287 sll_real64,
dimension(:),
intent(in) ::
data
288 sll_real64,
dimension(num_pts),
intent(out) :: output_array
292 print *,
'interpolate_array_li1d: ', &
293 'not implemented for lagrange interpolation'
294 print *, maxval(coordinates)
295 print *, maxval(data)
296 print *, this%bc_type
297 output_array = 0._f64
305 sll_real64,
dimension(:),
intent(in) :: data_array
306 sll_real64,
dimension(:),
intent(in),
optional :: eta_coords
307 sll_int32,
intent(in),
optional :: size_eta_coords
309 print *,
'compute_interpolants_li1d:', &
310 ' not implemented for lagrange interpolation'
312 if (
present(eta_coords) .or.
present(size_eta_coords))
then
313 sll_error(
'compute_interpolants_li1d',
'This case is not yet implemented')
316 print *, maxval(data_array)
317 print *, interpolator%bc_type
323 sll_real64,
dimension(:),
intent(in),
optional :: coeffs
324 print *,
'set_coefficients_li1d(): ERROR: This function has not been ', &
326 if (
present(coeffs))
then
327 print *,
'#coeffs present but not used'
329 print *, interpolator%bc_type
337 print *,
'get_coefficients_li1d(): ERROR: This function has not been ', &
339 print *, interpolator%bc_type
Describe different boundary conditions.
Module for 1D interpolation and reconstruction.
Module for 1D Lagrange interpolation on a uniform grid (only odd order)
subroutine, public sll_s_lagrange_interpolation_1d_fast_disp_fixed_no_bc(fi, fp, p, stencil)
Lagrange interpolation, without boundary conditions. One sided a the outermost points.
subroutine, public sll_s_lagrange_interpolation_1d_fast_disp_fixed_periodicl(fi, fp, p, stencil)
Lagrange interpolation, periodic boundary conditions, first value repeated at the end.
subroutine, public sll_s_lagrange_interpolation_1d_fast_disp_fixed_periodic(fi, fp, p, stencil)
Lagrange interpolation, periodic boundary conditions.
subroutine, public sll_s_lagrange_interpolation_1d_fast_disp_fixed_haloc_cells(fi, fp, p, stencil)
Lagrange interpolation with halo cell boundaries, where the input array already contains halo cells....
subroutine, public sll_s_cubic_spline_1d_eval_array(fi, alpha, lagrange)
This function computes the value at the grid points displacement by -alpha.
subroutine, public sll_s_compute_lagrange_interpolation_1d(lagrange)
This function computes the weights w_j for the barycentric formula.
type(sll_t_lagrange_interpolation_1d) function, pointer, public sll_f_new_lagrange_interpolation_1d(num_points, xmin, xmax, bc_type, d, periodic_last)
Interpolator class and methods of Lagrange 1D interpolator.
subroutine initialize_li1d_interpolator(interpolator, num_points, xmin, xmax, bc_type, d, periodic_last, interval_selection)
real(kind=f64) function, dimension(:), pointer get_coefficients_li1d(interpolator)
subroutine interpolate_array_values_li1d(interpolator, num_pts, vals_to_interpolate, output_array)
subroutine compute_interpolants_li1d(interpolator, data_array, eta_coords, size_eta_coords)
subroutine interpolate_array_disp_li1d(this, num_pts, data, alpha, output_array)
subroutine set_coefficients_li1d(interpolator, coeffs)
subroutine interpolate_array_disp_inplace_li1d(this, num_pts, data, alpha)
real(kind=f64) function interpolate_derivative_eta1_li1d(interpolator, eta1)
real(kind=f64) function interpolate_value_li1d(interpolator, eta1)
subroutine interpolate_array_li1d(this, num_pts, data, coordinates, output_array)
subroutine interpolate_array_derivatives_li1d(interpolator, num_pts, vals_to_interpolate, output_array)
integer(kind=i32), parameter, public sll_p_lagrange_fixed
Flag to specify Lagrange interpolation on a fixed interval centered around the point that is displace...
integer(kind=i32), parameter, public sll_p_lagrange_centered
Flag to specify Lagrange interpolation centered around the interpolation point.
type(sll_t_lagrange_interpolator_1d) function, pointer new_lagrange_interpolator_1d(num_points, xmin, xmax, bc_type, d, periodic_last)
Abstract class for 1D interpolation and reconstruction.
Interpolator class of Lagrange 1D interpolator.