V3FIT
ezspline.f90
1 module ezspline
2 
3  interface ezspline_init
4  !
5  ! Initialize and allocate memory. BCS1,2,3 determine the type of boundary
6  ! conditions on either end of the x1,2,3 grids: eg (/0, 0/) for not-a-knot
7  ! on the left and (/-1, -1/) periodic. Other BCs such as imposed slope or
8  ! second derivative can also be applied by setting '1' or '2' respectively
9  ! on either side. For instance (/1, 2/) for 1st derivative on the left and
10  ! 2nd derivative on the right. The value of the 1st/2nd derivative must be
11  ! set explicitely set through the bcval1,2,3min and bcval1,2,3max arrays.
12  !
13  subroutine ezspline_init3_r8(spline_o, n1, n2, n3, BCS1, BCS2, BCS3, ier)
14  use ezspline_obj
15  type(EZspline3_r8) :: spline_o
16  integer, intent(in) :: n1, n2, n3
17  integer, intent(in) :: BCS1(2), BCS2(2), BCS3(2)
18  integer, intent(out) :: ier
19  end subroutine ezspline_init3_r8
20 
21  subroutine ezspline_init2_r8(spline_o, n1, n2, BCS1, BCS2, ier)
22  use ezspline_obj
23  type(EZspline2_r8) :: spline_o
24  integer, intent(in) :: n1, n2
25  integer, intent(in) :: BCS1(2), BCS2(2)
26  integer, intent(out) :: ier
27  end subroutine ezspline_init2_r8
28 
29  subroutine ezspline_init1_r8(spline_o, n1, BCS1, ier)
30  use ezspline_obj
31  type(EZspline1_r8) spline_o
32  integer, intent(in) :: n1
33  integer, intent(in) :: BCS1(2)
34  integer, intent(out) :: ier
35  end subroutine ezspline_init1_r8
36 
37  subroutine ezspline_init3_r4(spline_o, n1, n2, n3, BCS1, BCS2, BCS3, ier)
38  use ezspline_obj
39  type(EZspline3_r4) spline_o
40  integer, intent(in) :: n1, n2, n3
41  integer, intent(in) :: BCS1(2), BCS2(2), BCS3(2)
42  integer, intent(out) :: ier
43  end subroutine ezspline_init3_r4
44 
45  subroutine ezspline_init2_r4(spline_o, n1, n2, BCS1, BCS2, ier)
46  use ezspline_obj
47  type(EZspline2_r4) spline_o
48  integer, intent(in) :: n1, n2
49  integer, intent(in) :: BCS1(2), BCS2(2)
50  integer, intent(out) :: ier
51  end subroutine ezspline_init2_r4
52 
53  subroutine ezspline_init1_r4(spline_o, n1, BCS1, ier)
54  use ezspline_obj
55  type(EZspline1_r4) spline_o
56  integer, intent(in) :: n1
57  integer, intent(in) :: BCS1(2)
58  integer, intent(out) :: ier
59  end subroutine ezspline_init1_r4
60 
61  end interface
62 
63 
64  interface ezlinear_init
65  !
66  ! Initialize and allocate memory for piecewise LINEAR interpolation
67  ! object. This is C0. For C2 cubic spline or C1 Akima Hermite spline,
68  ! please see EZspline_init.
69  !
70  ! No boundary conditions are needed for piecewise linear interpolation
71  !
72  subroutine ezlinear_init3_r8(spline_o, n1, n2, n3, ier)
73  use ezspline_obj
74  type(EZspline3_r8) spline_o
75  integer, intent(in) :: n1, n2, n3
76  integer, intent(out) :: ier
77  end subroutine ezlinear_init3_r8
78 
79  subroutine ezlinear_init2_r8(spline_o, n1, n2, ier)
80  use ezspline_obj
81  type(EZspline2_r8) spline_o
82  integer, intent(in) :: n1, n2
83  integer, intent(out) :: ier
84  end subroutine ezlinear_init2_r8
85 
86  subroutine ezlinear_init1_r8(spline_o, n1, ier)
87  use ezspline_obj
88  type(EZspline1_r8) spline_o
89  integer, intent(in) :: n1
90  integer, intent(out) :: ier
91  end subroutine ezlinear_init1_r8
92 
93  subroutine ezlinear_init3_r4(spline_o, n1, n2, n3, ier)
94  use ezspline_obj
95  type(EZspline3_r4) spline_o
96  integer, intent(in) :: n1, n2, n3
97  integer, intent(out) :: ier
98  end subroutine ezlinear_init3_r4
99 
100  subroutine ezlinear_init2_r4(spline_o, n1, n2, ier)
101  use ezspline_obj
102  type(EZspline2_r4) spline_o
103  integer, intent(in) :: n1, n2
104  integer, intent(out) :: ier
105  end subroutine ezlinear_init2_r4
106 
107  subroutine ezlinear_init1_r4(spline_o, n1, ier)
108  use ezspline_obj
109  type(EZspline1_r4) spline_o
110  integer, intent(in) :: n1
111  integer, intent(out) :: ier
112  end subroutine ezlinear_init1_r4
113 
114  end interface
115 
116 
117  interface ezhybrid_init
118  !
119  ! Initialize and allocate memory for hybrid interpolation object:
120  ! dimensionality > 1 only. Interpolation method is specified separately
121  ! for each dimension. At present, Akima Hermite and Spline interpolation
122  ! cannot be mixed.
123  !
124  ! Boundary condition arguments are optional. They are appropriate only
125  ! for the end points of dimensions for which Hermite or Spline cubic
126  ! interpolation is used.
127  !
128  ! hspline(...) specifies the interpolation method for each dimension,
129  ! according to the code: -1 for step function, 0 for piecewise linear,
130  ! 1 for Akima Hermite, 2 for cubic Spline.
131  !
132  subroutine ezhybrid_init3_r8(spline_o, n1, n2, n3, hspline, ier, &
133  BCS1, BCS2, BCS3)
134  use ezspline_obj
135  type(EZspline3_r8) spline_o
136  integer, intent(in) :: n1, n2, n3
137  integer, intent(in) :: hspline(3)
138  integer, intent(out) :: ier
139  integer, intent(in), OPTIONAL :: BCS1(2), BCS2(2), BCS3(2)
140  end subroutine ezhybrid_init3_r8
141 
142  subroutine ezhybrid_init2_r8(spline_o, n1, n2, hspline, ier, &
143  BCS1, BCS2)
144  use ezspline_obj
145  type(EZspline2_r8) spline_o
146  integer, intent(in) :: n1, n2
147  integer, intent(in) :: hspline(2)
148  integer, intent(out) :: ier
149  integer, intent(in), OPTIONAL :: BCS1(2), BCS2(2)
150  end subroutine ezhybrid_init2_r8
151 
152  subroutine ezhybrid_init3_r4(spline_o, n1, n2, n3, hspline, ier, &
153  BCS1, BCS2, BCS3)
154  use ezspline_obj
155  type(EZspline3_r4) spline_o
156  integer, intent(in) :: n1, n2, n3
157  integer, intent(in) :: hspline(3)
158  integer, intent(out) :: ier
159  integer, intent(in), OPTIONAL :: BCS1(2), BCS2(2), BCS3(2)
160  end subroutine ezhybrid_init3_r4
161 
162  subroutine ezhybrid_init2_r4(spline_o, n1, n2, hspline, ier, &
163  BCS1, BCS2)
164  use ezspline_obj
165  type(EZspline2_r4) spline_o
166  integer, intent(in) :: n1, n2
167  integer, intent(in) :: hspline(2)
168  integer, intent(out) :: ier
169  integer, intent(in), OPTIONAL :: BCS1(2), BCS2(2)
170  end subroutine ezhybrid_init2_r4
171 
172  end interface
173 
174  interface ezspline_free
175  !
176  ! Reset and free the memory. This method must be called to avoid
177  ! memory leaks after all interpolations have been computed.
178  !
179  subroutine ezspline_free3_r8(spline_o, ier)
180  use ezspline_obj
181  type(EZspline3_r8) spline_o
182  integer, intent(out) :: ier
183  end subroutine ezspline_free3_r8
184 
185  subroutine ezspline_free2_r8(spline_o, ier)
186  use ezspline_obj
187  type(EZspline2_r8) spline_o
188  integer, intent(out) :: ier
189  end subroutine ezspline_free2_r8
190 
191  subroutine ezspline_free1_r8(spline_o, ier)
192  use ezspline_obj
193  type(EZspline1_r8) spline_o
194  integer, intent(out) :: ier
195  end subroutine ezspline_free1_r8
196 
197  subroutine ezspline_free3_r4(spline_o, ier)
198  use ezspline_obj
199  type(EZspline3_r4) spline_o
200  integer, intent(out) :: ier
201  end subroutine ezspline_free3_r4
202 
203  subroutine ezspline_free2_r4(spline_o, ier)
204  use ezspline_obj
205  type(EZspline2_r4) spline_o
206  integer, intent(out) :: ier
207  end subroutine ezspline_free2_r4
208 
209  subroutine ezspline_free1_r4(spline_o, ier)
210  use ezspline_obj
211  type(EZspline1_r4) spline_o
212  integer, intent(out) :: ier
213  end subroutine ezspline_free1_r4
214  end interface
215 
216  interface ezspline_setup
217  !
218  ! Compute the cubic spline coefficients. Note: the grid and the
219  ! boundary conditions should be properly set prior to this call.
220  !
221  ! NEW optional argument: exact_dim=TRUE to requre f dimensions to
222  ! match higher dimensions of spline_o%fspl exactly; default or FALSE
223  ! means f dimensions can match or exceed dimensions of spline_o%fspl.
224  !
225  ! array arguments are now declared with f90 style dimensioning; the
226  ! module interface must be used (if not feasible see ezspline_setupx.f90).
227  !
228  subroutine ezspline_setup3_r8(spline_o, f, ier, exact_dim)
229  use ezspline_obj
230  type(EZspline3_r8) spline_o
231  real(ezspline_r8), dimension(:,:,:), intent(in) :: f
232  integer, intent(out) :: ier
233  logical, intent(in), optional :: exact_dim
234  end subroutine ezspline_setup3_r8
235 
236  subroutine ezspline_setup2_r8(spline_o, f, ier, exact_dim)
237  use ezspline_obj
238  type(EZspline2_r8) spline_o
239  real(ezspline_r8), dimension(:,:), intent(in) :: f
240  integer, intent(out) :: ier
241  logical, intent(in), optional :: exact_dim
242  end subroutine ezspline_setup2_r8
243 
244  subroutine ezspline_setup1_r8(spline_o, f, ier, exact_dim)
245  use ezspline_obj
246  type(EZspline1_r8) spline_o
247  real(ezspline_r8), dimension(:), intent(in) :: f
248  integer, intent(out) :: ier
249  logical, intent(in), optional :: exact_dim
250  end subroutine ezspline_setup1_r8
251 
252  subroutine ezspline_setup3_r4(spline_o, f, ier, exact_dim)
253  use ezspline_obj
254  type(EZspline3_r4) spline_o
255  real(ezspline_r4), dimension(:,:,:), intent(in) :: f
256  integer, intent(out) :: ier
257  logical, intent(in), optional :: exact_dim
258  end subroutine ezspline_setup3_r4
259 
260  subroutine ezspline_setup2_r4(spline_o, f, ier, exact_dim)
261  use ezspline_obj
262  type(EZspline2_r4) spline_o
263  real(ezspline_r4), dimension(:,:), intent(in) :: f
264  integer, intent(out) :: ier
265  logical, intent(in), optional :: exact_dim
266  end subroutine ezspline_setup2_r4
267 
268  subroutine ezspline_setup1_r4(spline_o, f, ier, exact_dim)
269  use ezspline_obj
270  type(EZspline1_r4) spline_o
271  real(ezspline_r4), dimension(:), intent(in) :: f
272  integer, intent(out) :: ier
273  logical, intent(in), optional :: exact_dim
274  end subroutine ezspline_setup1_r4
275 
276  end interface
277 
278 
279 
280  interface ezspline_interp
281  !
282  ! Interpolation at grid point(s) p1, [p2, [p3]]. Result is returned in
283  ! f. Interpolation can be sought at a single point (p1, [p2, [p3]] are
284  ! scalars), on an unordered list of points (p1, [p2, [p3]] have dimension
285  ! k), or on a structured grid (p1, [p2, [p3]] have dimension k1, [k2, [k3]]
286  ! respectively).
287  !
288  subroutine ezspline_interp3_r8(spline_o, p1, p2, p3, f, ier)
289  ! single point evaluation
290  use ezspline_obj
291  type(EZspline3_r8) spline_o
292  real(ezspline_r8) :: p1, p2, p3
293  real(ezspline_r8) f
294  integer, intent(out) :: ier
295  end subroutine ezspline_interp3_r8
296 
297  subroutine ezspline_interp3_array_r8(spline_o, k1, k2, k3, p1, p2, p3, f, ier)
298  use ezspline_obj
299  type(EZspline3_r8) spline_o
300  integer :: k1, k2, k3
301  real(ezspline_r8), intent(in) :: p1(k1), p2(k2), p3(k3)
302  real(ezspline_r8), intent(out):: f(k1,k2,*)
303  integer, intent(out) :: ier
304  end subroutine ezspline_interp3_array_r8
305 
306  subroutine ezspline_interp3_cloud_r8(spline_o, k, p1, p2, p3, f, ier)
307  use ezspline_obj
308  type(EZspline3_r8) spline_o
309  integer, intent(in) :: k
310  real(ezspline_r8), intent(in) :: p1(k), p2(k), p3(k)
311  real(ezspline_r8), intent(out):: f(k)
312  integer, intent(out) :: ier
313  end subroutine ezspline_interp3_cloud_r8
314 
315  subroutine ezspline_interp2_r8(spline_o, p1, p2, f, ier)
316  use ezspline_obj
317  type(EZspline2_r8) spline_o
318  real(ezspline_r8) :: p1, p2
319  real(ezspline_r8) f
320  integer, intent(out) :: ier
321  end subroutine ezspline_interp2_r8
322 
323  subroutine ezspline_interp2_array_r8(spline_o, k1, k2, p1, p2, f, ier)
324  use ezspline_obj
325  type(EZspline2_r8) spline_o
326  integer :: k1, k2
327  real(ezspline_r8), intent(in) :: p1(k1), p2(k2)
328  real(ezspline_r8), intent(out):: f(k1,*)
329  integer, intent(out) :: ier
330  end subroutine ezspline_interp2_array_r8
331 
332  subroutine ezspline_interp2_cloud_r8(spline_o, k, p1, p2, f, ier)
333  use ezspline_obj
334  type(EZspline2_r8) spline_o
335  integer, intent(in) :: k
336  real(ezspline_r8), intent(in) :: p1(k), p2(k)
337  real(ezspline_r8), intent(out):: f(k)
338  integer, intent(out) :: ier
339  end subroutine ezspline_interp2_cloud_r8
340 
341  subroutine ezspline_interp1_r8(spline_o, p1, f, ier)
342  use ezspline_obj
343  type(EZspline1_r8) spline_o
344  real(ezspline_r8) :: p1
345  real(ezspline_r8) f
346  integer, intent(out) :: ier
347  end subroutine ezspline_interp1_r8
348 
349  subroutine ezspline_interp1_array_r8(spline_o, k1, p1, f, ier)
350  use ezspline_obj
351  type(EZspline1_r8) spline_o
352  integer :: k1
353  real(ezspline_r8), intent(in) :: p1(k1)
354  real(ezspline_r8), intent(out):: f(k1)
355  integer, intent(out) :: ier
356  end subroutine ezspline_interp1_array_r8
357 
358  subroutine ezspline_interp3_r4(spline_o, p1, p2, p3, f, ier)
359  ! single point evaluation
360  use ezspline_obj
361  type(EZspline3_r4) spline_o
362  real(ezspline_r4) :: p1, p2, p3
363  real(ezspline_r4) f
364  integer, intent(out) :: ier
365  end subroutine ezspline_interp3_r4
366 
367  subroutine ezspline_interp3_array_r4(spline_o, k1, k2, k3, p1, p2, p3, f, ier)
368  use ezspline_obj
369  type(EZspline3_r4) spline_o
370  integer :: k1, k2, k3
371  real(ezspline_r4), intent(in) :: p1(k1), p2(k2), p3(k3)
372  real(ezspline_r4), intent(out):: f(k1,k2,*)
373  integer, intent(out) :: ier
374  end subroutine ezspline_interp3_array_r4
375 
376  subroutine ezspline_interp3_cloud_r4(spline_o, k, p1, p2, p3, f, ier)
377  use ezspline_obj
378  type(EZspline3_r4) spline_o
379  integer, intent(in) :: k
380  real(ezspline_r4), intent(in) :: p1(k), p2(k), p3(k)
381  real(ezspline_r4), intent(out):: f(k)
382  integer, intent(out) :: ier
383  end subroutine ezspline_interp3_cloud_r4
384 
385  subroutine ezspline_interp2_r4(spline_o, p1, p2, f, ier)
386  use ezspline_obj
387  type(EZspline2_r4) spline_o
388  real(ezspline_r4) :: p1, p2
389  real(ezspline_r4) f
390  integer, intent(out) :: ier
391  end subroutine ezspline_interp2_r4
392 
393  subroutine ezspline_interp2_array_r4(spline_o, k1, k2, p1, p2, f, ier)
394  use ezspline_obj
395  type(EZspline2_r4) spline_o
396  integer :: k1, k2
397  real(ezspline_r4), intent(in) :: p1(k1), p2(k2)
398  real(ezspline_r4), intent(out):: f(k1,*)
399  integer, intent(out) :: ier
400  end subroutine ezspline_interp2_array_r4
401 
402  subroutine ezspline_interp2_cloud_r4(spline_o, k, p1, p2, f, ier)
403  use ezspline_obj
404  type(EZspline2_r4) spline_o
405  integer, intent(in) :: k
406  real(ezspline_r4), intent(in) :: p1(k), p2(k)
407  real(ezspline_r4), intent(out):: f(k)
408  integer, intent(out) :: ier
409  end subroutine ezspline_interp2_cloud_r4
410 
411  subroutine ezspline_interp1_r4(spline_o, p1, f, ier)
412  use ezspline_obj
413  type(EZspline1_r4) spline_o
414  real(ezspline_r4) :: p1
415  real(ezspline_r4) f
416  integer, intent(out) :: ier
417  end subroutine ezspline_interp1_r4
418 
419  subroutine ezspline_interp1_array_r4(spline_o, k1, p1, f, ier)
420  use ezspline_obj
421  type(EZspline1_r4) spline_o
422  integer :: k1
423  real(ezspline_r4), intent(in) :: p1(k1)
424  real(ezspline_r4), intent(out):: f(k1)
425  integer, intent(out) :: ier
426  end subroutine ezspline_interp1_array_r4
427 
428  end interface
429 
431  !
432  ! Evaluate the spline/Akima Hermite derivative of order
433  ! d^{i1} d^{i2} d^{i3} f / d x1^{i1} d x2^{i2} d x2^{i2}
434  ! at p1, [p2, [p3]]. The sum of i1+[i2+[i3]] should be <=2 for spline, or
435  ! <=1 for Akima Hermite or Piecewise Linear.
436  ! Result is return in f. The evaluation can
437  ! be sought at a single point (p1, [p2, [p3]] are scalars), on
438  ! an unordered list of points (p1, [p2, [p3]] have dimension k), or
439  ! on a structured grid (p1, [p2, [p3]] have dimension k1, [k2, [k3]]
440  ! respectively).
441  !
442  !
443  subroutine ezspline_derivative3_r8(spline_o, i1, i2, i3, p1, p2, p3, f, ier)
444  use ezspline_obj
445  type(EZspline3_r8) spline_o
446  integer, intent(in) :: i1, i2, i3
447  real(ezspline_r8), intent(in) :: p1, p2, p3
448  real(ezspline_r8), intent(out) :: f
449  integer, intent(out) :: ier
450  end subroutine ezspline_derivative3_r8
451 
452  subroutine ezspline_derivative3_array_r8(spline_o, i1, i2, i3, &
453  & k1, k2, k3, p1, p2, p3, f, ier)
454  use ezspline_obj
455  type(EZspline3_r8) spline_o
456  integer, intent(in) :: i1, i2, i3, k1, k2, k3
457  real(ezspline_r8), intent(in) :: p1(k1), p2(k2), p3(k3)
458  real(ezspline_r8), intent(out) :: f(k1, k2, *)
459  integer, intent(out) :: ier
460  end subroutine ezspline_derivative3_array_r8
461 
462  subroutine ezspline_derivative3_cloud_r8(spline_o, i1, i2, i3, &
463  & k, p1, p2, p3, f, ier)
464  use ezspline_obj
465  type(EZspline3_r8) spline_o
466  integer, intent(in) :: i1, i2, i3, k
467  real(ezspline_r8), intent(in) :: p1(k), p2(k), p3(k)
468  real(ezspline_r8), intent(out) :: f(k)
469  integer, intent(out) :: ier
470  end subroutine ezspline_derivative3_cloud_r8
471 
472  subroutine ezspline_derivative2_r8(spline_o, i1, i2, p1, p2, f, ier)
473  use ezspline_obj
474  type(EZspline2_r8) spline_o
475  integer, intent(in) :: i1, i2
476  real(ezspline_r8), intent(in) :: p1, p2
477  real(ezspline_r8), intent(out) :: f
478  integer, intent(out) :: ier
479  end subroutine ezspline_derivative2_r8
480 
481  subroutine ezspline_derivative2_array_r8(spline_o, i1, i2, k1, k2, p1, p2, f, ier)
482  use ezspline_obj
483  type(EZspline2_r8) spline_o
484  integer, intent(in) :: i1, i2, k1, k2
485  real(ezspline_r8), intent(in) :: p1(k1), p2(k2)
486  real(ezspline_r8), intent(out) :: f(k1,k2)
487  integer, intent(out) :: ier
488  end subroutine ezspline_derivative2_array_r8
489 
490  subroutine ezspline_derivative2_cloud_r8(spline_o, i1, i2, k, p1, p2, f, ier)
491  use ezspline_obj
492  type(EZspline2_r8) spline_o
493  integer, intent(in) :: i1, i2, k
494  real(ezspline_r8), intent(in) :: p1(k), p2(k)
495  real(ezspline_r8), intent(out) :: f(k)
496  integer, intent(out) :: ier
497  end subroutine ezspline_derivative2_cloud_r8
498 
499  subroutine ezspline_derivative1_r8(spline_o, i1, p1, f, ier)
500  use ezspline_obj
501  type(EZspline1_r8) spline_o
502  integer, intent(in) :: i1
503  real(ezspline_r8), intent(in) :: p1
504  real(ezspline_r8), intent(out) :: f
505  integer, intent(out) :: ier
506  end subroutine ezspline_derivative1_r8
507 
508  subroutine ezspline_derivative1_array_r8(spline_o, i1, k1, p1, f, ier)
509  use ezspline_obj
510  type(EZspline1_r8) spline_o
511  integer, intent(in) :: i1, k1
512  real(ezspline_r8), intent(in) :: p1(k1)
513  real(ezspline_r8), intent(out) :: f(k1)
514  integer, intent(out) :: ier
515  end subroutine ezspline_derivative1_array_r8
516 
517  subroutine ezspline_derivative3_r4(spline_o, i1, i2, i3, p1, p2, p3, f, ier)
518  use ezspline_obj
519  type(EZspline3_r4) spline_o
520  integer, intent(in) :: i1, i2, i3
521  real(ezspline_r4), intent(in) :: p1, p2, p3
522  real(ezspline_r4), intent(out) :: f
523  integer, intent(out) :: ier
524  end subroutine ezspline_derivative3_r4
525 
526  subroutine ezspline_derivative3_array_r4(spline_o, i1, i2, i3, &
527  & k1, k2, k3, p1, p2, p3, f, ier)
528  use ezspline_obj
529  type(EZspline3_r4) spline_o
530  integer, intent(in) :: i1, i2, i3, k1, k2, k3
531  real(ezspline_r4), intent(in) :: p1(k1), p2(k2), p3(k3)
532  real(ezspline_r4), intent(out) :: f(k1, k2, *)
533  integer, intent(out) :: ier
534  end subroutine ezspline_derivative3_array_r4
535 
536  subroutine ezspline_derivative3_cloud_r4(spline_o, i1, i2, i3, &
537  & k, p1, p2, p3, f, ier)
538  use ezspline_obj
539  type(EZspline3_r4) spline_o
540  integer, intent(in) :: i1, i2, i3, k
541  real(ezspline_r4), intent(in) :: p1(k), p2(k), p3(k)
542  real(ezspline_r4), intent(out) :: f(k)
543  integer, intent(out) :: ier
544  end subroutine ezspline_derivative3_cloud_r4
545 
546  subroutine ezspline_derivative2_r4(spline_o, i1, i2, p1, p2, f, ier)
547  use ezspline_obj
548  type(EZspline2_r4) spline_o
549  integer, intent(in) :: i1, i2
550  real(ezspline_r4), intent(in) :: p1, p2
551  real(ezspline_r4), intent(out) :: f
552  integer, intent(out) :: ier
553  end subroutine ezspline_derivative2_r4
554 
555  subroutine ezspline_derivative2_array_r4(spline_o, i1, i2, k1, k2, p1, p2, f, ier)
556  use ezspline_obj
557  type(EZspline2_r4) spline_o
558  integer, intent(in) :: i1, i2, k1, k2
559  real(ezspline_r4), intent(in) :: p1(k1), p2(k2)
560  real(ezspline_r4), intent(out) :: f(k1,k2)
561  integer, intent(out) :: ier
562  end subroutine ezspline_derivative2_array_r4
563 
564  subroutine ezspline_derivative2_cloud_r4(spline_o, i1, i2, k, p1, p2, f, ier)
565  use ezspline_obj
566  type(EZspline2_r4) spline_o
567  integer, intent(in) :: i1, i2, k
568  real(ezspline_r4), intent(in) :: p1(k), p2(k)
569  real(ezspline_r4), intent(out) :: f(k)
570  integer, intent(out) :: ier
571  end subroutine ezspline_derivative2_cloud_r4
572 
573  subroutine ezspline_derivative1_r4(spline_o, i1, p1, f, ier)
574  use ezspline_obj
575  type(EZspline1_r4) spline_o
576  integer, intent(in) :: i1
577  real(ezspline_r4), intent(in) :: p1
578  real(ezspline_r4), intent(out) :: f
579  integer, intent(out) :: ier
580  end subroutine ezspline_derivative1_r4
581 
582  subroutine ezspline_derivative1_array_r4(spline_o, i1, k1, p1, f, ier)
583  use ezspline_obj
584  type(EZspline1_r4) spline_o
585  integer, intent(in) :: i1, k1
586  real(ezspline_r4), intent(in) :: p1(k1)
587  real(ezspline_r4), intent(out) :: f(k1)
588  integer, intent(out) :: ier
589  end subroutine ezspline_derivative1_array_r4
590 
591  end interface
592 
594  !
595  ! Return the gradient in df. When the dimensionality is 1 then
596  ! df is df/dx. In more than one dimension, df has rank >=1 with
597  ! the last index yielding df/dx, df/dy ... etc. Subsequent indices
598  ! reflect the node positions when cloud or array evaluation is
599  ! sought, as in df(k1, k2, k3, 1) for df/dx at x(k1), y(k2), z(k3).
600  !
601  subroutine ezspline_gradient3_r8(spline_o, p1, p2, p3, df, ier)
602  use ezspline_obj
603  type(EZspline3_r8) spline_o
604  real(ezspline_r8), intent(in) :: p1, p2, p3
605  real(ezspline_r8), intent(out) :: df(3)
606  integer, intent(out) :: ier
607  end subroutine ezspline_gradient3_r8
608 
609  subroutine ezspline_gradient3_array_r8(spline_o, k1, k2, k3, &
610  & p1, p2, p3, df, ier)
611  use ezspline_obj
612  type(EZspline3_r8) spline_o
613  integer, intent(in) :: k1, k2, k3
614  real(ezspline_r8), intent(in) :: p1(k1), p2(k2), p3(k3)
615  real(ezspline_r8), intent(out) :: df(k1,k2,k3,3)
616  integer, intent(out) :: ier
617  end subroutine ezspline_gradient3_array_r8
618 
619  subroutine ezspline_gradient3_cloud_r8(spline_o, k, &
620  & p1, p2, p3, df, ier)
621  use ezspline_obj
622  type(EZspline3_r8) spline_o
623  integer, intent(in) :: k
624  real(ezspline_r8), intent(in) :: p1(k), p2(k), p3(k)
625  real(ezspline_r8), intent(out) :: df(k,3)
626  integer, intent(out) :: ier
627  end subroutine ezspline_gradient3_cloud_r8
628 
629  subroutine ezspline_gradient2_r8(spline_o, p1, p2, df, ier)
630  use ezspline_obj
631  type(EZspline2_r8) spline_o
632  real(ezspline_r8), intent(in) :: p1, p2
633  real(ezspline_r8), intent(out) :: df(2)
634  integer, intent(out) :: ier
635  end subroutine ezspline_gradient2_r8
636 
637  subroutine ezspline_gradient2_array_r8(spline_o, k1, k2, &
638  & p1, p2, df, ier)
639  use ezspline_obj
640  type(EZspline2_r8) spline_o
641  integer, intent(in) :: k1, k2
642  real(ezspline_r8), intent(in) :: p1(k1), p2(k2)
643  real(ezspline_r8), intent(out) :: df(k1, k2, 2)
644  integer, intent(out) :: ier
645  end subroutine ezspline_gradient2_array_r8
646 
647  subroutine ezspline_gradient2_cloud_r8(spline_o, k, &
648  & p1, p2, df, ier)
649  use ezspline_obj
650  type(EZspline2_r8) spline_o
651  integer, intent(in) :: k
652  real(ezspline_r8), intent(in) :: p1(k), p2(k)
653  real(ezspline_r8), intent(out) :: df(k, 2)
654  integer, intent(out) :: ier
655  end subroutine ezspline_gradient2_cloud_r8
656 
657  subroutine ezspline_gradient1_r8(spline_o, p1, df, ier)
658  use ezspline_obj
659  type(EZspline1_r8) spline_o
660  real(ezspline_r8), intent(in) :: p1
661  real(ezspline_r8), intent(out) :: df
662  integer, intent(out) :: ier
663  end subroutine ezspline_gradient1_r8
664 
665  subroutine ezspline_gradient1_array_r8(spline_o, k1, p1, df, ier)
666  use ezspline_obj
667  type(EZspline1_r8) spline_o
668  integer, intent(in) :: k1
669  real(ezspline_r8), intent(in) :: p1(k1)
670  real(ezspline_r8), intent(out) :: df(k1)
671  integer, intent(out) :: ier
672  end subroutine ezspline_gradient1_array_r8
673 
674  subroutine ezspline_gradient3_r4(spline_o, p1, p2, p3, df, ier)
675  use ezspline_obj
676  type(EZspline3_r4) spline_o
677  real(ezspline_r4), intent(in) :: p1, p2, p3
678  real(ezspline_r4), intent(out) :: df(3)
679  integer, intent(out) :: ier
680  end subroutine ezspline_gradient3_r4
681 
682  subroutine ezspline_gradient3_array_r4(spline_o, k1, k2, k3, &
683  & p1, p2, p3, df, ier)
684  use ezspline_obj
685  type(EZspline3_r4) spline_o
686  integer, intent(in) :: k1, k2, k3
687  real(ezspline_r4), intent(in) :: p1(k1), p2(k2), p3(k3)
688  real(ezspline_r4), intent(out) :: df(k1,k2,k3,3)
689  integer, intent(out) :: ier
690  end subroutine ezspline_gradient3_array_r4
691 
692  subroutine ezspline_gradient3_cloud_r4(spline_o, k, &
693  & p1, p2, p3, df, ier)
694  use ezspline_obj
695  type(EZspline3_r4) spline_o
696  integer, intent(in) :: k
697  real(ezspline_r4), intent(in) :: p1(k), p2(k), p3(k)
698  real(ezspline_r4), intent(out) :: df(k,3)
699  integer, intent(out) :: ier
700  end subroutine ezspline_gradient3_cloud_r4
701 
702  subroutine ezspline_gradient2_r4(spline_o, p1, p2, df, ier)
703  use ezspline_obj
704  type(EZspline2_r4) spline_o
705  real(ezspline_r4), intent(in) :: p1, p2
706  real(ezspline_r4), intent(out) :: df(2)
707  integer, intent(out) :: ier
708  end subroutine ezspline_gradient2_r4
709 
710  subroutine ezspline_gradient2_array_r4(spline_o, k1, k2, &
711  & p1, p2, df, ier)
712  use ezspline_obj
713  type(EZspline2_r4) spline_o
714  integer, intent(in) :: k1, k2
715  real(ezspline_r4), intent(in) :: p1(k1), p2(k2)
716  real(ezspline_r4), intent(out) :: df(k1, k2, 2)
717  integer, intent(out) :: ier
718  end subroutine ezspline_gradient2_array_r4
719 
720  subroutine ezspline_gradient2_cloud_r4(spline_o, k, &
721  & p1, p2, df, ier)
722  use ezspline_obj
723  type(EZspline2_r4) spline_o
724  integer, intent(in) :: k
725  real(ezspline_r4), intent(in) :: p1(k), p2(k)
726  real(ezspline_r4), intent(out) :: df(k, 2)
727  integer, intent(out) :: ier
728  end subroutine ezspline_gradient2_cloud_r4
729 
730  subroutine ezspline_gradient1_r4(spline_o, p1, df, ier)
731  use ezspline_obj
732  type(EZspline1_r4) spline_o
733  real(ezspline_r4), intent(in) :: p1
734  real(ezspline_r4), intent(out) :: df
735  integer, intent(out) :: ier
736  end subroutine ezspline_gradient1_r4
737 
738  subroutine ezspline_gradient1_array_r4(spline_o, k1, p1, df, ier)
739  use ezspline_obj
740  type(EZspline1_r4) spline_o
741  integer, intent(in) :: k1
742  real(ezspline_r4), intent(in) :: p1(k1)
743  real(ezspline_r4), intent(out) :: df(k1)
744  integer, intent(out) :: ier
745  end subroutine ezspline_gradient1_array_r4
746 
747  end interface
748 
750  !
751  ! Return error code if position (p1, [p2, [p3]]) is outside domain.
752  ! The evaluation can be sought at a single point (p1, [p2, [p3]]
753  ! are scalars), on an unordered list of points (p1, [p2, [p3]] have
754  ! dimension k), or on a structured grid (p1, [p2, [p3]] have dimension
755  ! k1, [k2, [k3]] respectively).
756  !
757  subroutine ezspline_isindomain3_r8(spline_o, p1, p2, p3, ier)
758  use ezspline_obj
759  type(EZspline3_r8) :: spline_o
760  real(ezspline_r8), intent(in) :: p1, p2, p3
761  integer, intent(out) :: ier
762  end subroutine ezspline_isindomain3_r8
763 
764  subroutine ezspline_isindomain3_array_r8(spline_o, k1, k2, k3, p1, p2, p3, ier)
765  use ezspline_obj
766  type(EZspline3_r8) :: spline_o
767  integer, intent(in) :: k1, k2, k3
768  real(ezspline_r8), intent(in) :: p1(k1), p2(k2), p3(k3)
769  integer, intent(out) :: ier
770  end subroutine ezspline_isindomain3_array_r8
771 
772  subroutine ezspline_isindomain3_cloud_r8(spline_o, k, p1, p2, p3, ier)
773  use ezspline_obj
774  type(EZspline3_r8) :: spline_o
775  integer, intent(in) :: k
776  real(ezspline_r8), intent(in) :: p1(k), p2(k), p3(k)
777  integer, intent(out) :: ier
778  end subroutine ezspline_isindomain3_cloud_r8
779 
780  subroutine ezspline_isindomain2_r8(spline_o, p1, p2, ier)
781  use ezspline_obj
782  type(EZspline2_r8) :: spline_o
783  real(ezspline_r8), intent(in) :: p1, p2
784  integer, intent(out) :: ier
785  end subroutine ezspline_isindomain2_r8
786 
787  subroutine ezspline_isindomain2_array_r8(spline_o, k1, k2, p1, p2, ier)
788  use ezspline_obj
789  type(EZspline2_r8) :: spline_o
790  integer, intent(in) :: k1, k2
791  real(ezspline_r8), intent(in) :: p1(k1), p2(k2)
792  integer, intent(out) :: ier
793  end subroutine ezspline_isindomain2_array_r8
794 
795  subroutine ezspline_isindomain2_cloud_r8(spline_o, k, p1, p2, ier)
796  use ezspline_obj
797  type(EZspline2_r8) :: spline_o
798  integer, intent(in) :: k
799  real(ezspline_r8), intent(in) :: p1(k), p2(k)
800  integer, intent(out) :: ier
801  end subroutine ezspline_isindomain2_cloud_r8
802 
803  subroutine ezspline_isindomain1_r8(spline_o, p1, ier)
804  use ezspline_obj
805  type(EZspline1_r8) :: spline_o
806  real(ezspline_r8), intent(in) :: p1
807  integer, intent(out) :: ier
808  end subroutine ezspline_isindomain1_r8
809 
810  subroutine ezspline_isindomain1_array_r8(spline_o, k1, p1, ier)
811  use ezspline_obj
812  type(EZspline1_r8) :: spline_o
813  integer, intent(in) :: k1
814  real(ezspline_r8), intent(in) :: p1(k1)
815  integer, intent(out) :: ier
816  end subroutine ezspline_isindomain1_array_r8
817 
818  subroutine ezspline_isindomain3_r4(spline_o, p1, p2, p3, ier)
819  use ezspline_obj
820  type(EZspline3_r4) :: spline_o
821  real(ezspline_r4), intent(in) :: p1, p2, p3
822  integer, intent(out) :: ier
823  end subroutine ezspline_isindomain3_r4
824 
825  subroutine ezspline_isindomain3_array_r4(spline_o, k1, k2, k3, p1, p2, p3, ier)
826  use ezspline_obj
827  type(EZspline3_r4) :: spline_o
828  integer, intent(in) :: k1, k2, k3
829  real(ezspline_r4), intent(in) :: p1(k1), p2(k2), p3(k3)
830  integer, intent(out) :: ier
831  end subroutine ezspline_isindomain3_array_r4
832 
833  subroutine ezspline_isindomain3_cloud_r4(spline_o, k, p1, p2, p3, ier)
834  use ezspline_obj
835  type(EZspline3_r4) :: spline_o
836  integer, intent(in) :: k
837  real(ezspline_r4), intent(in) :: p1(k), p2(k), p3(k)
838  integer, intent(out) :: ier
839  end subroutine ezspline_isindomain3_cloud_r4
840 
841  subroutine ezspline_isindomain2_r4(spline_o, p1, p2, ier)
842  use ezspline_obj
843  type(EZspline2_r4) :: spline_o
844  real(ezspline_r4), intent(in) :: p1, p2
845  integer, intent(out) :: ier
846  end subroutine ezspline_isindomain2_r4
847 
848  subroutine ezspline_isindomain2_array_r4(spline_o, k1, k2, p1, p2, ier)
849  use ezspline_obj
850  type(EZspline2_r4) :: spline_o
851  integer, intent(in) :: k1, k2
852  real(ezspline_r4), intent(in) :: p1(k1), p2(k2)
853  integer, intent(out) :: ier
854  end subroutine ezspline_isindomain2_array_r4
855 
856  subroutine ezspline_isindomain2_cloud_r4(spline_o, k, p1, p2, ier)
857  use ezspline_obj
858  type(EZspline2_r4) :: spline_o
859  integer, intent(in) :: k
860  real(ezspline_r4), intent(in) :: p1(k), p2(k)
861  integer, intent(out) :: ier
862  end subroutine ezspline_isindomain2_cloud_r4
863 
864  subroutine ezspline_isindomain1_r4(spline_o, p1, ier)
865  use ezspline_obj
866  type(EZspline1_r4) :: spline_o
867  real(ezspline_r4), intent(in) :: p1
868  integer, intent(out) :: ier
869  end subroutine ezspline_isindomain1_r4
870 
871  subroutine ezspline_isindomain1_array_r4(spline_o, k1, p1, ier)
872  use ezspline_obj
873  type(EZspline1_r4) :: spline_o
874  integer, intent(in) :: k1
875  real(ezspline_r4), intent(in) :: p1(k1)
876  integer, intent(out) :: ier
877  end subroutine ezspline_isindomain1_array_r4
878 
879  end interface
880 
882  !
883  ! Return error code if grid is not regular (not strictly increasing).
884  ! The evaluation can be sought at a single point (p1, [p2, [p3]]
885  ! are scalars), on an unordered list of points (p1, [p2, [p3]] have
886  ! dimension k), or on a structured grid (p1, [p2, [p3]] have dimension
887  ! k1, [k2, [k3]] respectively).
888  !
889  subroutine ezspline_isgridregular3_r8(spline_o, ier)
890  use ezspline_obj
891  type(EZspline3_r8) :: spline_o
892  integer, intent(out) :: ier
893  end subroutine ezspline_isgridregular3_r8
894 
895  subroutine ezspline_isgridregular2_r8(spline_o, ier)
896  use ezspline_obj
897  type(EZspline2_r8) :: spline_o
898  integer, intent(out) :: ier
899  end subroutine ezspline_isgridregular2_r8
900 
901  subroutine ezspline_isgridregular1_r8(spline_o, ier)
902  use ezspline_obj
903  type(EZspline1_r8) :: spline_o
904  integer, intent(out) :: ier
905  end subroutine ezspline_isgridregular1_r8
906 
907  subroutine ezspline_isgridregular3_r4(spline_o, ier)
908  use ezspline_obj
909  type(EZspline3_r4) :: spline_o
910  integer, intent(out) :: ier
911  end subroutine ezspline_isgridregular3_r4
912 
913  subroutine ezspline_isgridregular2_r4(spline_o, ier)
914  use ezspline_obj
915  type(EZspline2_r4) :: spline_o
916  integer, intent(out) :: ier
917  end subroutine ezspline_isgridregular2_r4
918 
919  subroutine ezspline_isgridregular1_r4(spline_o, ier)
920  use ezspline_obj
921  type(EZspline1_r4) :: spline_o
922  integer, intent(out) :: ier
923  end subroutine ezspline_isgridregular1_r4
924 
925  end interface
926 
927  interface ezspline_save
928  !
929  ! Save spline/Akima Hermite/Linear object in netcdf file 'filename'. Use
930  ! EZspline_load to load spline/Akima Hermite/Linear object from netcdf
931  ! file.
932  !
933  ! Mod DMC March 2006 -- optionally, by giving each spline a name,
934  ! multiple splines can be saved in a single file. Also, by specifying
935  ! "fullsave=.TRUE." the spline coefficients can be saved as well in the
936  ! file, so that they do not have to be recomputed at ezspline_load time.
937  !
938  ! When creating a single file with multiple spline objects, it is the
939  ! user's responsibilitly to make sure that a different name is used for
940  ! each spline that is to be saved. Names can consist of upper or lower
941  ! case letters, numerals, and "_", but must not start with a numeral.
942  ! Imbedded blanks are not allowed, and the length of the name must be
943  ! no more than 20 characters long-- to allow the names of the spline
944  ! object elements to be appended.
945  !
946  subroutine ezspline_save3_r8(spline_o, filename, ier, &
947  spl_name,fullsave)
948  use ezspline_obj
949  use ezcdf
950  type(EZspline3_r8) :: spline_o
951  character*(*) :: filename
952  integer, intent(out) :: ier
953 
954  character*(*), intent(in),optional :: spl_name
955  logical, intent(in), optional :: fullsave
956 
957  end subroutine ezspline_save3_r8
958 
959  subroutine ezspline_save2_r8(spline_o, filename, ier, &
960  spl_name,fullsave)
961  use ezspline_obj
962  use ezcdf
963  type(EZspline2_r8) :: spline_o
964  character*(*) :: filename
965  integer, intent(out) :: ier
966 
967  character*(*), intent(in),optional :: spl_name
968  logical, intent(in), optional :: fullsave
969 
970  end subroutine ezspline_save2_r8
971 
972  subroutine ezspline_save1_r8(spline_o, filename, ier, &
973  spl_name,fullsave)
974  use ezspline_obj
975  use ezcdf
976  type(EZspline1_r8) :: spline_o
977  character*(*) :: filename
978  integer, intent(out) :: ier
979 
980  character*(*), intent(in),optional :: spl_name
981  logical, intent(in), optional :: fullsave
982 
983  end subroutine ezspline_save1_r8
984 
985  subroutine ezspline_save3_r4(spline_o, filename, ier, &
986  spl_name,fullsave)
987  use ezspline_obj
988  use ezcdf
989  type(EZspline3_r4) :: spline_o
990  character*(*) :: filename
991  integer, intent(out) :: ier
992 
993  character*(*), intent(in),optional :: spl_name
994  logical, intent(in), optional :: fullsave
995 
996  end subroutine ezspline_save3_r4
997 
998  subroutine ezspline_save2_r4(spline_o, filename, ier, &
999  spl_name,fullsave)
1000  use ezspline_obj
1001  use ezcdf
1002  type(EZspline2_r4) :: spline_o
1003  character*(*) :: filename
1004  integer, intent(out) :: ier
1005 
1006  character*(*), intent(in),optional :: spl_name
1007  logical, intent(in), optional :: fullsave
1008 
1009  end subroutine ezspline_save2_r4
1010 
1011  subroutine ezspline_save1_r4(spline_o, filename, ier, &
1012  spl_name,fullsave)
1013  use ezspline_obj
1014  use ezcdf
1015  type(EZspline1_r4) :: spline_o
1016  character*(*) :: filename
1017  integer, intent(out) :: ier
1018 
1019  character*(*), intent(in),optional :: spl_name
1020  logical, intent(in), optional :: fullsave
1021 
1022  end subroutine ezspline_save1_r4
1023 
1024  end interface
1025 
1026  interface ezspline_load
1027  !
1028  ! Load spline/Akima Hermite object from netcdf file 'filename'. Use
1029  ! EZspline_save to save spline/Akima Hermite/Linear object in netcdf file.
1030  !
1031  ! MOD DMC March 2006-- a single NetCDF file can now contain multiple
1032  ! *named* spline objects. If accessing such an object, the name must
1033  ! be supplied via the optional argument "spl_name". If this is omitted,
1034  ! the default is to read the contents of the file which is presumed to
1035  ! consist of but a single spline object.
1036 
1037  ! Each call still opens and closes the file; if users find this
1038  ! inefficient, an improvement to the control interface may be built.
1039 
1040  subroutine ezspline_load3_r8(spline_o, filename, ier, spl_name)
1041  use ezspline_obj
1042  use ezcdf
1043  type(EZspline3_r8) :: spline_o
1044  character*(*) :: filename
1045  integer, intent(out) :: ier
1046 
1047  character*(*), intent(in),optional :: spl_name
1048  end subroutine ezspline_load3_r8
1049 
1050  subroutine ezspline_load2_r8(spline_o, filename, ier, spl_name)
1051  use ezspline_obj
1052  use ezcdf
1053  type(EZspline2_r8) :: spline_o
1054  character*(*) :: filename
1055  integer, intent(out) :: ier
1056 
1057  character*(*), intent(in),optional :: spl_name
1058  end subroutine ezspline_load2_r8
1059 
1060  subroutine ezspline_load1_r8(spline_o, filename, ier, spl_name)
1061  use ezspline_obj
1062  use ezcdf
1063  type(EZspline1_r8) :: spline_o
1064  character*(*) :: filename
1065  integer, intent(out) :: ier
1066 
1067  character*(*), intent(in),optional :: spl_name
1068  end subroutine ezspline_load1_r8
1069 
1070  subroutine ezspline_load3_r4(spline_o, filename, ier, spl_name)
1071  use ezspline_obj
1072  use ezcdf
1073  type(EZspline3_r4) :: spline_o
1074  character*(*) :: filename
1075  integer, intent(out) :: ier
1076 
1077  character*(*), intent(in),optional :: spl_name
1078  end subroutine ezspline_load3_r4
1079 
1080  subroutine ezspline_load2_r4(spline_o, filename, ier, spl_name)
1081  use ezspline_obj
1082  use ezcdf
1083  type(EZspline2_r4) :: spline_o
1084  character*(*) :: filename
1085  integer, intent(out) :: ier
1086 
1087  character*(*), intent(in),optional :: spl_name
1088  end subroutine ezspline_load2_r4
1089 
1090  subroutine ezspline_load1_r4(spline_o, filename, ier, spl_name)
1091  use ezspline_obj
1092  use ezcdf
1093  type(EZspline1_r4) :: spline_o
1094  character*(*) :: filename
1095  integer, intent(out) :: ier
1096 
1097  character*(*), intent(in),optional :: spl_name
1098  end subroutine ezspline_load1_r4
1099  end interface
1100 
1102  !
1103  ! Map argument to (x1,2,3min, x1,2,3max) interval. This is useful to avoid
1104  ! an out-of-grid error when periodic boundary conditions are applied.
1105  ! The evaluation can be sought at a single point (p1, [p2, [p3]]
1106  ! are scalars), on an unordered list of points (p1, [p2, [p3]] have
1107  ! dimension k), or on a structured grid (p1, [p2, [p3]] have dimension
1108  ! k1, [k2, [k3]] respectively).
1109  !
1110  subroutine ezspline_modulo3_r8(spline_o, p1, p2, p3, ier)
1111  use ezspline_obj
1112  type(EZspline3_r8) spline_o
1113  real(ezspline_r8) :: p1, p2, p3
1114  integer, intent(out) :: ier
1115  end subroutine ezspline_modulo3_r8
1116 
1117  subroutine ezspline_modulo_array3_r8(spline_o, k1, k2, k3, p1, p2, p3, ier)
1118  use ezspline_obj
1119  type(EZspline3_r8) spline_o
1120  integer, intent(in) :: k1, k2, k3
1121  real(ezspline_r8) :: p1(k1), p2(k2), p3(k3)
1122  integer, intent(out) :: ier
1123  end subroutine ezspline_modulo_array3_r8
1124 
1125  subroutine ezspline_modulo_cloud3_r8(spline_o, k, p1, p2, p3, ier)
1126  use ezspline_obj
1127  type(EZspline3_r8) spline_o
1128  integer, intent(in) :: k
1129  real(ezspline_r8) :: p1(k), p2(k), p3(k)
1130  integer, intent(out) :: ier
1131  end subroutine ezspline_modulo_cloud3_r8
1132 
1133  subroutine ezspline_modulo2_r8(spline_o, p1, p2, ier)
1134  use ezspline_obj
1135  type(EZspline2_r8) spline_o
1136  real(ezspline_r8) :: p1, p2
1137  integer, intent(out) :: ier
1138  end subroutine ezspline_modulo2_r8
1139 
1140  subroutine ezspline_modulo_array2_r8(spline_o, k1, k2, p1, p2, ier)
1141  use ezspline_obj
1142  type(EZspline2_r8) spline_o
1143  integer, intent(in) :: k1, k2
1144  real(ezspline_r8) :: p1(k1), p2(k2)
1145  integer, intent(out) :: ier
1146  end subroutine ezspline_modulo_array2_r8
1147 
1148  subroutine ezspline_modulo_cloud2_r8(spline_o, k, p1, p2, ier)
1149  use ezspline_obj
1150  type(EZspline2_r8) spline_o
1151  integer, intent(in) :: k
1152  real(ezspline_r8) :: p1(k), p2(k)
1153  integer, intent(out) :: ier
1154  end subroutine ezspline_modulo_cloud2_r8
1155 
1156  subroutine ezspline_modulo1_r8(spline_o, p1, ier)
1157  use ezspline_obj
1158  type(EZspline1_r8) spline_o
1159  real(ezspline_r8) :: p1
1160  integer, intent(out) :: ier
1161  end subroutine ezspline_modulo1_r8
1162 
1163  subroutine ezspline_modulo_array1_r8(spline_o, k1, p1, ier)
1164  use ezspline_obj
1165  type(EZspline3_r8) spline_o
1166  integer, intent(in) :: k1
1167  real(ezspline_r8) :: p1(k1)
1168  integer, intent(out) :: ier
1169  end subroutine ezspline_modulo_array1_r8
1170 
1171  subroutine ezspline_modulo3_r4(spline_o, p1, p2, p3, ier)
1172  use ezspline_obj
1173  type(EZspline3_r4) spline_o
1174  real(ezspline_r4) :: p1, p2, p3
1175  integer, intent(out) :: ier
1176  end subroutine ezspline_modulo3_r4
1177 
1178  subroutine ezspline_modulo_array3_r4(spline_o, k1, k2, k3, p1, p2, p3, ier)
1179  use ezspline_obj
1180  type(EZspline3_r4) spline_o
1181  integer, intent(in) :: k1, k2, k3
1182  real(ezspline_r4) :: p1(k1), p2(k2), p3(k3)
1183  integer, intent(out) :: ier
1184  end subroutine ezspline_modulo_array3_r4
1185 
1186  subroutine ezspline_modulo_cloud3_r4(spline_o, k, p1, p2, p3, ier)
1187  use ezspline_obj
1188  type(EZspline3_r4) spline_o
1189  integer, intent(in) :: k
1190  real(ezspline_r4) :: p1(k), p2(k), p3(k)
1191  integer, intent(out) :: ier
1192  end subroutine ezspline_modulo_cloud3_r4
1193 
1194  subroutine ezspline_modulo2_r4(spline_o, p1, p2, ier)
1195  use ezspline_obj
1196  type(EZspline2_r4) spline_o
1197  real(ezspline_r4) :: p1, p2
1198  integer, intent(out) :: ier
1199  end subroutine ezspline_modulo2_r4
1200 
1201  subroutine ezspline_modulo_array2_r4(spline_o, k1, k2, p1, p2, ier)
1202  use ezspline_obj
1203  type(EZspline2_r4) spline_o
1204  integer, intent(in) :: k1, k2
1205  real(ezspline_r4) :: p1(k1), p2(k2)
1206  integer, intent(out) :: ier
1207  end subroutine ezspline_modulo_array2_r4
1208 
1209  subroutine ezspline_modulo_cloud2_r4(spline_o, k, p1, p2, ier)
1210  use ezspline_obj
1211  type(EZspline2_r4) spline_o
1212  integer, intent(in) :: k
1213  real(ezspline_r4) :: p1(k), p2(k)
1214  integer, intent(out) :: ier
1215  end subroutine ezspline_modulo_cloud2_r4
1216 
1217  subroutine ezspline_modulo1_r4(spline_o, p1, ier)
1218  use ezspline_obj
1219  type(EZspline1_r4) spline_o
1220  real(ezspline_r4) :: p1
1221  integer, intent(out) :: ier
1222  end subroutine ezspline_modulo1_r4
1223 
1224  subroutine ezspline_modulo_array1_r4(spline_o, k1, p1, ier)
1225  use ezspline_obj
1226  type(EZspline3_r4) spline_o
1227  integer, intent(in) :: k1
1228  real(ezspline_r4) :: p1(k1)
1229  integer, intent(out) :: ier
1230  end subroutine ezspline_modulo_array1_r4
1231 
1232  end interface
1233 
1234 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1235 ! EZspline object-less methods (first argument is NOT an EZspline1,2,3 type).
1236 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1237 
1239  !
1240  ! Save data in netCDF file 'filename'. To save an EZspline1,2,3 object use
1241  ! EZspline_save method.
1242  !
1243  subroutine ezspline_2netcdf_array3_r8(n1, n2, n3, x1, x2, x3, f, filename, ier)
1244  use ezspline_obj
1245  use ezcdf
1246  implicit none
1247  integer, intent(in) :: n1, n2, n3
1248  real(ezspline_r8), intent(in) :: x1(:), x2(:), x3(:), f(:, :, :)
1249  character*(*), intent(in) :: filename
1250  integer, intent(out) :: ier
1251  end subroutine ezspline_2netcdf_array3_r8
1252 
1253  subroutine ezspline_2netcdf_array2_r8(n1, n2, x1, x2, f, filename, ier)
1254  use ezspline_obj
1255  use ezcdf
1256  implicit none
1257  integer, intent(in) :: n1, n2
1258  real(ezspline_r8), intent(in) :: x1(:), x2(:), f(:,:)
1259  character*(*), intent(in) :: filename
1260  integer, intent(out) :: ier
1261  end subroutine ezspline_2netcdf_array2_r8
1262 
1263  subroutine ezspline_2netcdf1_r8(n1, x1, f, filename, ier)
1264  use ezspline_obj
1265  use ezcdf
1266  implicit none
1267  integer, intent(in) :: n1
1268  real(ezspline_r8), intent(in) :: x1(:), f(:)
1269  character*(*), intent(in) :: filename
1270  integer, intent(out) :: ier
1271  end subroutine ezspline_2netcdf1_r8
1272 
1273  subroutine ezspline_2netcdf_cloud3_r8(n, x1, x2, x3, f, filename, ier)
1274  use ezspline_obj
1275  use ezcdf
1276  implicit none
1277  integer, intent(in) :: n
1278  real(ezspline_r8), intent(in) :: x1(:), x2(:), x3(:), f(:)
1279  character*(*), intent(in) :: filename
1280  integer, intent(out) :: ier
1281  end subroutine ezspline_2netcdf_cloud3_r8
1282 
1283  subroutine ezspline_2netcdf_cloud2_r8(n, x1, x2, f, filename, ier)
1284  use ezspline_obj
1285  use ezcdf
1286  implicit none
1287  integer, intent(in) :: n
1288  real(ezspline_r8), intent(in) :: x1(:), x2(:), f(:)
1289  character*(*), intent(in) :: filename
1290  integer, intent(out) :: ier
1291  end subroutine ezspline_2netcdf_cloud2_r8
1292 
1293  subroutine ezspline_2netcdf_array3_r4(n1, n2, n3, x1, x2, x3, f, filename, ier)
1294  use ezspline_obj
1295  use ezcdf
1296  implicit none
1297  integer, intent(in) :: n1, n2, n3
1298  real(ezspline_r4), intent(in) :: x1(:), x2(:), x3(:), f(:, :, :)
1299  character*(*), intent(in) :: filename
1300  integer, intent(out) :: ier
1301  end subroutine ezspline_2netcdf_array3_r4
1302 
1303  subroutine ezspline_2netcdf_array2_r4(n1, n2, x1, x2, f, filename, ier)
1304  use ezspline_obj
1305  use ezcdf
1306  implicit none
1307  integer, intent(in) :: n1, n2
1308  real(ezspline_r4), intent(in) :: x1(:), x2(:), f(:,:)
1309  character*(*), intent(in) :: filename
1310  integer, intent(out) :: ier
1311  end subroutine ezspline_2netcdf_array2_r4
1312 
1313  subroutine ezspline_2netcdf1_r4(n1, x1, f, filename, ier)
1314  use ezspline_obj
1315  use ezcdf
1316  implicit none
1317  integer, intent(in) :: n1
1318  real(ezspline_r4), intent(in) :: x1(:), f(:)
1319  character*(*), intent(in) :: filename
1320  integer, intent(out) :: ier
1321  end subroutine ezspline_2netcdf1_r4
1322 
1323  subroutine ezspline_2netcdf_cloud3_r4(n, x1, x2, x3, f, filename, ier)
1324  use ezspline_obj
1325  use ezcdf
1326  implicit none
1327  integer, intent(in) :: n
1328  real(ezspline_r4), intent(in) :: x1(:), x2(:), x3(:), f(:)
1329  character*(*), intent(in) :: filename
1330  integer, intent(out) :: ier
1331  end subroutine ezspline_2netcdf_cloud3_r4
1332 
1333  subroutine ezspline_2netcdf_cloud2_r4(n, x1, x2, f, filename, ier)
1334  use ezspline_obj
1335  use ezcdf
1336  implicit none
1337  integer, intent(in) :: n
1338  real(ezspline_r4), intent(in) :: x1(:), x2(:), f(:)
1339  character*(*), intent(in) :: filename
1340  integer, intent(out) :: ier
1341  end subroutine ezspline_2netcdf_cloud2_r4
1342 
1343  end interface
1344 
1345 
1346 contains
1347 
1348 
1349  subroutine ezspline_error(ier)
1350  !
1351  ! Error handling routine. Maps error ier code to a meaningful message.
1352  ! Note: does not abort nor stop if ier/=0.
1353  !
1354  implicit none
1355  integer, intent(in) :: ier
1356 
1357  if(ier == 0) return
1358  print*,'**EZspline** ERROR/WARNING #', ier,' occurred'
1359 
1360  select case(ier)
1361  case(1)
1362  print*,'**EZspline** allocation error'
1363  case(2)
1364  print*,'**EZspline** wrong BCS1 code'
1365  case(3)
1366  print*,'**EZspline** wrong BCS2 code'
1367  case(4)
1368  print*,'**EZspline** wrong BCS3 code'
1369  case(5)
1370  print*,'**EZspline** Que??'
1371  case(6)
1372  print*,'**EZspline** out of interval p1 < min(x1)'
1373  case(7)
1374  print*,'**EZspline** out of interval p1 > max(x1)'
1375  case(8)
1376  print*,'**EZspline** out of interval p2 < min(x2)'
1377  case(9)
1378  print*,'**EZspline** out of interval p2 > max(x2)'
1379  case(10)
1380  print*,'**EZspline** out of interval p3 < min(x3)'
1381  case(11)
1382  print*,'**EZspline** out of interval p3 > max(x3)'
1383  case(12)
1384  print*,'**EZspline** negative derivative order'
1385  case(13)
1386  print*,'**EZspline** derivative order too high'
1387  case(14)
1388  print*,'**EZspline** x1 grid is not strictly increasing'
1389  case(15)
1390  print*,'**EZspline** x2 grid is not strictly increasing'
1391  case(16)
1392  print*,'**EZspline** x3 grid is not strictly increasing'
1393  case(17)
1394  print*,'**EZspline** could not save spline object in file '
1395  case(18)
1396  print*,'**EZspline** memory allocation failure in coefficient setup'
1397 
1398  case(20)
1399  print*,'**EZspline** attempt to load spline object with wrong rank.'
1400  case(21)
1401  print*,'**EZspline** could not load spline object from file '
1402  case(22)
1403  print*,'**EZspline** loaded spline object from file but failed at coefficient set-up'
1404  case(23)
1405  print*,'**EZspline** failed to free spline object'
1406  case(24)
1407  print*,'**EZspline** 2nd order derivative not supported for Akima-Hermite (isHermite=1)'
1408  case(25)
1409  print*,'**EZspline** not supported for Akima-Hermite (isHermite=1)'
1410  case(26)
1411  print*,'**EZspline** memory allocation error in EZspline_interp'
1412  case(27)
1413  print*,'**EZspline** an error ocurred in genxpkg'
1414  case(28)
1415  print*,'**EZspline** memory allocation failure in ezspline_interp'
1416  case(29)
1417  print*,'**EZspline** memory deallocation failure in ezspline_interp'
1418  case(30)
1419  print*,'**EZspline** memory allocation error in EZspline_gradient'
1420  case(31)
1421  print*,'**EZspline** memory deallocation error in EZspline_gradient'
1422  case(32)
1423  print*,'**EZspline** memory allocation error in EZspline_derivative'
1424  case(33)
1425  print*,'**EZspline** memory deallocation error in EZspline_derivative'
1426  case(34)
1427  print*,'**EZspline** could not open netCDF file in EZspline_2netcdf'
1428  case(35)
1429  print*,'**EZspline** could not write into netCDF file in EZspline_2netcdf'
1430  case(36)
1431  print*,'**EZspline** could not read from netCDF file in EZspline_2netcdf'
1432  case(37)
1433  print*,'**EZspline** could not close netCDF file in EZspline_2netcdf'
1434  case(38)
1435  print*,'**EZspline** could not define variable (cdfDefVar) in EZspline_2netcdf'
1436  case(39)
1437  print*,'**EZspline** could not open netCDF file in EZspline_save'
1438  case(40)
1439  print*,'**EZspline** could not write into netCDF file in EZspline_save'
1440  case(41)
1441  print*,'**EZspline** could not close netCDF file in EZspline_save'
1442  case(42)
1443  print*,'**EZspline** could not define variable (cdfDefVar) in EZspline_save'
1444  case(43)
1445  print*,'**EZspline** could not open netCDF file in EZspline_load'
1446  case(44)
1447  print*,'**EZspline** could not read from netCDF file in EZspline_load'
1448  case(45)
1449  print*,'**EZspline** could not close netCDF file in EZspline_load'
1450  case(46)
1451  print*,'**EZspline** 2nd order derivative not supported for Piecewise Linear Interpolation (isLinear=1)'
1452  case(47)
1453  print*,'**EZspline** not supported for Piecewise Linear Interpolation (isLinear=1)'
1454 
1455  case(50)
1456  print*,'**EZspline** ezspline_save (optional) spline name is blank.'
1457  case(51)
1458  print*,'**EZspline** ezspline_save (optional) spline name too long (max 20 characters).'
1459  case(52)
1460  print*,'**EZspline** ezspline_save (optional) spline name contains'
1461  print*,' imbedded blanks or other illegal characters.'
1462  case(53)
1463  print*,'**EZspline** attempt to write named spline object to NetCDF'
1464  print*,' file with change of dimensionality or data type.'
1465 
1466  case(54)
1467  print*,'**EZspline** hybrid interpolation specification not in range -1:2'
1468  print*,' error in EZhybrid_init.'
1469  case(55)
1470  print*,'**EZspline** hybrid interpolation cannot mix Hermite and Spline interpolation.'
1471  print*,' hspline(i)=1 and hspline(j)=2 in EZhybrid_init.'
1472  case(56)
1473  print*,'**EZspline** non-default boundary condition unavailable: zonal or piecewise linear dimension.'
1474  print*,' in EZhybrid_init.'
1475 
1476  case(57)
1477  print*,'**EZspline** dimension of "f" smaller than corresponding "fspl"'
1478  print*,' dimension in "spline_o".'
1479  case(58)
1480  print*,'**EZspline** dimension of "f" larger than corresponding "fspl"'
1481  print*,' dimension in "spline_o".'
1482 
1483  case(90)
1484  print*,'**EZspline** an error occurred after attempting to evaluate the'
1485  print*,' Hermite polynomials'
1486  case(91)
1487  print*,'**EZspline** an error occurred after attempting to set up the'
1488  print*,' Hermite polynomial coefficients'
1489  case(92)
1490  print*,'**EZspline** warning in EZspline_load. Looks like saved object '
1491  print*,' was not properly set-up (isReady=0).'
1492  case(93)
1493  print*,'**EZspline** warning in EZspline_save. Looks like saved object '
1494  print*,' was not properly set-up (isReady=0).'
1495  case(94)
1496  print*,'**EZspline** an error occurred in EZspline_interp. Did you forget'
1497  print*,' to set up the cubic spline coefficients by calling'
1498  print*,' call EZspline_setup(spline_o, f, ier)'
1499  print*,' ?'
1500  case(95)
1501  print*,'**EZspline** some error occurred in EZspline_gradient'
1502  case(96)
1503  print*,'**EZspline** some error occurred in EZspline_derivative'
1504  case(97)
1505  print*,'**EZspline** some error occurred in EZspline_interp apparently'
1506  print*,' related to a PSPLINE routine. Check if argument is '
1507  print*,' outside interpolation domain by calling'
1508  print*,.OR.' call EZspline_isInDomain(spline_o, [[k1, k2, k3,] k,] p1, p2, p3, ier ,ier)'
1509  print*,' call EZspline_error(ier)'
1510  case(98)
1511  print*,'**EZspline** error occurred in EZspline_setup'
1512  print*,' if no other explanation-- ezspline_init call never made.'
1513  case(99)
1514  print*,'**EZspline** some error occurred in EZspline_init, EZhybrid_init, or EZlinear_init'
1515  case(100)
1516  print*,'**EZSPLINE** EZspline_init, EZhybrid_init, or EZlinear_init -- object already allocated.'
1517  case(101)
1518  print*,'**EZSPLINE** object was never allocated.'
1519  case default
1520  print*,'**EZspline** '
1521  end select
1522 
1523  return
1524  end subroutine ezspline_error
1525 
1526 end module ezspline
ezspline::ezspline_load
Definition: ezspline.f90:1026
ezspline::ezspline_derivative
Definition: ezspline.f90:430
ezspline::ezspline_setup
Definition: ezspline.f90:216
ezspline::ezspline_init
Definition: ezspline.f90:3
ezspline::ezhybrid_init
Definition: ezspline.f90:117
ezspline::ezlinear_init
Definition: ezspline.f90:64
ezspline::ezspline_2netcdf
Definition: ezspline.f90:1238
ezspline::ezspline_interp
Definition: ezspline.f90:280
ezspline::ezspline_isindomain
Definition: ezspline.f90:749
ezspline::ezspline_modulo
Definition: ezspline.f90:1101
ezspline::ezspline_gradient
Definition: ezspline.f90:593
ezspline::ezspline_isgridregular
Definition: ezspline.f90:881
ezspline::ezspline_free
Definition: ezspline.f90:174
ezspline::ezspline_save
Definition: ezspline.f90:927