Loading [MathJax]/jax/input/TeX/config.js
Neko 0.9.99
A portable framework for high-order spectral element flow simulations
All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Pages
hip_math.f90
Go to the documentation of this file.
1! Copyright (c) 2024, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
34 use num_types, only: rp, c_rp
35 implicit none
36 public
37
38 interface
39 subroutine hip_copy(a_d, b_d, n) &
40 bind(c, name = 'hip_copy')
41 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
42 type(c_ptr), value :: a_d, b_d
43 integer(c_int) :: n
44 end subroutine hip_copy
45
46 subroutine hip_masked_copy(a_d, b_d, mask_d, n, m) &
47 bind(c, name = 'hip_masked_copy')
48 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
49 type(c_ptr), value :: a_d, b_d, mask_d
50 integer(c_int) :: n, m
51 end subroutine hip_masked_copy
52
53 subroutine hip_masked_red_copy(a_d, b_d, mask_d, n, m) &
54 bind(c, name = 'hip_masked_red_copy')
55 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
56 type(c_ptr), value :: a_d, b_d, mask_d
57 integer(c_int) :: n, m
58 end subroutine hip_masked_red_copy
59
60 subroutine hip_masked_atomic_reduction(a_d, b_d, mask_d, n, m) &
61 bind(c, name = 'hip_masked_atomic_reduction')
62 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
63 type(c_ptr), value :: a_d, b_d, mask_d
64 integer(c_int) :: n, m
65 end subroutine hip_masked_atomic_reduction
66
67 subroutine hip_cfill_mask(a_d, c, size, mask_d, mask_size) &
68 bind(c, name = 'hip_cfill_mask')
69 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
70 import c_rp
71 type(c_ptr), value :: a_d
72 real(c_rp) :: c
73 integer(c_int) :: size
74 type(c_ptr), value :: mask_d
75 integer(c_int) :: mask_size
76 end subroutine hip_cfill_mask
77
78 subroutine hip_cmult(a_d, c, n) &
79 bind(c, name = 'hip_cmult')
80 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
81 import c_rp
82 type(c_ptr), value :: a_d
83 real(c_rp) :: c
84 integer(c_int) :: n
85 end subroutine hip_cmult
86
87 subroutine hip_cmult2(a_d, b_d, c, n) &
88 bind(c, name = 'hip_cmult2')
89 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
90 import c_rp
91 type(c_ptr), value :: a_d, b_d
92 real(c_rp) :: c
93 integer(c_int) :: n
94 end subroutine hip_cmult2
95
96 subroutine hip_cadd(a_d, c, n) &
97 bind(c, name = 'hip_cadd')
98 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
99 import c_rp
100 type(c_ptr), value :: a_d
101 real(c_rp) :: c
102 integer(c_int) :: n
103 end subroutine hip_cadd
104
105 subroutine hip_cadd2(a_d, b_d, c, n) &
106 bind(c, name = 'hip_cadd2')
107 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
108 import c_rp
109 type(c_ptr), value :: a_d
110 type(c_ptr), value :: b_d
111 real(c_rp) :: c
112 integer(c_int) :: n
113 end subroutine hip_cadd2
114
115 subroutine hip_cfill(a_d, c, n) &
116 bind(c, name = 'hip_cfill')
117 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
118 import c_rp
119 type(c_ptr), value :: a_d
120 real(c_rp) :: c
121 integer(c_int) :: n
122 end subroutine hip_cfill
123
124 subroutine hip_rzero(a_d, n) &
125 bind(c, name = 'hip_rzero')
126 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
127 type(c_ptr), value :: a_d
128 integer(c_int) :: n
129 end subroutine hip_rzero
130
131 subroutine hip_add2(a_d, b_d, n) &
132 bind(c, name = 'hip_add2')
133 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
134 import c_rp
135
136 type(c_ptr), value :: a_d, b_d
137 integer(c_int) :: n
138 end subroutine hip_add2
139
140 subroutine hip_add4(a_d, b_d, c_d, d_d, n) &
141 bind(c, name = 'hip_add4')
142 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
143 import c_rp
144
145 type(c_ptr), value :: a_d, b_d, c_d, d_d
146 integer(c_int) :: n
147 end subroutine hip_add4
148
149 subroutine hip_add2s1(a_d, b_d, c1, n) &
150 bind(c, name = 'hip_add2s1')
151 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
152 import c_rp
153
154 type(c_ptr), value :: a_d, b_d
155 real(c_rp) :: c1
156 integer(c_int) :: n
157 end subroutine hip_add2s1
158
159 subroutine hip_add2s2(a_d, b_d, c1, n) &
160 bind(c, name = 'hip_add2s2')
161 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
162 import c_rp
163
164 type(c_ptr), value :: a_d, b_d
165 real(c_rp) :: c1
166 integer(c_int) :: n
167 end subroutine hip_add2s2
168
169 subroutine hip_add2s2_many(y_d, x_d_d, a_d, j, n) &
170 bind(c, name = 'hip_add2s2_many')
171 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
172 import c_rp
173
174 type(c_ptr), value :: y_d, x_d_d, a_d
175 integer(c_int) :: j, n
176 end subroutine hip_add2s2_many
177
178 subroutine hip_addsqr2s2(a_d, b_d, c1, n) &
179 bind(c, name = 'hip_addsqr2s2')
180 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
181 import c_rp
182
183 type(c_ptr), value :: a_d, b_d
184 real(c_rp) :: c1
185 integer(c_int) :: n
186 end subroutine hip_addsqr2s2
187
188 subroutine hip_add3s2(a_d, b_d, c_d, c1, c2, n) &
189 bind(c, name = 'hip_add3s2')
190 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
191 import c_rp
192
193 type(c_ptr), value :: a_d, b_d, c_d
194 real(c_rp) :: c1, c2
195 integer(c_int) :: n
196 end subroutine hip_add3s2
197
198 subroutine hip_invcol1(a_d, n) &
199 bind(c, name = 'hip_invcol1')
200 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
201
202 type(c_ptr), value :: a_d
203 integer(c_int) :: n
204 end subroutine hip_invcol1
205
206 subroutine hip_invcol2(a_d, b_d, n) &
207 bind(c, name = 'hip_invcol2')
208 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
209
210 type(c_ptr), value :: a_d, b_d
211 integer(c_int) :: n
212 end subroutine hip_invcol2
213
214 subroutine hip_col2(a_d, b_d, n) &
215 bind(c, name = 'hip_col2')
216 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
217
218 type(c_ptr), value :: a_d, b_d
219 integer(c_int) :: n
220 end subroutine hip_col2
221
222 subroutine hip_col3(a_d, b_d, c_d, n) &
223 bind(c, name = 'hip_col3')
224 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
225
226 type(c_ptr), value :: a_d, b_d, c_d
227 integer(c_int) :: n
228 end subroutine hip_col3
229
230 subroutine hip_subcol3(a_d, b_d, c_d, n) &
231 bind(c, name = 'hip_subcol3')
232 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
233
234 type(c_ptr), value :: a_d, b_d, c_d
235 integer(c_int) :: n
236 end subroutine hip_subcol3
237
238 subroutine hip_sub2(a_d, b_d, n) &
239 bind(c, name = 'hip_sub2')
240 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
241
242 type(c_ptr), value :: a_d, b_d
243 integer(c_int) :: n
244 end subroutine hip_sub2
245
246 subroutine hip_sub3(a_d, b_d, c_d, n) &
247 bind(c, name = 'hip_sub3')
248 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
249
250 type(c_ptr), value :: a_d, b_d, c_d
251 integer(c_int) :: n
252 end subroutine hip_sub3
253
254 subroutine hip_add3(a_d, b_d, c_d, n) &
255 bind(c, name = 'hip_add3')
256 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
257
258 type(c_ptr), value :: a_d, b_d, c_d
259 integer(c_int) :: n
260 end subroutine hip_add3
261
262 subroutine hip_addcol3(a_d, b_d, c_d, n) &
263 bind(c, name = 'hip_addcol3')
264 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
265
266 type(c_ptr), value :: a_d, b_d, c_d
267 integer(c_int) :: n
268 end subroutine hip_addcol3
269
270 subroutine hip_addcol4(a_d, b_d, c_d, d_d, n) &
271 bind(c, name = 'hip_addcol4')
272 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
273
274 type(c_ptr), value :: a_d, b_d, c_d, d_d
275 integer(c_int) :: n
276 end subroutine hip_addcol4
277
278 subroutine hip_vdot3(dot_d, u1_d, u2_d, u3_d, v1_d, v2_d, v3_d, n) &
279 bind(c, name = 'hip_vdot3')
280 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
281
282 type(c_ptr), value :: dot_d, u1_d, u2_d, u3_d, v1_d, v2_d, v3_d
283 integer(c_int) :: n
284 end subroutine hip_vdot3
285
286 subroutine hip_vcross(u1_d, u2_d, u3_d, v1_d, v2_d, v3_d, &
287 w1_d, w2_d, w3_d, n) &
288 bind(c, name = 'hip_vcross')
289 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
290
291 type(c_ptr), value :: u1_d, u2_d, u3_d
292 type(c_ptr), value :: v1_d, v2_d, v3_d
293 type(c_ptr), value :: w1_d, w2_d, w3_d
294 integer(c_int) :: n
295 end subroutine hip_vcross
296
297 real(c_rp) function hip_vlsc3(u_d, v_d, w_d, n) &
298 bind(c, name = 'hip_vlsc3')
299 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
300 import c_rp
301
302 type(c_ptr), value :: u_d, v_d, w_d
303 integer(c_int) :: n
304 end function hip_vlsc3
305
306 real(c_rp) function hip_glsc3(a_d, b_d, c_d, n) &
307 bind(c, name = 'hip_glsc3')
308 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
309 import c_rp
310
311 type(c_ptr), value :: a_d, b_d, c_d
312 integer(c_int) :: n
313 end function hip_glsc3
314
315 subroutine hip_glsc3_many(h, w_d, v_d_d, mult_d, j, n) &
316 bind(c, name = 'hip_glsc3_many')
317 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
318 import c_rp
319
320 type(c_ptr), value :: w_d, v_d_d, mult_d
321 integer(c_int) :: j, n
322 real(c_rp) :: h(j)
323 end subroutine hip_glsc3_many
324
325 real(c_rp) function hip_glsc2(a_d, b_d, n) &
326 bind(c, name = 'hip_glsc2')
327 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
328 import c_rp
329
330 type(c_ptr), value :: a_d, b_d
331 integer(c_int) :: n
332 end function hip_glsc2
333
334 real(c_rp) function hip_glsum(a_d, n) &
335 bind(c, name = 'hip_glsum')
336 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
337 import c_rp
338
339 type(c_ptr), value :: a_d
340 integer(c_int) :: n
341 end function hip_glsum
342
343 subroutine hip_absval(a_d, n) &
344 bind(c, name = 'hip_absval')
345 use, intrinsic :: iso_c_binding, only: c_ptr, c_int
346 import c_rp
347
348 type(c_ptr), value :: a_d
349 integer(c_int) :: n
350 end subroutine hip_absval
351 end interface
352
353end module hip_math
integer, parameter, public c_rp
Definition num_types.f90:13
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12