V3FIT
ezspline_init.f90
1 !/////
2 ! R8 !
3 !/////
4 subroutine ezspline_init1_r8(spline_o, n1, BCS1, ier)
5  use ezspline_obj
6  implicit none
7  type(EZspline1_r8) spline_o
8  integer, intent(in) :: n1
9  integer, intent(in) :: BCS1(2)
10  ! ier:
11  ! 0=ok
12  ! 1=allocation error
13  ! 2=wrong BCS1 code
14  ! 3=wrong BCS2 code
15  ! 99=something strange happened in EZspline_init
16  integer, intent(out) :: ier
17  integer i, iok
18 
19  call ezspline_preinit(spline_o)
20  ier = 0
21 
22  if(ezspline_allocated(spline_o)) then
23  ier = 100 ! allocated already
24  return
25  else
26  call ezspline_preinit(spline_o)
27  endif
28 
29  spline_o%n1 = n1
30 
31  spline_o%klookup1 = 3 ! default lookup algorithm selection
32 
33  spline_o%isHermite = 0 ! default is spline interpolation
34  spline_o%isLinear = 0 ! spline, not piecewise linear interpolation
35 
36  iok = 0
37  allocate(spline_o%x1(n1), stat=iok)
38  if(iok /= 0) ier = 1
39  allocate(spline_o%fspl(2,n1), stat=iok)
40  if(iok /= 0) ier = 1
41  allocate(spline_o%x1pkg(n1, 4), stat=iok)
42  if(iok /= 0) ier = 1
43 
44  do i = 1, 2
45 
46  spline_o%bcval1min = 0.0_ezspline_r8
47  spline_o%bcval1max = 0.0_ezspline_r8
48  select case(bcs1(i))
49  case (-1)
50  spline_o%ibctype1(i) = -1
51  case (0)
52  spline_o%ibctype1(i) = 0
53  case (1)
54  spline_o%ibctype1(i) = 1
55  case (2)
56  spline_o%ibctype1(i) = 2
57  case default
58  ier = 2
59  spline_o%ibctype1(i) = 0
60  end select
61 
62  enddo
63  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
64  spline_o%ibctype1(1)=-1
65  spline_o%ibctype1(2)=-1
66  endif
67 
68  !
69  ! default grid
70  spline_o%x1min = 0.0_ezspline_r8
71  spline_o%x1max = 1.0_ezspline_r8
72  if(bcs1(2)==-1) spline_o%x1max = ezspline_twopi_r8
73 
74  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
75  & (/ (real(i-1,ezspline_r8)/real(spline_o%n1-1, ezspline_r8), i=1,spline_o%n1 ) /)
76 
77  spline_o%isReady = 0
78 
79  return
80 end subroutine ezspline_init1_r8
81 
82 
83 
84 
85 subroutine ezspline_init2_r8(spline_o, n1, n2, BCS1, BCS2, ier)
86  use ezspline_obj
87  implicit none
88  type(EZspline2_r8) spline_o
89  integer, intent(in) :: n1, n2
90  integer, intent(in) :: BCS1(2), BCS2(2)
91  ! ier:
92  ! 0=ok
93  ! 1=allocation error
94  ! 2=wrong BCS1 code
95  ! 3=wrong BCS2 code
96  ! 99=something strange happened in EZspline_init
97  integer, intent(out) :: ier
98  integer i, iok
99 
100  call ezspline_preinit(spline_o)
101  ier = 0
102 
103  if(ezspline_allocated(spline_o)) then
104  ier = 100 ! allocated already
105  return
106  else
107  call ezspline_preinit(spline_o)
108  endif
109 
110  spline_o%n1 = n1
111  spline_o%n2 = n2
112 
113  spline_o%klookup1 = 3 ! default lookup algorithm selection
114  spline_o%klookup2 = 3 ! default lookup algorithm selection
115 
116  spline_o%isHermite = 0 ! default is spline interpolation
117  spline_o%isLinear = 0 ! spline, not piecewise linear interpolation
118  spline_o%isHybrid = 0
119  spline_o%hspline = 0
120 
121  iok = 0
122  allocate(spline_o%x1(n1), stat=iok)
123  if(iok /= 0) ier = 1
124  allocate(spline_o%x2(n2), stat=iok)
125  if(iok /= 0) ier = 1
126  allocate(spline_o%fspl(4,n1,n2), stat=iok)
127  if(iok /= 0) ier = 1
128  allocate(spline_o%bcval1min(n2), stat=iok)
129  if(iok /= 0) ier = 1
130  allocate(spline_o%bcval1max(n2), stat=iok)
131  if(iok /= 0) ier = 1
132  allocate(spline_o%bcval2min(n1), stat=iok)
133  if(iok /= 0) ier = 1
134  allocate(spline_o%bcval2max(n1), stat=iok)
135  if(iok /= 0) ier = 1
136  allocate(spline_o%x1pkg(n1, 4), stat=iok)
137  if(iok /= 0) ier = 1
138  allocate(spline_o%x2pkg(n2, 4), stat=iok)
139  if(iok /= 0) ier = 1
140 
141  do i = 1, 2
142 
143  spline_o%bcval1min(1:n2) = 0.0_ezspline_r8
144  spline_o%bcval1max(1:n2) = 0.0_ezspline_r8
145  select case(bcs1(i))
146  case (-1)
147  spline_o%ibctype1(i) = -1
148  case (0)
149  spline_o%ibctype1(i) = 0
150  case (1)
151  spline_o%ibctype1(i) = 1
152  case (2)
153  spline_o%ibctype1(i) = 2
154  case default
155  ier = 2
156  spline_o%ibctype1(i) = 0
157  end select
158 
159  spline_o%bcval2min(1:n1) = 0.0_ezspline_r8
160  spline_o%bcval2max(1:n1) = 0.0_ezspline_r8
161  select case(bcs2(i))
162  case (-1)
163  spline_o%ibctype2(i) = -1
164  case (0)
165  spline_o%ibctype2(i) = 0
166  case (1)
167  spline_o%ibctype2(i) = 1
168  case (2)
169  spline_o%ibctype2(i) = 2
170  case default
171  ier = 3
172  spline_o%ibctype2(i) = 0
173  end select
174 
175  enddo
176  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
177  spline_o%ibctype1(1)=-1
178  spline_o%ibctype1(2)=-1
179  endif
180  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
181  spline_o%ibctype2(1)=-1
182  spline_o%ibctype2(2)=-1
183  endif
184 
185  !
186  ! default grid
187  spline_o%x1min = 0.0_ezspline_r8
188  spline_o%x1max = 1.0_ezspline_r8
189  if(bcs1(2)==-1) spline_o%x1max = ezspline_twopi_r8
190 
191  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
192  & (/ (real(i-1,ezspline_r8)/real(spline_o%n1-1, ezspline_r8), i=1,spline_o%n1 ) /)
193  spline_o%x2min = 0.0_ezspline_r8
194  spline_o%x2max = 1.0_ezspline_r8
195  if(bcs2(2)==-1) spline_o%x2max = ezspline_twopi_r8
196  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
197  & (/ (real(i-1,ezspline_r8)/real(spline_o%n2-1, ezspline_r8), i=1,spline_o%n2 ) /)
198 
199  spline_o%isReady = 0
200 
201  return
202 end subroutine ezspline_init2_r8
203 
204 
205 
206 
207 subroutine ezspline_init3_r8(spline_o, n1, n2, n3, BCS1, BCS2, BCS3, ier)
208  use ezspline_obj
209  implicit none
210  type(EZspline3_r8) spline_o
211  integer, intent(in) :: n1, n2, n3
212  integer, intent(in) :: BCS1(2), BCS2(2), BCS3(2)
213  ! ier:
214  ! 0=ok
215  ! 1=allocation error
216  ! 2=wrong BCS1 code
217  ! 3=wrong BCS2 code
218  ! 4=wrong BCS3 code
219  ! 99=something strange happened in EZspline_init
220  integer, intent(out) :: ier
221  integer i, iok
222 
223  call ezspline_preinit(spline_o)
224  ier = 0
225 
226  if(ezspline_allocated(spline_o)) then
227  ier = 100 ! allocated already
228  return
229  else
230  call ezspline_preinit(spline_o)
231  endif
232 
233  spline_o%n1 = n1
234  spline_o%n2 = n2
235  spline_o%n3 = n3
236 
237  spline_o%klookup1 = 3 ! default lookup algorithm selection
238  spline_o%klookup2 = 3 ! default lookup algorithm selection
239  spline_o%klookup3 = 3 ! default lookup algorithm selection
240 
241  spline_o%isHermite = 0 ! default is spline interpolation
242  spline_o%isLinear = 0 ! spline, not piecewise linear interpolation
243  spline_o%isHybrid = 0
244  spline_o%hspline = 0
245 
246  iok = 0
247  allocate(spline_o%x1(n1), stat=iok)
248  if(iok /= 0) ier = 1
249  allocate(spline_o%x2(n2), stat=iok)
250  if(iok /= 0) ier = 1
251  allocate(spline_o%x3(n3), stat=iok)
252  if(iok /= 0) ier = 1
253  allocate(spline_o%fspl(8,n1,n2,n3), stat=iok)
254  if(iok /= 0) ier = 1
255  allocate(spline_o%bcval1min(n2, n3), stat=iok)
256  if(iok /= 0) ier = 1
257  allocate(spline_o%bcval1max(n2, n3), stat=iok)
258  if(iok /= 0) ier = 1
259  allocate(spline_o%bcval2min(n1, n3), stat=iok)
260  if(iok /= 0) ier = 1
261  allocate(spline_o%bcval2max(n1, n3), stat=iok)
262  if(iok /= 0) ier = 1
263  allocate(spline_o%bcval3min(n1, n2), stat=iok)
264  if(iok /= 0) ier = 1
265  allocate(spline_o%bcval3max(n1, n2), stat=iok)
266  if(iok /= 0) ier = 1
267  allocate(spline_o%x1pkg(n1, 4), stat=iok)
268  if(iok /= 0) ier = 1
269  allocate(spline_o%x2pkg(n2, 4), stat=iok)
270  if(iok /= 0) ier = 1
271  allocate(spline_o%x3pkg(n3, 4), stat=iok)
272  if(iok /= 0) ier = 1
273 
274  do i = 1, 2
275 
276  spline_o%bcval1min(1:n2, 1:n3) = 0.0_ezspline_r8
277  spline_o%bcval1max(1:n2, 1:n3) = 0.0_ezspline_r8
278  select case(bcs1(i))
279  case (-1)
280  spline_o%ibctype1(i) = -1
281  case (0)
282  spline_o%ibctype1(i) = 0
283  case (1)
284  spline_o%ibctype1(i) = 1
285  case (2)
286  spline_o%ibctype1(i) = 2
287  case default
288  ier = 2
289  spline_o%ibctype1(i) = 0
290  end select
291 
292  spline_o%bcval2min(1:n1, 1:n3) = 0.0_ezspline_r8
293  spline_o%bcval2max(1:n1, 1:n3) = 0.0_ezspline_r8
294  select case(bcs2(i))
295  case (-1)
296  spline_o%ibctype2(i) = -1
297  case (0)
298  spline_o%ibctype2(i) = 0
299  case (1)
300  spline_o%ibctype2(i) = 1
301  case (2)
302  spline_o%ibctype2(i) = 2
303  case default
304  ier = 3
305  spline_o%ibctype2(i) = 0
306  end select
307 
308  spline_o%bcval3min(1:n1, 1:n2) = 0.0_ezspline_r8
309  spline_o%bcval3max(1:n1, 1:n2) = 0.0_ezspline_r8
310  select case(bcs3(i))
311  case (-1)
312  spline_o%ibctype3(i) = -1
313  case (0)
314  spline_o%ibctype3(i) = 0
315  case (1)
316  spline_o%ibctype3(i) = 1
317  case (2)
318  spline_o%ibctype3(i) = 2
319  case default
320  ier = 4
321  spline_o%ibctype3(i) = 0
322  end select
323 
324  enddo
325  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
326  spline_o%ibctype1(1)=-1
327  spline_o%ibctype1(2)=-1
328  endif
329  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
330  spline_o%ibctype2(1)=-1
331  spline_o%ibctype2(2)=-1
332  endif
333  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
334  spline_o%ibctype3(1)=-1
335  spline_o%ibctype3(2)=-1
336  endif
337 
338 
339  !
340  ! default grid
341  spline_o%x1min = 0.0_ezspline_r8
342  spline_o%x1max = 1.0_ezspline_r8
343  if(bcs1(2)==-1) spline_o%x1max = ezspline_twopi_r8
344 
345  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
346  & (/ (real(i-1,ezspline_r8)/real(spline_o%n1-1, ezspline_r8), i=1,spline_o%n1 ) /)
347  spline_o%x2min = 0.0_ezspline_r8
348  spline_o%x2max = 1.0_ezspline_r8
349  if(bcs2(2)==-1) spline_o%x2max = ezspline_twopi_r8
350  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
351  & (/ (real(i-1,ezspline_r8)/real(spline_o%n2-1, ezspline_r8), i=1,spline_o%n2 ) /)
352 
353  spline_o%x3min = 0.0_ezspline_r8
354  spline_o%x3max = 1.0_ezspline_r8
355  if(bcs3(2)==-1) spline_o%x3max = ezspline_twopi_r8
356  spline_o%x3 = spline_o%x3min + (spline_o%x3max - spline_o%x3min)* &
357  & (/ (real(i-1,ezspline_r8)/real(spline_o%n3-1, ezspline_r8), i=1,spline_o%n3 ) /)
358 
359  spline_o%isReady = 0
360 
361  return
362 end subroutine ezspline_init3_r8
363 
364 !/////
365 ! R4 !
366 !/////
367 subroutine ezspline_init1_r4(spline_o, n1, BCS1, ier)
368  use ezspline_obj
369  implicit none
370  type(EZspline1_r4) spline_o
371  integer, intent(in) :: n1
372  integer, intent(in) :: BCS1(2)
373  ! ier:
374  ! 0=ok
375  ! 1=allocation error
376  ! 2=wrong BCS1 code
377  ! 3=wrong BCS2 code
378  ! 99=something strange happened in EZspline_init
379  integer, intent(out) :: ier
380  integer i, iok
381 
382  call ezspline_preinit(spline_o)
383  ier = 0
384 
385  if(ezspline_allocated(spline_o)) then
386  ier = 100 ! allocated already
387  return
388  else
389  call ezspline_preinit(spline_o)
390  endif
391 
392  spline_o%n1 = n1
393 
394  spline_o%klookup1 = 3 ! default lookup algorithm selection
395 
396  spline_o%isHermite = 0 ! default is spline interpolation
397  spline_o%isLinear = 0 ! spline, not piecewise linear interpolation
398 
399  iok = 0
400  allocate(spline_o%x1(n1), stat=iok)
401  if(iok /= 0) ier = 1
402  allocate(spline_o%fspl(2,n1), stat=iok)
403  if(iok /= 0) ier = 1
404  allocate(spline_o%x1pkg(n1, 4), stat=iok)
405  if(iok /= 0) ier = 1
406 
407  do i = 1, 2
408 
409  spline_o%bcval1min = 0.0_ezspline_r4
410  spline_o%bcval1max = 0.0_ezspline_r4
411  select case(bcs1(i))
412  case (-1)
413  spline_o%ibctype1(i) = -1
414  case (0)
415  spline_o%ibctype1(i) = 0
416  case (1)
417  spline_o%ibctype1(i) = 1
418  case (2)
419  spline_o%ibctype1(i) = 2
420  case default
421  ier = 2
422  spline_o%ibctype1(i) = 0
423  end select
424 
425  enddo
426  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
427  spline_o%ibctype1(1)=-1
428  spline_o%ibctype1(2)=-1
429  endif
430 
431  !
432  ! default grid
433  spline_o%x1min = 0.0_ezspline_r4
434  spline_o%x1max = 1.0_ezspline_r4
435  if(bcs1(2)==-1) spline_o%x1max = ezspline_twopi_r4
436 
437  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
438  & (/ (real(i-1,ezspline_r4)/real(spline_o%n1-1, ezspline_r4), i=1,spline_o%n1 ) /)
439 
440  spline_o%isReady = 0
441 
442  return
443 end subroutine ezspline_init1_r4
444 
445 
446 
447 
448 subroutine ezspline_init2_r4(spline_o, n1, n2, BCS1, BCS2, ier)
449  use ezspline_obj
450  implicit none
451  type(EZspline2_r4) spline_o
452  integer, intent(in) :: n1, n2
453  integer, intent(in) :: BCS1(2), BCS2(2)
454  ! ier:
455  ! 0=ok
456  ! 1=allocation error
457  ! 2=wrong BCS1 code
458  ! 3=wrong BCS2 code
459  ! 99=something strange happened in EZspline_init
460  integer, intent(out) :: ier
461  integer i, iok
462 
463  call ezspline_preinit(spline_o)
464  ier = 0
465 
466  if(ezspline_allocated(spline_o)) then
467  ier = 100 ! allocated already
468  return
469  else
470  call ezspline_preinit(spline_o)
471  endif
472 
473  spline_o%n1 = n1
474  spline_o%n2 = n2
475 
476  spline_o%klookup1 = 3 ! default lookup algorithm selection
477  spline_o%klookup2 = 3 ! default lookup algorithm selection
478 
479  spline_o%isHermite = 0 ! default is spline interpolation
480  spline_o%isLinear = 0 ! spline, not piecewise linear interpolation
481  spline_o%isHybrid = 0
482  spline_o%hspline = 0
483 
484  iok = 0
485  allocate(spline_o%x1(n1), stat=iok)
486  if(iok /= 0) ier = 1
487  allocate(spline_o%x2(n2), stat=iok)
488  if(iok /= 0) ier = 1
489  allocate(spline_o%fspl(4,n1,n2), stat=iok)
490  if(iok /= 0) ier = 1
491  allocate(spline_o%bcval1min(n2), stat=iok)
492  if(iok /= 0) ier = 1
493  allocate(spline_o%bcval1max(n2), stat=iok)
494  if(iok /= 0) ier = 1
495  allocate(spline_o%bcval2min(n1), stat=iok)
496  if(iok /= 0) ier = 1
497  allocate(spline_o%bcval2max(n1), stat=iok)
498  if(iok /= 0) ier = 1
499  allocate(spline_o%x1pkg(n1, 4), stat=iok)
500  if(iok /= 0) ier = 1
501  allocate(spline_o%x2pkg(n2, 4), stat=iok)
502  if(iok /= 0) ier = 1
503 
504  do i = 1, 2
505 
506  spline_o%bcval1min(1:n2) = 0.0_ezspline_r4
507  spline_o%bcval1max(1:n2) = 0.0_ezspline_r4
508  select case(bcs1(i))
509  case (-1)
510  spline_o%ibctype1(i) = -1
511  case (0)
512  spline_o%ibctype1(i) = 0
513  case (1)
514  spline_o%ibctype1(i) = 1
515  case (2)
516  spline_o%ibctype1(i) = 2
517  case default
518  ier = 2
519  spline_o%ibctype1(i) = 0
520  end select
521 
522  spline_o%bcval2min(1:n1) = 0.0_ezspline_r4
523  spline_o%bcval2max(1:n1) = 0.0_ezspline_r4
524  select case(bcs2(i))
525  case (-1)
526  spline_o%ibctype2(i) = -1
527  case (0)
528  spline_o%ibctype2(i) = 0
529  case (1)
530  spline_o%ibctype2(i) = 1
531  case (2)
532  spline_o%ibctype2(i) = 2
533  case default
534  ier = 3
535  spline_o%ibctype2(i) = 0
536  end select
537 
538  enddo
539  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
540  spline_o%ibctype1(1)=-1
541  spline_o%ibctype1(2)=-1
542  endif
543  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
544  spline_o%ibctype2(1)=-1
545  spline_o%ibctype2(2)=-1
546  endif
547 
548  !
549  ! default grid
550  spline_o%x1min = 0.0_ezspline_r4
551  spline_o%x1max = 1.0_ezspline_r4
552  if(bcs1(2)==-1) spline_o%x1max = ezspline_twopi_r4
553 
554  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
555  & (/ (real(i-1,ezspline_r4)/real(spline_o%n1-1, ezspline_r4), i=1,spline_o%n1 ) /)
556  spline_o%x2min = 0.0_ezspline_r4
557  spline_o%x2max = 1.0_ezspline_r4
558  if(bcs2(2)==-1) spline_o%x2max = ezspline_twopi_r4
559  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
560  & (/ (real(i-1,ezspline_r4)/real(spline_o%n2-1, ezspline_r4), i=1,spline_o%n2 ) /)
561 
562  spline_o%isReady = 0
563 
564  return
565 end subroutine ezspline_init2_r4
566 
567 
568 
569 
570 subroutine ezspline_init3_r4(spline_o, n1, n2, n3, BCS1, BCS2, BCS3, ier)
571  use ezspline_obj
572  implicit none
573  type(EZspline3_r4) spline_o
574  integer, intent(in) :: n1, n2, n3
575  integer, intent(in) :: BCS1(2), BCS2(2), BCS3(2)
576  ! ier:
577  ! 0=ok
578  ! 1=allocation error
579  ! 2=wrong BCS1 code
580  ! 3=wrong BCS2 code
581  ! 4=wrong BCS3 code
582  ! 99=something strange happened in EZspline_init
583  integer, intent(out) :: ier
584  integer i, iok
585 
586  call ezspline_preinit(spline_o)
587  ier = 0
588 
589  if(ezspline_allocated(spline_o)) then
590  ier = 100 ! allocated already
591  return
592  else
593  call ezspline_preinit(spline_o)
594  endif
595 
596  spline_o%n1 = n1
597  spline_o%n2 = n2
598  spline_o%n3 = n3
599 
600  spline_o%klookup1 = 3 ! default lookup algorithm selection
601  spline_o%klookup2 = 3 ! default lookup algorithm selection
602  spline_o%klookup3 = 3 ! default lookup algorithm selection
603 
604  spline_o%isHermite = 0 ! default is spline interpolation
605  spline_o%isLinear = 0 ! spline, not piecewise linear interpolation
606  spline_o%isHybrid = 0
607  spline_o%hspline = 0
608 
609  iok = 0
610  allocate(spline_o%x1(n1), stat=iok)
611  if(iok /= 0) ier = 1
612  allocate(spline_o%x2(n2), stat=iok)
613  if(iok /= 0) ier = 1
614  allocate(spline_o%x3(n3), stat=iok)
615  if(iok /= 0) ier = 1
616  allocate(spline_o%fspl(8,n1,n2,n3), stat=iok)
617  if(iok /= 0) ier = 1
618  allocate(spline_o%bcval1min(n2, n3), stat=iok)
619  if(iok /= 0) ier = 1
620  allocate(spline_o%bcval1max(n2, n3), stat=iok)
621  if(iok /= 0) ier = 1
622  allocate(spline_o%bcval2min(n1, n3), stat=iok)
623  if(iok /= 0) ier = 1
624  allocate(spline_o%bcval2max(n1, n3), stat=iok)
625  if(iok /= 0) ier = 1
626  allocate(spline_o%bcval3min(n1, n2), stat=iok)
627  if(iok /= 0) ier = 1
628  allocate(spline_o%bcval3max(n1, n2), stat=iok)
629  if(iok /= 0) ier = 1
630  allocate(spline_o%x1pkg(n1, 4), stat=iok)
631  if(iok /= 0) ier = 1
632  allocate(spline_o%x2pkg(n2, 4), stat=iok)
633  if(iok /= 0) ier = 1
634  allocate(spline_o%x3pkg(n3, 4), stat=iok)
635  if(iok /= 0) ier = 1
636 
637  do i = 1, 2
638 
639  spline_o%bcval1min(1:n2, 1:n3) = 0.0_ezspline_r4
640  spline_o%bcval1max(1:n2, 1:n3) = 0.0_ezspline_r4
641  select case(bcs1(i))
642  case (-1)
643  spline_o%ibctype1(i) = -1
644  case (0)
645  spline_o%ibctype1(i) = 0
646  case (1)
647  spline_o%ibctype1(i) = 1
648  case (2)
649  spline_o%ibctype1(i) = 2
650  case default
651  ier = 2
652  spline_o%ibctype1(i) = 0
653  end select
654 
655  spline_o%bcval2min(1:n1, 1:n3) = 0.0_ezspline_r4
656  spline_o%bcval2max(1:n1, 1:n3) = 0.0_ezspline_r4
657  select case(bcs2(i))
658  case (-1)
659  spline_o%ibctype2(i) = -1
660  case (0)
661  spline_o%ibctype2(i) = 0
662  case (1)
663  spline_o%ibctype2(i) = 1
664  case (2)
665  spline_o%ibctype2(i) = 2
666  case default
667  ier = 3
668  spline_o%ibctype2(i) = 0
669  end select
670 
671  spline_o%bcval3min(1:n1, 1:n2) = 0.0_ezspline_r4
672  spline_o%bcval3max(1:n1, 1:n2) = 0.0_ezspline_r4
673  select case(bcs3(i))
674  case (-1)
675  spline_o%ibctype3(i) = -1
676  case (0)
677  spline_o%ibctype3(i) = 0
678  case (1)
679  spline_o%ibctype3(i) = 1
680  case (2)
681  spline_o%ibctype3(i) = 2
682  case default
683  ier = 4
684  spline_o%ibctype3(i) = 0
685  end select
686 
687  enddo
688  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
689  spline_o%ibctype1(1)=-1
690  spline_o%ibctype1(2)=-1
691  endif
692  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
693  spline_o%ibctype2(1)=-1
694  spline_o%ibctype2(2)=-1
695  endif
696  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
697  spline_o%ibctype3(1)=-1
698  spline_o%ibctype3(2)=-1
699  endif
700 
701 
702  !
703  ! default grid
704  spline_o%x1min = 0.0_ezspline_r4
705  spline_o%x1max = 1.0_ezspline_r4
706  if(bcs1(2)==-1) spline_o%x1max = ezspline_twopi_r4
707 
708  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
709  & (/ (real(i-1,ezspline_r4)/real(spline_o%n1-1, ezspline_r4), i=1,spline_o%n1 ) /)
710  spline_o%x2min = 0.0_ezspline_r4
711  spline_o%x2max = 1.0_ezspline_r4
712  if(bcs2(2)==-1) spline_o%x2max = ezspline_twopi_r4
713  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
714  & (/ (real(i-1,ezspline_r4)/real(spline_o%n2-1, ezspline_r4), i=1,spline_o%n2 ) /)
715 
716  spline_o%x3min = 0.0_ezspline_r4
717  spline_o%x3max = 1.0_ezspline_r4
718  if(bcs3(2)==-1) spline_o%x3max = ezspline_twopi_r4
719  spline_o%x3 = spline_o%x3min + (spline_o%x3max - spline_o%x3min)* &
720  & (/ (real(i-1,ezspline_r4)/real(spline_o%n3-1, ezspline_r4), i=1,spline_o%n3 ) /)
721 
722  spline_o%isReady = 0
723 
724  return
725 end subroutine ezspline_init3_r4
726 
ezspline_obj::ezspline_allocated
Definition: ezspline_obj.f90:19
ezspline_obj::ezspline_preinit
Definition: ezspline_obj.f90:3