63 use mpi_f08,
only : mpi_min, mpi_max, mpi_sum, mpi_in_place, mpi_integer, &
70 real(kind=
rp),
public,
parameter ::
neko_eps = epsilon(1.0_rp)
76 real(kind=
rp),
public,
parameter ::
pi = 4._rp*atan(1._rp)
104 vcross,
vdot2,
vdot3,
vlsc3,
vlsc2,
add2,
add3,
add4,
sub2,
sub3, &
120 real(kind=
sp),
intent(in) :: x
121 real(kind=
sp),
intent(in) :: y
122 real(kind=
sp),
intent(in),
optional :: tol
125 if (
present(tol))
then
135 real(kind=
dp),
intent(in) :: x
136 real(kind=
dp),
intent(in) :: y
137 real(kind=
dp),
intent(in),
optional :: tol
140 if (
present(tol))
then
150 real(kind=
qp),
intent(in) :: x
151 real(kind=
qp),
intent(in) :: y
152 real(kind=
qp),
intent(in),
optional :: tol
155 if (
present(tol))
then
165 real(kind=
sp),
intent(in) :: x
166 real(kind=
sp),
intent(in) :: y
167 real(kind=
sp),
intent(in),
optional :: eps
169 if (
present(eps))
then
170 srelcmp = abs(x - y) .le. eps*abs(y)
179 real(kind=
dp),
intent(in) :: x
180 real(kind=
dp),
intent(in) :: y
181 real(kind=
dp),
intent(in),
optional :: eps
183 if (
present(eps))
then
184 drelcmp = abs(x - y) .le. eps*abs(y)
194 real(kind=
qp),
intent(in) :: x
195 real(kind=
qp),
intent(in) :: y
196 real(kind=
qp),
intent(in),
optional :: eps
198 if (
present(eps))
then
199 qrelcmp = abs(x - y)/abs(y) .lt. eps
212 real(kind=
rp),
intent(in) :: x
213 integer,
intent(in) :: niter
218 if (x == 0.0_rp)
then
223 a = 1.0_rp / (1.0_rp + 0.5_rp * log(1.0_rp + x))
224 w = log(1.0_rp + a * x)
226 do k = 1,
max(niter, 0)
227 w = w / (1.0_rp + w) * (1.0_rp + log(x / w))
233 integer,
intent(in) :: n
234 real(kind=
rp),
dimension(n),
intent(inout) :: a
237 do concurrent(i = 1:n)
244 integer,
intent(in) :: n
245 integer,
dimension(n),
intent(inout) :: a
248 do concurrent(i = 1:n)
255 integer,
intent(in) :: m, n, e
256 real(kind=
rp),
intent(inout) :: a(m,n)
259 do concurrent(j = 1:n)
266 integer,
intent(in) :: n
267 real(kind=
rp),
dimension(n),
intent(inout) :: a
270 do concurrent(i = 1:n)
277 integer,
intent(in) :: n
278 real(kind=
rp),
dimension(n),
intent(in) :: b
279 real(kind=
rp),
dimension(n),
intent(inout) :: a
282 do concurrent(i = 1:n)
296 integer,
intent(in) :: n, n_mask
297 real(kind=
rp),
dimension(n),
intent(in) :: b
298 real(kind=
rp),
dimension(n),
intent(inout) :: a
299 integer,
dimension(0:n_mask) ::
mask
302 do concurrent(i = 1:n_mask)
317 integer,
intent(in) :: n, n_mask
318 real(kind=
rp),
dimension(n),
intent(in) :: b
319 real(kind=
rp),
dimension(n),
intent(inout) :: a
320 integer,
dimension(n_mask) ::
mask
323 do concurrent(i = 1:n_mask)
340 integer,
intent(in) :: n, n_mask
341 real(kind=
rp),
dimension(n),
intent(in) :: b
342 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
343 integer,
dimension(0:n_mask) ::
mask
346 do concurrent(i = 1:n_mask)
363 integer,
intent(in) :: lx, ly, lz, n_mask
364 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
365 real(kind=
rp),
dimension(:, :, :, :),
intent(in) :: b
366 integer,
dimension(0:n_mask),
intent(in) ::
mask
367 integer,
dimension(0:n_mask),
intent(in) :: facet
374 select case (facet(l))
376 a(l) = b(idx(2), idx(3), facet(l), idx(4))
378 a(l) = b(idx(1), idx(3), facet(l), idx(4))
380 a(l) = b(idx(1), idx(2), facet(l), idx(4))
396 integer,
intent(in) :: n, n_mask
397 real(kind=
rp),
dimension(n),
intent(in) :: b
398 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
399 integer,
dimension(n_mask) ::
mask
402 do concurrent(i = 1:n_mask)
419 integer,
intent(in) :: n, n_mask
420 real(kind=
rp),
dimension(n_mask),
intent(in) :: b
421 real(kind=
rp),
dimension(n),
intent(inout) :: a
422 integer,
dimension(0:n_mask) ::
mask
425 do concurrent(i = 1:n_mask)
442 integer,
intent(in) :: n, n_mask
443 real(kind=
rp),
dimension(n_mask),
intent(in) :: b
444 real(kind=
rp),
dimension(n),
intent(inout) :: a
445 integer,
dimension(n_mask) ::
mask
448 do concurrent(i = 1:n_mask)
458 integer,
intent(in) :: n, n_mask
459 real(kind=
rp),
dimension(n),
intent(inout) :: a
460 real(kind=
rp),
intent(in) :: c
461 integer,
dimension(n_mask),
intent(in) ::
mask
464 do concurrent(i = 1:n_mask)
472 integer,
intent(in) :: n
473 real(kind=
rp),
dimension(n),
intent(inout) :: a
474 real(kind=
rp),
intent(in) :: c
477 do concurrent(i = 1:n)
484 integer,
intent(in) :: n
485 real(kind=
rp),
dimension(n),
intent(inout) :: a
486 real(kind=
rp),
dimension(n),
intent(in) :: b
487 real(kind=
rp),
intent(in) :: c
490 do concurrent(i = 1:n)
498 integer,
intent(in) :: n
499 real(kind=
rp),
dimension(n),
intent(inout) :: a
500 real(kind=
rp),
intent(in) :: c
503 do concurrent(i = 1:n)
510 integer,
intent(in) :: n
511 real(kind=
rp),
dimension(n),
intent(inout) :: a
512 real(kind=
rp),
dimension(n),
intent(in) :: b
513 real(kind=
rp),
intent(in) :: c
516 do concurrent(i = 1:n)
523 integer,
intent(in) :: n
524 real(kind=
rp),
dimension(n),
intent(inout) :: a
525 real(kind=
rp),
intent(in) :: s
528 do concurrent(i = 1:n)
535 integer,
intent(in) :: n
536 real(kind=
rp),
dimension(n),
intent(inout) :: a
537 real(kind=
rp),
dimension(n),
intent(in) :: b
538 real(kind=
rp),
intent(in) :: s
541 do concurrent(i = 1:n)
548 integer,
intent(in) :: n
549 real(kind=
rp),
dimension(n),
intent(inout) :: a
550 real(kind=
rp),
intent(in) :: c
553 do concurrent(i = 1:n)
559 subroutine cwrap(a, min_val, max_val, n)
560 integer,
intent(in) :: n
561 real(kind=
rp),
dimension(n),
intent(inout) :: a
562 real(kind=
rp),
intent(in) :: min_val, max_val
565 if (n .lt. 1 .or. max_val .le. min_val)
return
567 do concurrent(i = 1:n)
568 a(i) = modulo(a(i) - min_val, max_val - min_val) + min_val
574 integer,
intent(in) :: n
575 real(kind=
rp),
dimension(n) :: a
583 call mpi_allreduce(mpi_in_place, tmp, 1, &
591 integer,
intent(in) :: n
592 real(kind=
rp),
dimension(n) :: a
600 call mpi_allreduce(tmp,
glmax, 1, &
606 integer,
intent(in) :: n
607 integer,
dimension(n) :: a
615 call mpi_allreduce(tmp,
glimax, 1, &
621 integer,
intent(in) :: n
622 real(kind=
rp),
dimension(n) :: a
630 call mpi_allreduce(tmp,
glmin, 1, &
636 integer,
intent(in) :: n
637 integer,
dimension(n) :: a
645 call mpi_allreduce(tmp,
glimin, 1, &
654 integer,
intent(in) :: n
655 real(kind=
rp),
dimension(n),
intent(inout) :: a
658 do concurrent(i = 1:n)
667 real(kind=
rp),
intent(in) :: vec(n)
668 real(kind=
rp) :: tmax
671 tmax =
max(tmax, vec(i))
677 integer,
intent(in) :: n
678 real(kind=
rp),
intent(in) :: vec(n)
679 real(kind=
rp) :: tmin
683 tmin = min(tmin, vec(i))
689 integer,
intent(in) :: n
690 real(kind=
rp),
dimension(n),
intent(inout) :: a
693 do concurrent(i = 1:n)
694 a(i) = 1.0_xp /
real(a(i),
xp)
701 integer,
intent(in) :: n
702 real(kind=
rp),
dimension(n),
intent(inout) :: a
703 real(kind=
rp),
dimension(n),
intent(in) :: b, c
706 do concurrent(i = 1:n)
707 a(i) =
real(b(i),
xp) / c(i)
714 integer,
intent(in) :: n
715 real(kind=
rp),
dimension(n),
intent(inout) :: a
716 real(kind=
rp),
dimension(n),
intent(in) :: b
719 do concurrent(i = 1:n)
720 a(i) = 1.0_xp /
real(b(i),
xp)
727 subroutine vcross(u1, u2, u3, v1, v2, v3, w1, w2, w3, n)
728 integer,
intent(in) :: n
729 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
730 real(kind=
rp),
dimension(n),
intent(in) :: w1, w2, w3
731 real(kind=
rp),
dimension(n),
intent(out) :: u1, u2, u3
734 do concurrent(i = 1:n)
735 u1(i) = v2(i)*w3(i) - v3(i)*w2(i)
736 u2(i) = v3(i)*w1(i) - v1(i)*w3(i)
737 u3(i) = v1(i)*w2(i) - v2(i)*w1(i)
744 subroutine vdot2(dot, u1, u2, v1, v2, n)
745 integer,
intent(in) :: n
746 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2
747 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2
748 real(kind=
rp),
dimension(n),
intent(out) :: dot
750 do concurrent(i = 1:n)
751 dot(i) = u1(i)*v1(i) + u2(i)*v2(i)
758 subroutine vdot3(dot, u1, u2, u3, v1, v2, v3, n)
759 integer,
intent(in) :: n
760 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2, u3
761 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
762 real(kind=
rp),
dimension(n),
intent(out) :: dot
765 do concurrent(i = 1:n)
766 dot(i) = u1(i)*v1(i) + u2(i)*v2(i) + u3(i)*v3(i)
772 function vlsc3(u, v, w, n)
result(s)
773 integer,
intent(in) :: n
774 real(kind=
rp),
dimension(n),
intent(in) :: u, v, w
780 s = s + u(i)*v(i)*w(i)
787 integer,
intent(in) :: n
788 real(kind=
rp),
dimension(n),
intent(in) :: u, v
801 integer,
intent(in) :: n
802 real(kind=
rp),
dimension(n),
intent(inout) :: a
803 real(kind=
rp),
dimension(n),
intent(in) :: b
806 do concurrent(i = 1:n)
814 integer,
intent(in) :: n
815 real(kind=
rp),
dimension(n),
intent(inout) :: a
816 real(kind=
rp),
dimension(n),
intent(in) :: b
817 real(kind=
rp),
dimension(n),
intent(in) :: c
820 do concurrent(i = 1:n)
828 integer,
intent(in) :: n
829 real(kind=
rp),
dimension(n),
intent(out) :: a
830 real(kind=
rp),
dimension(n),
intent(in) :: d
831 real(kind=
rp),
dimension(n),
intent(in) :: c
832 real(kind=
rp),
dimension(n),
intent(in) :: b
835 do concurrent(i = 1:n)
836 a(i) = b(i) + c(i) + d(i)
843 integer,
intent(in) :: n
844 real(kind=
rp),
dimension(n),
intent(inout) :: a
845 real(kind=
rp),
dimension(n),
intent(in) :: b
848 do concurrent(i = 1:n)
856 integer,
intent(in) :: n
857 real(kind=
rp),
dimension(n),
intent(inout) :: a
858 real(kind=
rp),
dimension(n),
intent(in) :: b
859 real(kind=
rp),
dimension(n),
intent(in) :: c
862 do concurrent(i = 1:n)
872 integer,
intent(in) :: n
873 real(kind=
rp),
dimension(n),
intent(inout) :: a
874 real(kind=
rp),
dimension(n),
intent(in) :: b
875 real(kind=
rp),
intent(in) :: c1
878 do concurrent(i = 1:n)
879 a(i) = c1 * a(i) + b(i)
887 integer,
intent(in) :: n
888 real(kind=
rp),
dimension(n),
intent(inout) :: a
889 real(kind=
rp),
dimension(n),
intent(in) :: b
890 real(kind=
rp),
intent(in) :: c1
893 do concurrent(i = 1:n)
894 a(i) = a(i) + c1 * b(i)
901 integer,
intent(in) :: n
902 real(kind=
rp),
dimension(n),
intent(inout) :: a
903 real(kind=
rp),
dimension(n),
intent(in) :: b
904 real(kind=
rp),
intent(in) :: c1
907 do concurrent(i = 1:n)
908 a(i) = a(i) + c1 * ( b(i) * b(i) )
915 integer,
intent(in) :: n
916 real(kind=
rp),
dimension(n),
intent(inout) :: a
917 real(kind=
rp),
dimension(n),
intent(in) :: b
920 do concurrent(i = 1:n)
921 a(i) =
real(a(i),
xp) / b(i)
929 integer,
intent(in) :: n
930 real(kind=
rp),
dimension(n),
intent(inout) :: a
931 real(kind=
rp),
dimension(n),
intent(in) :: b
934 do concurrent(i = 1:n)
942 integer,
intent(in) :: n
943 real(kind=
rp),
dimension(n),
intent(inout) :: a
944 real(kind=
rp),
dimension(n),
intent(in) :: b
945 real(kind=
rp),
dimension(n),
intent(in) :: c
948 do concurrent(i = 1:n)
956 integer,
intent(in) :: n
957 real(kind=
rp),
dimension(n),
intent(inout) :: a
958 real(kind=
rp),
dimension(n),
intent(in) :: b
959 real(kind=
rp),
dimension(n),
intent(in) :: c
962 do concurrent(i = 1:n)
963 a(i) = a(i) - b(i) * c(i)
970 integer,
intent(in) :: n
971 real(kind=
rp),
dimension(n),
intent(inout) :: a
972 real(kind=
rp),
dimension(n),
intent(in) :: b
973 real(kind=
rp),
dimension(n),
intent(in) :: c
974 real(kind=
rp),
intent(in) :: c1, c2
977 do concurrent(i = 1:n)
978 a(i) = c1 * b(i) + c2 * c(i)
984 subroutine add4s3(a, b, c, d, c1, c2, c3, n)
985 integer,
intent(in) :: n
986 real(kind=
rp),
dimension(n),
intent(inout) :: a
987 real(kind=
rp),
dimension(n),
intent(in) :: b
988 real(kind=
rp),
dimension(n),
intent(in) :: c
989 real(kind=
rp),
dimension(n),
intent(in) :: d
990 real(kind=
rp),
intent(in) :: c1, c2, c3
993 do concurrent(i = 1:n)
994 a(i) = c1 * b(i) + c2 * c(i) + c3 * d(i)
1000 subroutine add5s4(a, b, c, d, e, c1, c2, c3, c4, n)
1001 integer,
intent(in) :: n
1002 real(kind=
rp),
dimension(n),
intent(inout) :: a
1003 real(kind=
rp),
dimension(n),
intent(in) :: b
1004 real(kind=
rp),
dimension(n),
intent(in) :: c
1005 real(kind=
rp),
dimension(n),
intent(in) :: d
1006 real(kind=
rp),
dimension(n),
intent(in) :: e
1007 real(kind=
rp),
intent(in) :: c1, c2, c3, c4
1010 do concurrent(i = 1:n)
1011 a(i) = a(i) + c1 * b(i) + c2 * c(i) + c3 * d(i) + c4 * e(i)
1018 integer,
intent(in) :: n
1019 real(kind=
rp),
dimension(n),
intent(inout) :: a
1020 real(kind=
rp),
dimension(n),
intent(in) :: b
1021 real(kind=
rp),
dimension(n),
intent(in) :: c
1022 real(kind=
rp),
dimension(n),
intent(in) :: d
1025 do concurrent(i = 1:n)
1026 a(i) = a(i) - b(i) * c(i) * d(i)
1033 integer,
intent(in) :: n
1034 real(kind=
rp),
dimension(n),
intent(inout) :: a
1035 real(kind=
rp),
dimension(n),
intent(in) :: b
1036 real(kind=
rp),
dimension(n),
intent(in) :: c
1039 do concurrent(i = 1:n)
1040 a(i) = a(i) + b(i) * c(i)
1047 integer,
intent(in) :: n
1048 real(kind=
rp),
dimension(n),
intent(inout) :: a
1049 real(kind=
rp),
dimension(n),
intent(in) :: b
1050 real(kind=
rp),
dimension(n),
intent(in) :: c
1051 real(kind=
rp),
dimension(n),
intent(in) :: d
1054 do concurrent(i = 1:n)
1055 a(i) = a(i) + b(i) * c(i) * d(i)
1062 integer,
intent(in) :: n
1063 real(kind=
rp),
dimension(n),
intent(inout) :: a
1064 real(kind=
rp),
dimension(n),
intent(in) :: b
1065 real(kind=
rp),
dimension(n),
intent(in) :: c
1066 real(kind=
rp),
intent(in) :: s
1069 do concurrent(i = 1:n)
1070 a(i) = a(i) + s * b(i) * c(i)
1077 integer,
intent(in) :: n
1078 real(kind=
rp),
dimension(n),
intent(inout) :: a
1079 real(kind=
rp),
dimension(n),
intent(in) :: b
1080 real(kind=
rp),
dimension(n),
intent(in) :: c
1081 real(kind=
rp),
dimension(n),
intent(in) :: d
1082 real(kind=
rp),
dimension(n),
intent(in) :: e
1085 do concurrent(i = 1:n)
1086 a(i) = b(i)*c(i) - d(i)*e(i)
1093 integer,
intent(in) :: n
1094 real(kind=
rp),
dimension(n),
intent(inout) :: a
1095 real(kind=
rp),
dimension(n),
intent(in) :: b
1096 real(kind=
rp),
dimension(n),
intent(in) :: c
1097 real(kind=
rp),
intent(in) :: c1, c2
1100 do concurrent(i = 1:n)
1101 a(i) = b(i) + c1*(a(i)-c2*c(i))
1108 integer,
intent(in) :: n
1109 real(kind=
rp),
dimension(n),
intent(inout) :: a
1110 real(kind=
rp),
dimension(n),
intent(in) :: b
1111 real(kind=
rp),
dimension(n),
intent(in) :: c
1112 real(kind=
rp),
intent(in) :: c1, c2
1115 do concurrent(i = 1:n)
1116 a(i) = a(i) + c1*b(i)+c2*c(i)
1123 integer,
intent(in) :: n
1124 real(kind=
rp),
dimension(n),
intent(in) :: a
1125 real(kind=
rp),
dimension(n),
intent(in) :: b
1127 real(kind=
xp) :: tmp
1132 tmp = tmp + a(i) * b(i)
1135 call mpi_allreduce(mpi_in_place, tmp, 1, &
1142 integer,
intent(in) :: n
1143 real(kind=
rp),
dimension(n),
intent(in) :: a
1144 real(kind=
rp),
dimension(n),
intent(in) :: b
1145 real(kind=
rp),
dimension(n),
intent(in) :: c
1147 real(kind=
xp) :: tmp
1152 tmp = tmp + a(i) * b(i) * c(i)
1155 call mpi_allreduce(mpi_in_place, tmp, 1, &
1161 integer,
intent(in) :: n
1162 real(kind=
rp),
dimension(n),
intent(in) :: a
1163 real(kind=
rp),
dimension(n),
intent(in) :: b
1164 real(kind=
rp),
dimension(n),
intent(in) :: c
1165 real(kind=
rp),
dimension(n),
intent(in) :: d
1167 real(kind=
xp) :: tmp
1172 tmp = tmp + a(i) * b(i) * c(i) * d(i)
1175 call mpi_allreduce(mpi_in_place, tmp, 1, &
1184 integer,
intent(in) :: n
1185 real(kind=
rp),
dimension(n),
intent(in) :: a
1186 real(kind=
rp),
dimension(n),
intent(in) :: b
1188 real(kind=
xp) :: tmp
1193 tmp = tmp + (a(i) - b(i))**2
1196 call mpi_allreduce(mpi_in_place, tmp, 1, &
1208 integer,
intent(in) :: n
1209 real(kind=
rp),
intent(inout) :: a(n)
1210 integer,
intent(out) :: ind(n)
1212 integer :: j, ir, i, ii, l
1218 if (n .le. 1)
return
1242 do while (j .le. ir)
1244 if ( a(j) .lt. a(j+1) ) j = j + 1
1246 if (aa .lt. a(j))
then
1266 integer,
intent(in) :: n
1267 integer(i4),
intent(inout) :: a(n)
1268 integer,
intent(out) :: ind(n)
1270 integer :: j, ir, i, ii, l
1276 if (n .le. 1)
return
1299 do while (j .le. ir)
1301 if ( a(j) .lt. a(j + 1) ) j = j + 1
1303 if (aa .lt. a(j))
then
1322 integer,
intent(in) :: n
1323 real(kind=
rp),
intent(inout) :: b(n)
1324 integer,
intent(in) :: ind(n)
1325 real(kind=
rp) :: temp(n)
1342 integer,
intent(in) :: n
1343 integer(i4),
intent(inout) :: b(n)
1344 integer,
intent(in) :: ind(n)
1345 integer(i4) :: temp(n)
1362 integer,
intent(in) :: n
1363 real(kind=
rp),
intent(inout) :: b(n)
1364 integer,
intent(in) :: ind(n)
1365 real(kind=
rp) :: temp(n)
1382 integer,
intent(in) :: n
1383 integer(i4),
intent(inout) :: b(n)
1384 integer,
intent(in) :: ind(n)
1385 integer(i4) :: temp(n)
1402 integer,
intent(in) :: n
1403 real(kind=
rp),
intent(inout) :: b(n)
1404 integer,
intent(inout) :: ind(n)
1405 real(kind=
rp) :: temp(n)
1406 integer :: tempind(n)
1412 tempind(jj) = ind(i)
1425 integer,
intent(in) :: n
1426 integer(i4),
intent(inout) :: b(n)
1427 integer,
intent(inout) :: ind(n)
1428 integer(i4) :: temp(n)
1429 integer :: tempind(n)
1435 tempind(jj) = ind(i)
1447 integer,
intent(in) :: n
1448 real(kind=
rp),
dimension(n),
intent(inout) :: a
1460 integer,
intent(in) :: n
1461 real(kind=
rp),
dimension(n),
intent(inout) :: a
1462 real(kind=
rp),
dimension(n),
intent(in) :: b
1466 a(i) =
max(a(i), b(i))
1472 integer,
intent(in) :: n
1473 real(kind=
rp),
dimension(n),
intent(inout) :: a
1474 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1478 a(i) =
max(b(i), c(i))
1484 integer,
intent(in) :: n
1485 real(kind=
rp),
dimension(n),
intent(inout) :: a
1486 real(kind=
rp),
intent(in) :: b
1496 integer,
intent(in) :: n
1497 real(kind=
rp),
dimension(n),
intent(inout) :: a
1498 real(kind=
rp),
dimension(n),
intent(in) :: b
1499 real(kind=
rp),
intent(in) :: c
1509 integer,
intent(in) :: n
1510 real(kind=
rp),
dimension(n),
intent(inout) :: a
1511 real(kind=
rp),
dimension(n),
intent(in) :: b
1515 a(i) = min(a(i), b(i))
1521 integer,
intent(in) :: n
1522 real(kind=
rp),
dimension(n),
intent(inout) :: a
1523 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1527 a(i) = min(b(i), c(i))
1533 integer,
intent(in) :: n
1534 real(kind=
rp),
dimension(n),
intent(inout) :: a
1535 real(kind=
rp),
intent(in) :: b
1545 integer,
intent(in) :: n
1546 real(kind=
rp),
dimension(n),
intent(inout) :: a
1547 real(kind=
rp),
dimension(n),
intent(in) :: b
1548 real(kind=
rp),
intent(in) :: c
1559 function matinv39(a11, a12, a13, a21, a22, a23, a31, a32, a33) &
1561 real(kind=
rp),
intent(in) :: a11, a12, a13, a21, a22, a23, a31, a32, a33
1582 real(kind=
xp),
intent(in) :: a(3,3)
1583 real(kind=
xp) :: b(3,3)
1584 real(kind=
xp) :: detinv
1588 detinv = 1.0_xp /
real(a(1,1)*a(2,2)*a(3,3) - a(1,1)*a(2,3)*a(3,2) &
1589 - a(1,2)*a(2,1)*a(3,3) + a(1,2)*a(2,3)*a(3,1)&
1590 + a(1,3)*a(2,1)*a(3,2) - a(1,3)*a(2,2)*a(3,1),
xp)
1593 b(1,1) = +detinv * (a(2,2)*a(3,3) - a(2,3)*a(3,2))
1594 b(2,1) = -detinv * (a(2,1)*a(3,3) - a(2,3)*a(3,1))
1595 b(3,1) = +detinv * (a(2,1)*a(3,2) - a(2,2)*a(3,1))
1596 b(1,2) = -detinv * (a(1,2)*a(3,3) - a(1,3)*a(3,2))
1597 b(2,2) = +detinv * (a(1,1)*a(3,3) - a(1,3)*a(3,1))
1598 b(3,2) = -detinv * (a(1,1)*a(3,2) - a(1,2)*a(3,1))
1599 b(1,3) = +detinv * (a(1,2)*a(2,3) - a(1,3)*a(2,2))
1600 b(2,3) = -detinv * (a(1,1)*a(2,3) - a(1,3)*a(2,1))
1601 b(3,3) = +detinv * (a(1,1)*a(2,2) - a(1,2)*a(2,1))
1607 real(kind=
rp),
intent(in) :: x
1608 real(kind=
rp) :: val
1609 real(kind=
rp),
parameter :: xdmin = 0.0001_rp
1610 real(kind=
rp),
parameter :: xdmax = 0.9999_rp
1613 if (x <= xdmin)
then
1616 else if (x >= xdmax)
then
1621 g = (1.0_rp / (x - 1.0_rp)) + (1.0_rp / x)
1624 val = 1.0_rp / (1.0_rp + exp(g))
1630 real(kind=
rp),
intent(in) :: x
1631 real(kind=
rp) :: val
1632 real(kind=
rp),
parameter :: xdmin = 0.0001_rp
1633 real(kind=
rp),
parameter :: xdmax = 0.9999_rp
1634 real(kind=
rp) :: arg, g, dg, s_val
1636 if (x <= xdmin .or. x >= xdmax)
then
1643 g = (1.0_rp / (x - 1.0_rp)) + (1.0_rp / x)
1646 dg = -(1.0_rp / ((x - 1.0_rp)**2)) - (1.0_rp / (x**2))
1649 s_val = 1.0_rp / (1.0_rp + exp(g))
1651 val = -s_val * (1.0_rp - s_val) * dg
__inline__ __device__ void nonlinear_index(const int idx, const int lx, int *index)
type(mpi_datatype), public mpi_real_precision
MPI type for working precision of REAL types.
type(mpi_comm), public neko_comm
MPI communicator.
type(mpi_datatype), public mpi_extra_precision
Object for handling masks in Neko.
subroutine, public cmult(a, c, n)
Multiplication by constant c .
subroutine, public cmult2(a, b, c, n)
Multiplication by constant c .
subroutine, public row_zero(a, m, n, e)
Sets row e to 0 in matrix a.
subroutine, public invcol2(a, b, n)
Vector division .
real(kind=rp) function, public vlsc2(u, v, n)
Compute multiplication sum .
pure logical function, public dabscmp(x, y, tol)
Return double precision absolute comparison .
real(kind=rp), parameter, public pi
pure logical function qabscmp(x, y, tol)
Return double precision absolute comparison .
real(kind=rp) function, public glsc3(a, b, c, n)
Weighted inner product .
subroutine, public ascol5(a, b, c, d, e, n)
Returns .
subroutine, public addcol3s2(a, b, c, s, n)
Returns .
subroutine, public masked_scatter_copy(a, b, mask, n, n_mask)
Scatter a contigous vector to masked positions in a target array .
subroutine, public invers2(a, b, n)
Compute inverted vector .
subroutine, public cadd2(a, b, s, n)
Add a scalar to vector .
subroutine, public face_masked_gather_copy_0(a, b, mask, facet, lx, ly, lz, n_mask)
Gather values from a face-local SEM field to a reduced contiguous vector.
real(rp) function, dimension(3, 3), public matinv39(a11, a12, a13, a21, a22, a23, a31, a32, a33)
subroutine, public cadd(a, s, n)
Add a scalar to vector .
subroutine, public masked_copy(a, b, mask, n, n_mask)
Copy a masked vector .
subroutine reorddp(b, ind, n)
reorder double precision array - inverse of swap
subroutine, public addsqr2s2(a, b, c1, n)
Returns .
subroutine, public cwrap(a, min_val, max_val, n)
Wrap value around a range [min, max)
real(kind=rp) function, public glsc4(a, b, c, d, n)
subroutine, public cdiv2(a, b, c, n)
Division of constant c by elements of a .
real(kind=rp) function, public math_stepf(x)
Smooth step function S(x) Returns 0 for x <= 0, 1 for x >= 1, and smooth transition in between.
subroutine swapdp(b, ind, n)
sort double precision array acording to ind vector
subroutine flipvi4(b, ind, n)
Flip single integer vector b and ind.
subroutine, public add2s1(a, b, c1, n)
Vector addition with scalar multiplication (multiplication on first argument)
subroutine, public cpwmin2(a, b, n)
Point-wise minimum of scalar and vector .
real(kind=rp) function, public glsc2(a, b, n)
Weighted inner product .
subroutine, public masked_scatter_copy_0(a, b, mask, n, n_mask)
Scatter a contigous vector to masked positions in a target array .
subroutine, public subcol3(a, b, c, n)
Returns .
subroutine, public rone(a, n)
Set all elements to one.
subroutine flipvdp(b, ind, n)
Flip double precision vector b and ind.
subroutine, public cpwmin3(a, b, c, n)
Point-wise minimum of scalar and vector .
subroutine, public pwmax3(a, b, c, n)
Point-wise maximum of two vectors .
subroutine, public masked_gather_copy(a, b, mask, n, n_mask)
Gather a masked vector to reduced contigous vector .
subroutine, public x_update(a, b, c, c1, c2, n)
Returns .
subroutine, public add3(a, b, c, n)
Vector addition .
subroutine swapi4(b, ind, n)
sort single integer array acording to ind vector
integer function, public glimin(a, n)
Min of an integer vector of length n.
real(kind=rp) function, public glsum(a, n)
Sum a vector of length n.
subroutine, public sub3(a, b, c, n)
Vector subtraction .
subroutine, public addcol4(a, b, c, d, n)
Returns .
subroutine, public add2(a, b, n)
Vector addition .
subroutine, public cfill(a, c, n)
Set all elements to a constant c .
subroutine, public absval(a, n)
Take the absolute value of an array.
subroutine, public invcol3(a, b, c, n)
Invert a vector .
subroutine, public add3s2(a, b, c, c1, c2, n)
Returns .
real(kind=xp) function, dimension(3, 3), public matinv3(a)
Performs a direct calculation of the inverse of a 3×3 matrix. M33INV and M44INV by David G....
subroutine, public pwmax2(a, b, n)
Point-wise maximum of two vectors .
subroutine, public pwmin2(a, b, n)
Point-wise minimum of two vectors .
subroutine, public masked_gather_copy_0(a, b, mask, n, n_mask)
Gather a masked vector to reduced contigous vector .
subroutine, public subcol4(a, b, c, d, n)
Returns .
subroutine sorti4(a, ind, n)
Heap Sort for single integer arrays.
subroutine, public addcol3(a, b, c, n)
Returns .
subroutine, public invcol1(a, n)
Invert a vector .
subroutine, public cdiv(a, c, n)
Division of constant c by elements of a .
real(kind=rp), parameter, public neko_m_ln2
subroutine, public chsign(a, n)
Change sign of vector .
subroutine, public cpwmax3(a, b, c, n)
Point-wise maximum of scalar and vector .
subroutine, public col2(a, b, n)
Vector multiplication .
subroutine, public izero(a, n)
Zero an integer vector.
real(kind=rp) function, public glmax(a, n)
Max of a vector of length n.
subroutine, public copy(a, b, n)
Copy a vector .
subroutine, public add4s3(a, b, c, d, c1, c2, c3, n)
Returns .
subroutine, public add4(a, b, c, d, n)
Vector addition .
subroutine, public col3(a, b, c, n)
Vector multiplication with 3 vectors .
subroutine, public add5s4(a, b, c, d, e, c1, c2, c3, c4, n)
Returns .
real(kind=rp) function, public math_dstepf(x)
Derivative of math_stepf with respect to x: d(stepf)/dx.
pure logical function drelcmp(x, y, eps)
Return double precision relative comparison .
real(kind=rp), parameter, public neko_eps
Machine epsilon .
subroutine, public vdot3(dot, u1, u2, u3, v1, v2, v3, n)
Compute a dot product (3-d version) assuming vector components etc.
pure logical function, public sabscmp(x, y, tol)
Return single precision absolute comparison .
pure logical function qrelcmp(x, y, eps)
Return quad precision relative comparison .
subroutine, public rzero(a, n)
Zero a real vector.
real(kind=rp) function, public glsubnorm(a, b, n)
Returns the norm of the difference of two vectors .
subroutine, public vdot2(dot, u1, u2, v1, v2, n)
Compute a dot product (2-d version) assuming vector components etc.
subroutine, public cpwmax2(a, b, n)
Point-wise maximum of scalar and vector .
real(kind=rp) function, public vlmin(vec, n)
minimun value of a vector of length n
subroutine, public cfill_mask(a, c, n, mask, n_mask)
Fill a constant to a masked vector. .
real(kind=rp) function, public vlmax(vec, n)
maximum value of a vector of length n
integer function, public glimax(a, n)
Max of an integer vector of length n.
subroutine sortrp(a, ind, n)
Heap Sort for double precision arrays.
subroutine, public sub2(a, b, n)
Vector substraction .
subroutine, public pwmin3(a, b, c, n)
Point-wise minimum of two vectors .
subroutine, public add2s2(a, b, c1, n)
Vector addition with scalar multiplication (multiplication on second argument)
real(kind=rp) function, public glmin(a, n)
Min of a vector of length n.
subroutine, public masked_copy_0(a, b, mask, n, n_mask)
Copy a masked vector .
subroutine, public vcross(u1, u2, u3, v1, v2, v3, w1, w2, w3, n)
Compute a cross product assuming vector components etc.
pure logical function srelcmp(x, y, eps)
Return single precision relative comparison .
pure real(kind=rp) function, public lambert_w0(x, niter)
Approximate the principal real branch of the Lambert W function for non-negative real x.
real(kind=rp) function, public vlsc3(u, v, w, n)
Compute multiplication sum .
subroutine reordi4(b, ind, n)
reorder single integer array - inverse of swap
subroutine, public p_update(a, b, c, c1, c2, n)
Returns .
integer, parameter, public qp
integer, parameter, public i4
integer, parameter, public xp
integer, parameter, public dp
integer, parameter, public sp
integer, parameter, public rp
Global precision used in computations.