V3FIT
ezlinear_init.f90
1 !/////
2 ! R8 !
3 !/////
4 subroutine ezlinear_init1_r8(spline_o, n1, ier)
5  use ezspline_obj
6  implicit none
7  type(EZspline1_r8) spline_o
8  integer, intent(in) :: n1
9  ! ier:
10  ! 0=ok
11  ! 1=allocation error
12  ! 99=something strange happened in EZlinear_init
13  integer, intent(out) :: ier
14  integer i, iok
15 
16  ier = 0
17 
18  if(ezspline_allocated(spline_o)) then
19  ier = 100 ! allocated already
20  return
21  else
22  call ezspline_preinit(spline_o)
23  endif
24 
25  spline_o%n1 = n1
26 
27  spline_o%klookup1 = 3 ! default lookup algorithm selection
28 
29  spline_o%isHermite = 0 ! no Hermite interpolation; this is EZlinear_init
30  spline_o%isLinear = 1 ! piecewise linear interpolation
31 
32  iok = 0
33  allocate(spline_o%x1(n1), stat=iok)
34  if(iok /= 0) ier = 1
35  allocate(spline_o%fspl(1,n1), stat=iok)
36  if(iok /= 0) ier = 1
37  allocate(spline_o%x1pkg(n1, 4), stat=iok)
38  if(iok /= 0) ier = 1
39 
40  ! default grid
41  spline_o%x1min = 0.0_ezspline_r8
42  spline_o%x1max = 1.0_ezspline_r8
43 
44  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
45  & (/ (real(i-1,ezspline_r8)/real(spline_o%n1-1, ezspline_r8), i=1,spline_o%n1 ) /)
46 
47  spline_o%isReady = 0
48 
49  return
50 end subroutine ezlinear_init1_r8
51 
52 
53 
54 subroutine ezlinear_init2_r8(spline_o, n1, n2, ier)
55  use ezspline_obj
56  implicit none
57  type(EZspline2_r8) spline_o
58  integer, intent(in) :: n1, n2
59  ! ier:
60  ! 0=ok
61  ! 1=allocation error
62  ! 99=something strange happened in EZlinear_init
63  integer, intent(out) :: ier
64  integer i, iok
65 
66  ier = 0
67 
68  if(ezspline_allocated(spline_o)) then
69  ier = 100 ! allocated already
70  return
71  else
72  call ezspline_preinit(spline_o)
73  endif
74 
75  spline_o%n1 = n1
76  spline_o%n2 = n2
77 
78  spline_o%klookup1 = 3 ! default lookup algorithm selection
79  spline_o%klookup2 = 3 ! default lookup algorithm selection
80 
81  spline_o%isHermite = 0 ! no Hermite interpolation; this is EZlinear_init
82  spline_o%isLinear = 1 ! piecewise linear interpolation
83  spline_o%isHybrid = 0
84  spline_o%hspline = 0
85 
86  iok = 0
87  allocate(spline_o%x1(n1), stat=iok)
88  if(iok /= 0) ier = 1
89  allocate(spline_o%x2(n2), stat=iok)
90  if(iok /= 0) ier = 1
91  allocate(spline_o%fspl(1,n1,n2), stat=iok)
92  if(iok /= 0) ier = 1
93  allocate(spline_o%bcval1min(n2), stat=iok)
94  if(iok /= 0) ier = 1
95  allocate(spline_o%bcval1max(n2), stat=iok)
96  if(iok /= 0) ier = 1
97  allocate(spline_o%bcval2min(n1), stat=iok)
98  if(iok /= 0) ier = 1
99  allocate(spline_o%bcval2max(n1), stat=iok)
100  if(iok /= 0) ier = 1
101  allocate(spline_o%x1pkg(n1, 4), stat=iok)
102  if(iok /= 0) ier = 1
103  allocate(spline_o%x2pkg(n2, 4), stat=iok)
104  if(iok /= 0) ier = 1
105 
106  ! default grid
107  spline_o%x1min = 0.0_ezspline_r8
108  spline_o%x1max = 1.0_ezspline_r8
109 
110  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
111  & (/ (real(i-1,ezspline_r8)/real(spline_o%n1-1, ezspline_r8), i=1,spline_o%n1 ) /)
112  spline_o%x2min = 0.0_ezspline_r8
113  spline_o%x2max = 1.0_ezspline_r8
114  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
115  & (/ (real(i-1,ezspline_r8)/real(spline_o%n2-1, ezspline_r8), i=1,spline_o%n2 ) /)
116 
117  spline_o%isReady = 0
118 
119  return
120 end subroutine ezlinear_init2_r8
121 
122 
123 
124 
125 subroutine ezlinear_init3_r8(spline_o, n1, n2, n3, ier)
126  use ezspline_obj
127  implicit none
128  type(EZspline3_r8) spline_o
129  integer, intent(in) :: n1, n2, n3
130  ! ier:
131  ! 0=ok
132  ! 1=allocation error
133  ! 99=something strange happened in EZlinear_init
134  integer, intent(out) :: ier
135  integer i, iok
136 
137  ier = 0
138 
139  if(ezspline_allocated(spline_o)) then
140  ier = 100 ! allocated already
141  return
142  else
143  call ezspline_preinit(spline_o)
144  endif
145 
146  spline_o%n1 = n1
147  spline_o%n2 = n2
148  spline_o%n3 = n3
149 
150  spline_o%klookup1 = 3 ! default lookup algorithm selection
151  spline_o%klookup2 = 3 ! default lookup algorithm selection
152  spline_o%klookup3 = 3 ! default lookup algorithm selection
153 
154  spline_o%isHermite = 0 ! no Hermite interpolation; this is EZlinear_init
155  spline_o%isLinear = 1 ! piecewise linear interpolation
156  spline_o%isHybrid = 0
157  spline_o%hspline = 0
158 
159  iok = 0
160  allocate(spline_o%x1(n1), stat=iok)
161  if(iok /= 0) ier = 1
162  allocate(spline_o%x2(n2), stat=iok)
163  if(iok /= 0) ier = 1
164  allocate(spline_o%x3(n3), stat=iok)
165  if(iok /= 0) ier = 1
166  allocate(spline_o%fspl(1,n1,n2,n3), stat=iok)
167  if(iok /= 0) ier = 1
168  allocate(spline_o%bcval1min(n2, n3), stat=iok)
169  if(iok /= 0) ier = 1
170  allocate(spline_o%bcval1max(n2, n3), stat=iok)
171  if(iok /= 0) ier = 1
172  allocate(spline_o%bcval2min(n1, n3), stat=iok)
173  if(iok /= 0) ier = 1
174  allocate(spline_o%bcval2max(n1, n3), stat=iok)
175  if(iok /= 0) ier = 1
176  allocate(spline_o%bcval3min(n1, n2), stat=iok)
177  if(iok /= 0) ier = 1
178  allocate(spline_o%bcval3max(n1, n2), stat=iok)
179  if(iok /= 0) ier = 1
180  allocate(spline_o%x1pkg(n1, 4), stat=iok)
181  if(iok /= 0) ier = 1
182  allocate(spline_o%x2pkg(n2, 4), stat=iok)
183  if(iok /= 0) ier = 1
184  allocate(spline_o%x3pkg(n3, 4), stat=iok)
185  if(iok /= 0) ier = 1
186 
187  ! default grid
188  spline_o%x1min = 0.0_ezspline_r8
189  spline_o%x1max = 1.0_ezspline_r8
190  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
191  & (/ (real(i-1,ezspline_r8)/real(spline_o%n1-1, ezspline_r8), i=1,spline_o%n1 ) /)
192 
193  spline_o%x2min = 0.0_ezspline_r8
194  spline_o%x2max = 1.0_ezspline_r8
195  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
196  & (/ (real(i-1,ezspline_r8)/real(spline_o%n2-1, ezspline_r8), i=1,spline_o%n2 ) /)
197 
198  spline_o%x3min = 0.0_ezspline_r8
199  spline_o%x3max = 1.0_ezspline_r8
200  spline_o%x3 = spline_o%x3min + (spline_o%x3max - spline_o%x3min)* &
201  & (/ (real(i-1,ezspline_r8)/real(spline_o%n3-1, ezspline_r8), i=1,spline_o%n3 ) /)
202 
203  spline_o%isReady = 0
204 
205  return
206 end subroutine ezlinear_init3_r8
207 
208 !/////
209 ! R4 !
210 !/////
211 subroutine ezlinear_init1_r4(spline_o, n1, ier)
212  use ezspline_obj
213  implicit none
214  type(EZspline1_r4) spline_o
215  integer, intent(in) :: n1
216  ! ier:
217  ! 0=ok
218  ! 1=allocation error
219  ! 99=something strange happened in EZlinear_init
220  integer, intent(out) :: ier
221  integer i, iok
222 
223  ier = 0
224 
225  if(ezspline_allocated(spline_o)) then
226  ier = 100 ! allocated already
227  return
228  else
229  call ezspline_preinit(spline_o)
230  endif
231 
232  spline_o%n1 = n1
233 
234  spline_o%klookup1 = 3 ! default lookup algorithm selection
235 
236  spline_o%isHermite = 0 ! no Hermite interpolation; this is EZlinear_init
237  spline_o%isLinear = 1 ! piecewise linear interpolation
238 
239  iok = 0
240  allocate(spline_o%x1(n1), stat=iok)
241  if(iok /= 0) ier = 1
242  allocate(spline_o%fspl(1,n1), stat=iok)
243  if(iok /= 0) ier = 1
244  allocate(spline_o%x1pkg(n1, 4), stat=iok)
245  if(iok /= 0) ier = 1
246 
247  ! default grid
248  spline_o%x1min = 0.0_ezspline_r4
249  spline_o%x1max = 1.0_ezspline_r4
250  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
251  & (/ (real(i-1,ezspline_r4)/real(spline_o%n1-1, ezspline_r4), i=1,spline_o%n1 ) /)
252 
253  spline_o%isReady = 0
254 
255  return
256 end subroutine ezlinear_init1_r4
257 
258 
259 
260 
261 subroutine ezlinear_init2_r4(spline_o, n1, n2, ier)
262  use ezspline_obj
263  implicit none
264  type(EZspline2_r4) spline_o
265  integer, intent(in) :: n1, n2
266  ! ier:
267  ! 0=ok
268  ! 1=allocation error
269  ! 99=something strange happened in EZlinear_init
270  integer, intent(out) :: ier
271  integer i, iok
272 
273  ier = 0
274 
275  if(ezspline_allocated(spline_o)) then
276  ier = 100 ! allocated already
277  return
278  else
279  call ezspline_preinit(spline_o)
280  endif
281 
282  spline_o%n1 = n1
283  spline_o%n2 = n2
284 
285  spline_o%klookup1 = 3 ! default lookup algorithm selection
286  spline_o%klookup2 = 3 ! default lookup algorithm selection
287 
288  spline_o%isHermite = 0 ! no Hermite interpolation; this is EZlinear_init
289  spline_o%isLinear = 1 ! piecewise linear interpolation
290  spline_o%isHybrid = 0
291  spline_o%hspline = 0
292 
293  iok = 0
294  allocate(spline_o%x1(n1), stat=iok)
295  if(iok /= 0) ier = 1
296  allocate(spline_o%x2(n2), stat=iok)
297  if(iok /= 0) ier = 1
298  allocate(spline_o%fspl(1,n1,n2), stat=iok)
299  if(iok /= 0) ier = 1
300  allocate(spline_o%bcval1min(n2), stat=iok)
301  if(iok /= 0) ier = 1
302  allocate(spline_o%bcval1max(n2), stat=iok)
303  if(iok /= 0) ier = 1
304  allocate(spline_o%bcval2min(n1), stat=iok)
305  if(iok /= 0) ier = 1
306  allocate(spline_o%bcval2max(n1), stat=iok)
307  if(iok /= 0) ier = 1
308  allocate(spline_o%x1pkg(n1, 4), stat=iok)
309  if(iok /= 0) ier = 1
310  allocate(spline_o%x2pkg(n2, 4), stat=iok)
311  if(iok /= 0) ier = 1
312 
313  ! default grid
314  spline_o%x1min = 0.0_ezspline_r4
315  spline_o%x1max = 1.0_ezspline_r4
316  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
317  & (/ (real(i-1,ezspline_r4)/real(spline_o%n1-1, ezspline_r4), i=1,spline_o%n1 ) /)
318 
319  spline_o%x2min = 0.0_ezspline_r4
320  spline_o%x2max = 1.0_ezspline_r4
321  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
322  & (/ (real(i-1,ezspline_r4)/real(spline_o%n2-1, ezspline_r4), i=1,spline_o%n2 ) /)
323 
324  spline_o%isReady = 0
325 
326  return
327 end subroutine ezlinear_init2_r4
328 
329 
330 
331 
332 subroutine ezlinear_init3_r4(spline_o, n1, n2, n3, ier)
333  use ezspline_obj
334  implicit none
335  type(EZspline3_r4) spline_o
336  integer, intent(in) :: n1, n2, n3
337  ! ier:
338  ! 0=ok
339  ! 1=allocation error
340  ! 99=something strange happened in EZlinear_init
341  integer, intent(out) :: ier
342  integer i, iok
343 
344  ier = 0
345 
346  if(ezspline_allocated(spline_o)) then
347  ier = 100 ! allocated already
348  return
349  else
350  call ezspline_preinit(spline_o)
351  endif
352 
353  spline_o%n1 = n1
354  spline_o%n2 = n2
355  spline_o%n3 = n3
356 
357  spline_o%klookup1 = 3 ! default lookup algorithm selection
358  spline_o%klookup2 = 3 ! default lookup algorithm selection
359  spline_o%klookup3 = 3 ! default lookup algorithm selection
360 
361  spline_o%isHermite = 0 ! no Hermite interpolation; this is EZlinear_init
362  spline_o%isLinear = 1 ! piecewise linear interpolation
363  spline_o%isHybrid = 0
364  spline_o%hspline = 0
365 
366  iok = 0
367  allocate(spline_o%x1(n1), stat=iok)
368  if(iok /= 0) ier = 1
369  allocate(spline_o%x2(n2), stat=iok)
370  if(iok /= 0) ier = 1
371  allocate(spline_o%x3(n3), stat=iok)
372  if(iok /= 0) ier = 1
373  allocate(spline_o%fspl(1,n1,n2,n3), stat=iok)
374  if(iok /= 0) ier = 1
375  allocate(spline_o%bcval1min(n2, n3), stat=iok)
376  if(iok /= 0) ier = 1
377  allocate(spline_o%bcval1max(n2, n3), stat=iok)
378  if(iok /= 0) ier = 1
379  allocate(spline_o%bcval2min(n1, n3), stat=iok)
380  if(iok /= 0) ier = 1
381  allocate(spline_o%bcval2max(n1, n3), stat=iok)
382  if(iok /= 0) ier = 1
383  allocate(spline_o%bcval3min(n1, n2), stat=iok)
384  if(iok /= 0) ier = 1
385  allocate(spline_o%bcval3max(n1, n2), stat=iok)
386  if(iok /= 0) ier = 1
387  allocate(spline_o%x1pkg(n1, 4), stat=iok)
388  if(iok /= 0) ier = 1
389  allocate(spline_o%x2pkg(n2, 4), stat=iok)
390  if(iok /= 0) ier = 1
391  allocate(spline_o%x3pkg(n3, 4), stat=iok)
392  if(iok /= 0) ier = 1
393 
394  ! default grid
395  spline_o%x1min = 0.0_ezspline_r4
396  spline_o%x1max = 1.0_ezspline_r4
397 
398  spline_o%x1 = spline_o%x1min + (spline_o%x1max - spline_o%x1min)* &
399  & (/ (real(i-1,ezspline_r4)/real(spline_o%n1-1, ezspline_r4), i=1,spline_o%n1 ) /)
400 
401  spline_o%x2min = 0.0_ezspline_r4
402  spline_o%x2max = 1.0_ezspline_r4
403  spline_o%x2 = spline_o%x2min + (spline_o%x2max - spline_o%x2min)* &
404  & (/ (real(i-1,ezspline_r4)/real(spline_o%n2-1, ezspline_r4), i=1,spline_o%n2 ) /)
405 
406  spline_o%x3min = 0.0_ezspline_r4
407  spline_o%x3max = 1.0_ezspline_r4
408  spline_o%x3 = spline_o%x3min + (spline_o%x3max - spline_o%x3min)* &
409  & (/ (real(i-1,ezspline_r4)/real(spline_o%n3-1, ezspline_r4), i=1,spline_o%n3 ) /)
410 
411  spline_o%isReady = 0
412 
413  return
414 end subroutine ezlinear_init3_r4
415 
ezspline_obj::ezspline_allocated
Definition: ezspline_obj.f90:19
ezspline_obj::ezspline_preinit
Definition: ezspline_obj.f90:3