63 use mpi_f08,
only: mpi_min, mpi_max, mpi_sum, mpi_in_place, mpi_integer, &
69 real(kind=
rp),
public,
parameter ::
neko_eps = epsilon(1.0_rp)
75 real(kind=
rp),
public,
parameter ::
pi = 4._rp*atan(1._rp)
111 vcross,
vdot2,
vdot3,
vlsc3,
vlsc2,
add2,
add3,
add4,
sub2,
sub3, &
121 real(kind=
sp),
intent(in) :: x
122 real(kind=
sp),
intent(in) :: y
131 real(kind=
dp),
intent(in) :: x
132 real(kind=
dp),
intent(in) :: y
141 real(kind=
qp),
intent(in) :: x
142 real(kind=
qp),
intent(in) :: y
151 real(kind=
sp),
intent(in) :: x
152 real(kind=
sp),
intent(in) :: y
153 real(kind=
sp),
intent(in),
optional :: eps
155 if (
present(eps))
then
156 srelcmp = abs(x - y) .le. eps*abs(y)
165 real(kind=
dp),
intent(in) :: x
166 real(kind=
dp),
intent(in) :: y
167 real(kind=
dp),
intent(in),
optional :: eps
169 if (
present(eps))
then
170 drelcmp = abs(x - y) .le. eps*abs(y)
180 real(kind=
qp),
intent(in) :: x
181 real(kind=
qp),
intent(in) :: y
182 real(kind=
qp),
intent(in),
optional :: eps
184 if (
present(eps))
then
185 qrelcmp = abs(x - y)/abs(y) .lt. eps
194 integer,
intent(in) :: n
195 real(kind=
rp),
dimension(n),
intent(inout) :: a
205 integer,
intent(in) :: n
206 integer,
dimension(n),
intent(inout) :: a
216 integer,
intent(in) :: m, n, e
217 real(kind=
rp),
intent(inout) :: a(m,n)
227 integer,
intent(in) :: n
228 real(kind=
rp),
dimension(n),
intent(inout) :: a
238 integer,
intent(in) :: n
239 real(kind=
rp),
dimension(n),
intent(in) :: b
240 real(kind=
rp),
dimension(n),
intent(inout) :: a
257 integer,
intent(in) :: n, m
258 real(kind=
rp),
dimension(n),
intent(in) :: b
259 real(kind=
rp),
dimension(n),
intent(inout) :: a
260 integer,
dimension(0:m) :: mask
279 integer,
intent(in) :: n, m
280 real(kind=
rp),
dimension(n),
intent(in) :: b
281 real(kind=
rp),
dimension(m),
intent(inout) :: a
282 integer,
dimension(0:m) :: mask
296 integer,
intent(in) :: size, mask_size
297 real(kind=
rp),
dimension(size),
intent(inout) :: a
298 real(kind=
rp),
intent(in) :: c
299 integer,
dimension(mask_size),
intent(in) :: mask
310 integer,
intent(in) :: n
311 real(kind=
rp),
dimension(n),
intent(inout) :: a
312 real(kind=
rp),
intent(in) :: c
322 integer,
intent(in) :: n
323 real(kind=
rp),
dimension(n),
intent(inout) :: a
324 real(kind=
rp),
intent(in) :: s
334 integer,
intent(in) :: n
335 real(kind=
rp),
dimension(n),
intent(inout) :: a
336 real(kind=
rp),
dimension(n),
intent(in) :: b
337 real(kind=
rp),
intent(in) :: s
347 integer,
intent(in) :: n
348 real(kind=
rp),
dimension(n),
intent(inout) :: a
349 real(kind=
rp),
intent(in) :: c
359 integer,
intent(in) :: n
360 real(kind=
rp),
dimension(n) :: a
368 call mpi_allreduce(mpi_in_place, tmp, 1, &
376 integer,
intent(in) :: n
377 real(kind=
rp),
dimension(n) :: a
385 call mpi_allreduce(tmp,
glmax, 1, &
391 integer,
intent(in) :: n
392 integer,
dimension(n) :: a
400 call mpi_allreduce(tmp,
glimax, 1, &
406 integer,
intent(in) :: n
407 real(kind=
rp),
dimension(n) :: a
415 call mpi_allreduce(tmp,
glmin, 1, &
421 integer,
intent(in) :: n
422 integer,
dimension(n) :: a
430 call mpi_allreduce(tmp,
glimin, 1, &
439 integer,
intent(in) :: n
440 real(kind=
rp),
dimension(n),
intent(inout) :: a
452 real(kind=
rp),
intent(in) :: vec(n)
453 real(kind=
rp) :: tmax
456 tmax =
max(tmax, vec(i))
462 integer,
intent(in) :: n
463 real(kind=
rp),
intent(in) :: vec(n)
464 real(kind=
rp) :: tmin
468 tmin = min(tmin, vec(i))
474 integer,
intent(in) :: n
475 real(kind=
rp),
dimension(n),
intent(inout) :: a
479 a(i) = 1.0_xp /
real(a(i),
xp)
486 integer,
intent(in) :: n
487 real(kind=
rp),
dimension(n),
intent(inout) :: a
488 real(kind=
rp),
dimension(n),
intent(in) :: b,c
492 a(i) =
real(b(i),
xp) / c(i)
499 integer,
intent(in) :: n
500 real(kind=
rp),
dimension(n),
intent(inout) :: a
501 real(kind=
rp),
dimension(n),
intent(in) :: b
505 a(i) = 1.0_xp /
real(b(i),
xp)
512 subroutine vcross(u1, u2, u3, v1, v2, v3, w1, w2, w3, n)
513 integer,
intent(in) :: n
514 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
515 real(kind=
rp),
dimension(n),
intent(in) :: w1, w2, w3
516 real(kind=
rp),
dimension(n),
intent(out) :: u1, u2, u3
520 u1(i) = v2(i)*w3(i) - v3(i)*w2(i)
521 u2(i) = v3(i)*w1(i) - v1(i)*w3(i)
522 u3(i) = v1(i)*w2(i) - v2(i)*w1(i)
529 subroutine vdot2(dot, u1, u2, v1, v2, n)
530 integer,
intent(in) :: n
531 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2
532 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2
533 real(kind=
rp),
dimension(n),
intent(out) :: dot
536 dot(i) = u1(i)*v1(i) + u2(i)*v2(i)
543 subroutine vdot3(dot, u1, u2, u3, v1, v2, v3, n)
544 integer,
intent(in) :: n
545 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2, u3
546 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
547 real(kind=
rp),
dimension(n),
intent(out) :: dot
551 dot(i) = u1(i)*v1(i) + u2(i)*v2(i) + u3(i)*v3(i)
557 function vlsc3(u, v, w, n)
result(s)
558 integer,
intent(in) :: n
559 real(kind=
rp),
dimension(n),
intent(in) :: u, v, w
565 s = s + u(i)*v(i)*w(i)
572 integer,
intent(in) :: n
573 real(kind=
rp),
dimension(n),
intent(in) :: u, v
586 integer,
intent(in) :: n
587 real(kind=
rp),
dimension(n),
intent(inout) :: a
588 real(kind=
rp),
dimension(n),
intent(in) :: b
599 integer,
intent(in) :: n
600 real(kind=
rp),
dimension(n),
intent(inout) :: a
601 real(kind=
rp),
dimension(n),
intent(in) :: b
602 real(kind=
rp),
dimension(n),
intent(in) :: c
613 integer,
intent(in) :: n
614 real(kind=
rp),
dimension(n),
intent(out) :: a
615 real(kind=
rp),
dimension(n),
intent(in) :: d
616 real(kind=
rp),
dimension(n),
intent(in) :: c
617 real(kind=
rp),
dimension(n),
intent(in) :: b
621 a(i) = b(i) + c(i) + d(i)
628 integer,
intent(in) :: n
629 real(kind=
rp),
dimension(n),
intent(inout) :: a
630 real(kind=
rp),
dimension(n),
intent(inout) :: b
641 integer,
intent(in) :: n
642 real(kind=
rp),
dimension(n),
intent(inout) :: a
643 real(kind=
rp),
dimension(n),
intent(in) :: b
644 real(kind=
rp),
dimension(n),
intent(in) :: c
657 integer,
intent(in) :: n
658 real(kind=
rp),
dimension(n),
intent(inout) :: a
659 real(kind=
rp),
dimension(n),
intent(inout) :: b
660 real(kind=
rp),
intent(in) :: c1
664 a(i) = c1 * a(i) + b(i)
672 integer,
intent(in) :: n
673 real(kind=
rp),
dimension(n),
intent(inout) :: a
674 real(kind=
rp),
dimension(n),
intent(inout) :: b
675 real(kind=
rp),
intent(in) :: c1
679 a(i) = a(i) + c1 * b(i)
686 integer,
intent(in) :: n
687 real(kind=
rp),
dimension(n),
intent(inout) :: a
688 real(kind=
rp),
dimension(n),
intent(in) :: b
689 real(kind=
rp),
intent(in) :: c1
693 a(i) = a(i) + c1 * ( b(i) * b(i) )
700 integer,
intent(in) :: n
701 real(kind=
rp),
dimension(n),
intent(inout) :: a
702 real(kind=
rp),
dimension(n),
intent(in) :: b
703 real(kind=
rp),
intent(in) :: c
714 integer,
intent(in) :: n
715 real(kind=
rp),
dimension(n),
intent(inout) :: a
716 real(kind=
rp),
dimension(n),
intent(in) :: b
720 a(i) =
real(a(i),
xp) /b(i)
728 integer,
intent(in) :: n
729 real(kind=
rp),
dimension(n),
intent(inout) :: a
730 real(kind=
rp),
dimension(n),
intent(in) :: b
741 integer,
intent(in) :: n
742 real(kind=
rp),
dimension(n),
intent(inout) :: a
743 real(kind=
rp),
dimension(n),
intent(in) :: b
744 real(kind=
rp),
dimension(n),
intent(in) :: c
755 integer,
intent(in) :: n
756 real(kind=
rp),
dimension(n),
intent(inout) :: a
757 real(kind=
rp),
dimension(n),
intent(in) :: b
758 real(kind=
rp),
dimension(n),
intent(in) :: c
762 a(i) = a(i) - b(i) * c(i)
769 integer,
intent(in) :: n
770 real(kind=
rp),
dimension(n),
intent(inout) :: a
771 real(kind=
rp),
dimension(n),
intent(in) :: b
772 real(kind=
rp),
dimension(n),
intent(in) :: c
773 real(kind=
rp),
intent(in) :: c1, c2
777 a(i) = c1 * b(i) + c2 * c(i)
785 integer,
intent(in) :: n
786 real(kind=
rp),
dimension(n),
intent(inout) :: a
787 real(kind=
rp),
dimension(n),
intent(in) :: b
788 real(kind=
rp),
dimension(n),
intent(in) :: c
789 real(kind=
rp),
dimension(n),
intent(in) :: d
793 a(i) = a(i) - b(i) * c(i) * d(i)
800 integer,
intent(in) :: n
801 real(kind=
rp),
dimension(n),
intent(inout) :: a
802 real(kind=
rp),
dimension(n),
intent(in) :: b
803 real(kind=
rp),
dimension(n),
intent(in) :: c
807 a(i) = a(i) + b(i) * c(i)
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
818 real(kind=
rp),
dimension(n),
intent(in) :: d
822 a(i) = a(i) + b(i) * c(i) * d(i)
829 integer,
intent(in) :: n
830 real(kind=
rp),
dimension(n),
intent(inout) :: a
831 real(kind=
rp),
dimension(n),
intent(in) :: b
832 real(kind=
rp),
dimension(n),
intent(in) :: c
833 real(kind=
rp),
dimension(n),
intent(in) :: d
834 real(kind=
rp),
dimension(n),
intent(in) :: e
838 a(i) = b(i)*c(i)-d(i)*e(i)
845 integer,
intent(in) :: n
846 real(kind=
rp),
dimension(n),
intent(inout) :: a
847 real(kind=
rp),
dimension(n),
intent(in) :: b
848 real(kind=
rp),
dimension(n),
intent(in) :: c
849 real(kind=
rp),
intent(in) :: c1, c2
853 a(i) = b(i) + c1*(a(i)-c2*c(i))
860 integer,
intent(in) :: n
861 real(kind=
rp),
dimension(n),
intent(inout) :: a
862 real(kind=
rp),
dimension(n),
intent(in) :: b
863 real(kind=
rp),
dimension(n),
intent(in) :: c
864 real(kind=
rp),
intent(in) :: c1, c2
868 a(i) = a(i) + c1*b(i)+c2*c(i)
875 integer,
intent(in) :: n
876 real(kind=
rp),
dimension(n),
intent(in) :: a
877 real(kind=
rp),
dimension(n),
intent(in) :: b
884 tmp = tmp + a(i) * b(i)
887 call mpi_allreduce(mpi_in_place, tmp, 1, &
894 integer,
intent(in) :: n
895 real(kind=
rp),
dimension(n),
intent(in) :: a
896 real(kind=
rp),
dimension(n),
intent(in) :: b
897 real(kind=
rp),
dimension(n),
intent(in) :: c
904 tmp = tmp + a(i) * b(i) * c(i)
907 call mpi_allreduce(mpi_in_place, tmp, 1, &
913 integer,
intent(in) :: n
914 real(kind=
rp),
dimension(n),
intent(in) :: a
915 real(kind=
rp),
dimension(n),
intent(in) :: b
916 real(kind=
rp),
dimension(n),
intent(in) :: c
917 real(kind=
rp),
dimension(n),
intent(in) :: d
924 tmp = tmp + a(i) * b(i) * c(i) * d(i)
927 call mpi_allreduce(mpi_in_place, tmp, 1, &
939 integer,
intent(in) :: n
940 real(kind=
rp),
intent(inout) :: a(n)
941 integer,
intent(out) :: ind(n)
943 integer :: j, ir, i, ii, l
975 if ( a(j) .lt. a(j+1) ) j = j + 1
977 if (aa .lt. a(j))
then
997 integer,
intent(in) :: n
998 integer(i4),
intent(inout) :: a(n)
999 integer,
intent(out) :: ind(n)
1001 integer :: j, ir, i, ii, l
1007 if (n .le. 1)
return
1030 do while (j .le. ir)
1032 if ( a(j) .lt. a(j + 1) ) j = j + 1
1034 if (aa .lt. a(j))
then
1053 integer,
intent(in) :: n
1054 real(kind=
rp),
intent(inout) :: b(n)
1055 integer,
intent(in) :: ind(n)
1056 real(kind=
rp) :: temp(n)
1073 integer,
intent(in) :: n
1074 integer(i4),
intent(inout) :: b(n)
1075 integer,
intent(in) :: ind(n)
1076 integer(i4) :: temp(n)
1093 integer,
intent(in) :: n
1094 real(kind=
rp),
intent(inout) :: b(n)
1095 integer,
intent(in) :: ind(n)
1096 real(kind=
rp) :: temp(n)
1113 integer,
intent(in) :: n
1114 integer(i4),
intent(inout) :: b(n)
1115 integer,
intent(in) :: ind(n)
1116 integer(i4) :: temp(n)
1133 integer,
intent(in) :: n
1134 real(kind=
rp),
intent(inout) :: b(n)
1135 integer,
intent(inout) :: ind(n)
1136 real(kind=
rp) :: temp(n)
1137 integer :: tempind(n)
1143 tempind(jj) = ind(i)
1156 integer,
intent(in) :: n
1157 integer(i4),
intent(inout) :: b(n)
1158 integer,
intent(inout) :: ind(n)
1159 integer(i4) :: temp(n)
1160 integer :: tempind(n)
1166 tempind(jj) = ind(i)
1178 integer,
intent(in) :: n
1179 real(kind=
rp),
dimension(n),
intent(inout) :: a
1191 integer,
intent(in) :: n
1192 real(kind=
rp),
dimension(n),
intent(inout) :: a
1193 real(kind=
rp),
dimension(n),
intent(in) :: b
1197 a(i) =
max(a(i), b(i))
1203 integer,
intent(in) :: n
1204 real(kind=
rp),
dimension(n),
intent(inout) :: a
1205 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1209 a(i) =
max(b(i), c(i))
1215 integer,
intent(in) :: n
1216 real(kind=
rp),
dimension(n),
intent(inout) :: a
1217 real(kind=
rp),
intent(in) :: b
1227 integer,
intent(in) :: n
1228 real(kind=
rp),
dimension(n),
intent(inout) :: a
1229 real(kind=
rp),
dimension(n),
intent(in) :: b
1230 real(kind=
rp),
intent(in) :: c
1240 integer,
intent(in) :: n
1241 real(kind=
rp),
dimension(n),
intent(inout) :: a
1242 real(kind=
rp),
dimension(n),
intent(in) :: b
1246 a(i) = min(a(i), b(i))
1252 integer,
intent(in) :: n
1253 real(kind=
rp),
dimension(n),
intent(inout) :: a
1254 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1258 a(i) = min(b(i), c(i))
1264 integer,
intent(in) :: n
1265 real(kind=
rp),
dimension(n),
intent(inout) :: a
1266 real(kind=
rp),
intent(in) :: b
1276 integer,
intent(in) :: n
1277 real(kind=
rp),
dimension(n),
intent(inout) :: a
1278 real(kind=
rp),
dimension(n),
intent(in) :: b
1279 real(kind=
rp),
intent(in) :: c
type(mpi_comm) neko_comm
MPI communicator.
type(mpi_datatype) mpi_real_precision
MPI type for working precision of REAL types.
type(mpi_datatype) mpi_extra_precision
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 .
subroutine pwmin_sca3(a, b, c, n)
Point-wise minimum of scalar and vector .
real(kind=rp), parameter, public pi
subroutine pwmax_scal2(a, b, n)
Point-wise maximum of scalar and vector .
real(kind=rp) function, public glsc3(a, b, c, n)
Weighted inner product .
pure logical function qabscmp(x, y)
Return double precision absolute comparison .
subroutine, public ascol5(a, b, c, d, e, n)
Returns .
subroutine, public invers2(a, b, n)
Compute inverted vector .
subroutine, public cadd2(a, b, s, n)
Add a scalar to vector .
subroutine pwmin_sca2(a, b, n)
Point-wise minimum of scalar and vector .
subroutine, public cadd(a, s, n)
Add a scalar to vector .
subroutine reorddp(b, ind, n)
reorder double precision array - inverse of swap
subroutine, public addsqr2s2(a, b, c1, n)
Returns .
real(kind=rp) function, public glsc4(a, b, c, d, n)
subroutine, public masked_red_copy(a, b, mask, n, m)
Copy a masked vector to reduced contigous vector .
subroutine pwmax_vec3(a, b, c, n)
Point-wise maximum of two vectors .
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)
real(kind=rp) function, public glsc2(a, b, n)
Weighted inner product .
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 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 .
pure logical function sabscmp(x, y)
Return single precision absolute comparison .
subroutine, public add3s2(a, b, c, c1, c2, n)
Returns .
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 .
pure logical function dabscmp(x, y)
Return double precision absolute comparison .
subroutine, public invcol1(a, n)
Invert a vector .
subroutine, public masked_copy(a, b, mask, n, m)
Copy a masked vector .
real(kind=rp), parameter, public neko_m_ln2
subroutine, public chsign(a, n)
Change sign of 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 pwmax_scal3(a, b, c, n)
Point-wise maximum of scalar and vector .
subroutine, public add4(a, b, c, d, n)
Vector addition .
subroutine, public col3(a, b, c, n)
Vector multiplication with 3 vectors .
subroutine pwmin_vec2(a, b, n)
Point-wise minimum of two vectors .
subroutine pwmin_vec3(a, b, c, n)
Point-wise minimum of two vectors .
subroutine pwmax_vec2(a, b, n)
Point-wise maximum of two vectors .
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 qrelcmp(x, y, eps)
Return quad precision relative comparison .
subroutine, public rzero(a, n)
Zero a real vector.
subroutine, public vdot2(dot, u1, u2, v1, v2, n)
Compute a dot product (2-d version) assuming vector components etc.
real(kind=rp) function, public vlmin(vec, n)
minimun value of a vector of length n
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 cfill_mask(a, c, size, mask, mask_size)
Fill a constant to a masked vector. .
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 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 .
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.