V3FIT
ezspline_modulo.f90
1 !/////
2 ! R8 !
3 !/////
4 !
5 ! map point into (xmin, xmax) cell when boundary conditions are periodic.
6 
7 subroutine ezspline_modulo1_r8(spline_o, p1, ier)
8  use ezspline_obj
9  implicit none
10  type(EZspline1_r8) spline_o
11  real(ezspline_r8) :: p1 ! the location
12  integer, intent(out) :: ier
13 
14  ier = 0
15  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
16  p1 = mod( p1, spline_o%x1max - spline_o%x1min )
17  endif
18 
19 end subroutine ezspline_modulo1_r8
20 
21 subroutine ezspline_modulo_array1_r8(spline_o, k1, p1, ier)
22  use ezspline_obj
23  implicit none
24  type(EZspline1_r8) spline_o
25  integer, intent(in) :: k1
26  real(ezspline_r8) :: p1(k1) ! the points
27  integer, intent(out) :: ier
28 
29  ier = 0
30  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
31  p1(1:k1) = mod( p1(1:k1), spline_o%x1max - spline_o%x1min )
32  endif
33 
34 end subroutine ezspline_modulo_array1_r8
35 
36 
37 subroutine ezspline_modulo2_r8(spline_o, p1, p2, ier)
38  use ezspline_obj
39  implicit none
40  type(EZspline2_r8) spline_o
41  real(ezspline_r8) :: p1, p2 ! the location
42  integer, intent(out) :: ier
43 
44  ier = 0
45  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
46  p1 = mod( p1, spline_o%x1max - spline_o%x1min )
47  endif
48 
49  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
50  p2 = mod( p2, spline_o%x2max - spline_o%x2min )
51  endif
52 
53 end subroutine ezspline_modulo2_r8
54 
55 subroutine ezspline_modulo_array2_r8(spline_o, k1, k2, p1, p2, ier)
56  use ezspline_obj
57  implicit none
58  type(EZspline2_r8) spline_o
59  integer, intent(in) :: k1, k2
60  real(ezspline_r8) :: p1(k1), p2(k2) ! the points
61  integer, intent(out) :: ier
62 
63  ier = 0
64  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
65  p1(1:k1) = mod( p1(1:k1), spline_o%x1max - spline_o%x1min )
66  endif
67 
68  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
69  p2(1:k2) = mod( p2(1:k2), spline_o%x2max - spline_o%x2min )
70  endif
71 
72 end subroutine ezspline_modulo_array2_r8
73 
74 subroutine ezspline_modulo_cloud2_r8(spline_o, k, p1, p2, ier)
75  use ezspline_obj
76  implicit none
77  type(EZspline2_r8) spline_o
78  integer, intent(in) :: k
79  real(ezspline_r8) :: p1(k), p2(k) ! the points
80  integer, intent(out) :: ier
81 
82  ier = 0
83  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
84  p1(1:k) = mod( p1(1:k), spline_o%x1max - spline_o%x1min )
85  endif
86 
87  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
88  p2(1:k) = mod( p2(1:k), spline_o%x2max - spline_o%x2min )
89  endif
90 
91 end subroutine ezspline_modulo_cloud2_r8
92 
93 
94 subroutine ezspline_modulo3_r8(spline_o, p1, p2, p3, ier)
95  use ezspline_obj
96  implicit none
97  type(EZspline3_r8) spline_o
98  real(ezspline_r8) :: p1, p2, p3 ! the location
99  integer, intent(out) :: ier
100 
101  ier = 0
102  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
103  p1 = mod( p1, spline_o%x1max - spline_o%x1min )
104  endif
105 
106  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
107  p2 = mod( p2, spline_o%x2max - spline_o%x2min )
108  endif
109 
110  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
111  p3 = mod( p3, spline_o%x3max - spline_o%x3min )
112  endif
113 
114 end subroutine ezspline_modulo3_r8
115 
116 subroutine ezspline_modulo_array3_r8(spline_o, k1, k2, k3, p1, p2, p3, ier)
117  use ezspline_obj
118  implicit none
119  type(EZspline3_r8) spline_o
120  integer, intent(in) :: k1, k2, k3
121  real(ezspline_r8) :: p1(k1), p2(k2), p3(k3) ! the points
122  integer, intent(out) :: ier
123 
124  ier = 0
125  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
126  p1(1:k1) = mod( p1(1:k1), spline_o%x1max - spline_o%x1min )
127  endif
128 
129  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
130  p2(1:k2) = mod( p2(1:k2), spline_o%x2max - spline_o%x2min )
131  endif
132 
133  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
134  p3(1:k3) = mod( p3(1:k3), spline_o%x3max - spline_o%x3min )
135  endif
136 
137 end subroutine ezspline_modulo_array3_r8
138 
139 subroutine ezspline_modulo_cloud3_r8(spline_o, k, p1, p2, p3, ier)
140  use ezspline_obj
141  implicit none
142  type(EZspline3_r8) spline_o
143  integer, intent(in) :: k
144  real(ezspline_r8) :: p1(k), p2(k), p3(k) ! the points
145  integer, intent(out) :: ier
146 
147  ier = 0
148  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
149  p1(1:k) = mod( p1(1:k), spline_o%x1max - spline_o%x1min )
150  endif
151 
152  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
153  p2(1:k) = mod( p2(1:k), spline_o%x2max - spline_o%x2min )
154  endif
155 
156  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
157  p3(1:k) = mod( p3(1:k), spline_o%x3max - spline_o%x3min )
158  endif
159 
160 end subroutine ezspline_modulo_cloud3_r8
161 !/////
162 ! R4 !
163 !/////
164 !
165 ! map point into (xmin, xmax) cell when boundary conditions are periodic.
166 
167 subroutine ezspline_modulo1_r4(spline_o, p1, ier)
168  use ezspline_obj
169  implicit none
170  type(EZspline1_r4) spline_o
171  real(ezspline_r4) :: p1 ! the location
172  integer, intent(out) :: ier
173 
174  ier = 0
175  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
176  p1 = mod( p1, spline_o%x1max - spline_o%x1min )
177  endif
178 
179 end subroutine ezspline_modulo1_r4
180 
181 subroutine ezspline_modulo_array1_r4(spline_o, k1, p1, ier)
182  use ezspline_obj
183  implicit none
184  type(EZspline1_r4) spline_o
185  integer, intent(in) :: k1
186  real(ezspline_r4) :: p1(k1) ! the points
187  integer, intent(out) :: ier
188 
189  ier = 0
190  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
191  p1(1:k1) = mod( p1(1:k1), spline_o%x1max - spline_o%x1min )
192  endif
193 
194 end subroutine ezspline_modulo_array1_r4
195 
196 
197 subroutine ezspline_modulo2_r4(spline_o, p1, p2, ier)
198  use ezspline_obj
199  implicit none
200  type(EZspline2_r4) spline_o
201  real(ezspline_r4) :: p1, p2 ! the location
202  integer, intent(out) :: ier
203 
204  ier = 0
205  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
206  p1 = mod( p1, spline_o%x1max - spline_o%x1min )
207  endif
208 
209  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
210  p2 = mod( p2, spline_o%x2max - spline_o%x2min )
211  endif
212 
213 end subroutine ezspline_modulo2_r4
214 
215 subroutine ezspline_modulo_array2_r4(spline_o, k1, k2, p1, p2, ier)
216  use ezspline_obj
217  implicit none
218  type(EZspline2_r4) spline_o
219  integer, intent(in) :: k1, k2
220  real(ezspline_r4) :: p1(k1), p2(k2) ! the points
221  integer, intent(out) :: ier
222 
223  ier = 0
224  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
225  p1(1:k1) = mod( p1(1:k1), spline_o%x1max - spline_o%x1min )
226  endif
227 
228  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
229  p2(1:k2) = mod( p2(1:k2), spline_o%x2max - spline_o%x2min )
230  endif
231 
232 end subroutine ezspline_modulo_array2_r4
233 
234 subroutine ezspline_modulo_cloud2_r4(spline_o, k, p1, p2, ier)
235  use ezspline_obj
236  implicit none
237  type(EZspline2_r4) spline_o
238  integer, intent(in) :: k
239  real(ezspline_r4) :: p1(k), p2(k) ! the points
240  integer, intent(out) :: ier
241 
242  ier = 0
243  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
244  p1(1:k) = mod( p1(1:k), spline_o%x1max - spline_o%x1min )
245  endif
246 
247  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
248  p2(1:k) = mod( p2(1:k), spline_o%x2max - spline_o%x2min )
249  endif
250 
251 end subroutine ezspline_modulo_cloud2_r4
252 
253 
254 subroutine ezspline_modulo3_r4(spline_o, p1, p2, p3, ier)
255  use ezspline_obj
256  implicit none
257  type(EZspline3_r4) spline_o
258  real(ezspline_r4) :: p1, p2, p3 ! the location
259  integer, intent(out) :: ier
260 
261  ier = 0
262  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
263  p1 = mod( p1, spline_o%x1max - spline_o%x1min )
264  endif
265 
266  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
267  p2 = mod( p2, spline_o%x2max - spline_o%x2min )
268  endif
269 
270  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
271  p3 = mod( p3, spline_o%x3max - spline_o%x3min )
272  endif
273 
274 end subroutine ezspline_modulo3_r4
275 
276 subroutine ezspline_modulo_array3_r4(spline_o, k1, k2, k3, p1, p2, p3, ier)
277  use ezspline_obj
278  implicit none
279  type(EZspline3_r4) spline_o
280  integer, intent(in) :: k1, k2, k3
281  real(ezspline_r4) :: p1(k1), p2(k2), p3(k3) ! the points
282  integer, intent(out) :: ier
283 
284  ier = 0
285  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
286  p1(1:k1) = mod( p1(1:k1), spline_o%x1max - spline_o%x1min )
287  endif
288 
289  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
290  p2(1:k2) = mod( p2(1:k2), spline_o%x2max - spline_o%x2min )
291  endif
292 
293  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
294  p3(1:k3) = mod( p3(1:k3), spline_o%x3max - spline_o%x3min )
295  endif
296 
297 end subroutine ezspline_modulo_array3_r4
298 
299 subroutine ezspline_modulo_cloud3_r4(spline_o, k, p1, p2, p3, ier)
300  use ezspline_obj
301  implicit none
302  type(EZspline3_r4) spline_o
303  integer, intent(in) :: k
304  real(ezspline_r4) :: p1(k), p2(k), p3(k) ! the points
305  integer, intent(out) :: ier
306 
307  ier = 0
308  if(spline_o%ibctype1(1)==-1 .OR. spline_o%ibctype1(2)==-1) then
309  p1(1:k) = mod( p1(1:k), spline_o%x1max - spline_o%x1min )
310  endif
311 
312  if(spline_o%ibctype2(1)==-1 .OR. spline_o%ibctype2(2)==-1) then
313  p2(1:k) = mod( p2(1:k), spline_o%x2max - spline_o%x2min )
314  endif
315 
316  if(spline_o%ibctype3(1)==-1 .OR. spline_o%ibctype3(2)==-1) then
317  p3(1:k) = mod( p3(1:k), spline_o%x3max - spline_o%x3min )
318  endif
319 
320 end subroutine ezspline_modulo_cloud3_r4