64 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)
112 vcross,
vdot2,
vdot3,
vlsc3,
vlsc2,
add2,
add3,
add4,
sub2,
sub3, &
122 real(kind=
sp),
intent(in) :: x
123 real(kind=
sp),
intent(in) :: y
132 real(kind=
dp),
intent(in) :: x
133 real(kind=
dp),
intent(in) :: y
142 real(kind=
qp),
intent(in) :: x
143 real(kind=
qp),
intent(in) :: y
152 real(kind=
sp),
intent(in) :: x
153 real(kind=
sp),
intent(in) :: y
154 real(kind=
sp),
intent(in),
optional :: eps
156 if (
present(eps))
then
157 srelcmp = abs(x - y) .le. eps*abs(y)
166 real(kind=
dp),
intent(in) :: x
167 real(kind=
dp),
intent(in) :: y
168 real(kind=
dp),
intent(in),
optional :: eps
170 if (
present(eps))
then
171 drelcmp = abs(x - y) .le. eps*abs(y)
181 real(kind=
qp),
intent(in) :: x
182 real(kind=
qp),
intent(in) :: y
183 real(kind=
qp),
intent(in),
optional :: eps
185 if (
present(eps))
then
186 qrelcmp = abs(x - y)/abs(y) .lt. eps
195 integer,
intent(in) :: n
196 real(kind=
rp),
dimension(n),
intent(inout) :: a
206 integer,
intent(in) :: n
207 integer,
dimension(n),
intent(inout) :: a
217 integer,
intent(in) :: m, n, e
218 real(kind=
rp),
intent(inout) :: a(m,n)
228 integer,
intent(in) :: n
229 real(kind=
rp),
dimension(n),
intent(inout) :: a
239 integer,
intent(in) :: n
240 real(kind=
rp),
dimension(n),
intent(in) :: b
241 real(kind=
rp),
dimension(n),
intent(inout) :: a
258 integer,
intent(in) :: n, m
259 real(kind=
rp),
dimension(n),
intent(in) :: b
260 real(kind=
rp),
dimension(n),
intent(inout) :: a
261 integer,
dimension(0:m) :: mask
280 integer,
intent(in) :: n, m
281 real(kind=
rp),
dimension(n),
intent(in) :: b
282 real(kind=
rp),
dimension(m),
intent(inout) :: a
283 integer,
dimension(0:m) :: mask
297 integer,
intent(in) :: size, mask_size
298 real(kind=
rp),
dimension(size),
intent(inout) :: a
299 real(kind=
rp),
intent(in) :: c
300 integer,
dimension(mask_size),
intent(in) :: mask
311 integer,
intent(in) :: n
312 real(kind=
rp),
dimension(n),
intent(inout) :: a
313 real(kind=
rp),
intent(in) :: c
323 integer,
intent(in) :: n
324 real(kind=
rp),
dimension(n),
intent(inout) :: a
325 real(kind=
rp),
intent(in) :: s
335 integer,
intent(in) :: n
336 real(kind=
rp),
dimension(n),
intent(inout) :: a
337 real(kind=
rp),
dimension(n),
intent(in) :: b
338 real(kind=
rp),
intent(in) :: s
348 integer,
intent(in) :: n
349 real(kind=
rp),
dimension(n),
intent(inout) :: a
350 real(kind=
rp),
intent(in) :: c
360 integer,
intent(in) :: n
361 real(kind=
rp),
dimension(n) :: a
369 call mpi_allreduce(mpi_in_place, tmp, 1, &
377 integer,
intent(in) :: n
378 real(kind=
rp),
dimension(n) :: a
386 call mpi_allreduce(tmp,
glmax, 1, &
392 integer,
intent(in) :: n
393 integer,
dimension(n) :: a
401 call mpi_allreduce(tmp,
glimax, 1, &
407 integer,
intent(in) :: n
408 real(kind=
rp),
dimension(n) :: a
416 call mpi_allreduce(tmp,
glmin, 1, &
422 integer,
intent(in) :: n
423 integer,
dimension(n) :: a
431 call mpi_allreduce(tmp,
glimin, 1, &
440 integer,
intent(in) :: n
441 real(kind=
rp),
dimension(n),
intent(inout) :: a
453 real(kind=
rp),
intent(in) :: vec(n)
454 real(kind=
rp) :: tmax
457 tmax =
max(tmax, vec(i))
463 integer,
intent(in) :: n
464 real(kind=
rp),
intent(in) :: vec(n)
465 real(kind=
rp) :: tmin
469 tmin = min(tmin, vec(i))
475 integer,
intent(in) :: n
476 real(kind=
rp),
dimension(n),
intent(inout) :: a
480 a(i) = 1.0_xp /
real(a(i),
xp)
487 integer,
intent(in) :: n
488 real(kind=
rp),
dimension(n),
intent(inout) :: a
489 real(kind=
rp),
dimension(n),
intent(in) :: b,c
493 a(i) =
real(b(i),
xp) / c(i)
500 integer,
intent(in) :: n
501 real(kind=
rp),
dimension(n),
intent(inout) :: a
502 real(kind=
rp),
dimension(n),
intent(in) :: b
506 a(i) = 1.0_xp /
real(b(i),
xp)
513 subroutine vcross(u1, u2, u3, v1, v2, v3, w1, w2, w3, n)
514 integer,
intent(in) :: n
515 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
516 real(kind=
rp),
dimension(n),
intent(in) :: w1, w2, w3
517 real(kind=
rp),
dimension(n),
intent(out) :: u1, u2, u3
521 u1(i) = v2(i)*w3(i) - v3(i)*w2(i)
522 u2(i) = v3(i)*w1(i) - v1(i)*w3(i)
523 u3(i) = v1(i)*w2(i) - v2(i)*w1(i)
530 subroutine vdot2(dot, u1, u2, v1, v2, n)
531 integer,
intent(in) :: n
532 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2
533 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2
534 real(kind=
rp),
dimension(n),
intent(out) :: dot
537 dot(i) = u1(i)*v1(i) + u2(i)*v2(i)
544 subroutine vdot3(dot, u1, u2, u3, v1, v2, v3, n)
545 integer,
intent(in) :: n
546 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2, u3
547 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
548 real(kind=
rp),
dimension(n),
intent(out) :: dot
552 dot(i) = u1(i)*v1(i) + u2(i)*v2(i) + u3(i)*v3(i)
558 function vlsc3(u, v, w, n)
result(s)
559 integer,
intent(in) :: n
560 real(kind=
rp),
dimension(n),
intent(in) :: u, v, w
566 s = s + u(i)*v(i)*w(i)
573 integer,
intent(in) :: n
574 real(kind=
rp),
dimension(n),
intent(in) :: u, v
587 integer,
intent(in) :: n
588 real(kind=
rp),
dimension(n),
intent(inout) :: a
589 real(kind=
rp),
dimension(n),
intent(in) :: b
600 integer,
intent(in) :: n
601 real(kind=
rp),
dimension(n),
intent(inout) :: a
602 real(kind=
rp),
dimension(n),
intent(in) :: b
603 real(kind=
rp),
dimension(n),
intent(in) :: c
614 integer,
intent(in) :: n
615 real(kind=
rp),
dimension(n),
intent(out) :: a
616 real(kind=
rp),
dimension(n),
intent(in) :: d
617 real(kind=
rp),
dimension(n),
intent(in) :: c
618 real(kind=
rp),
dimension(n),
intent(in) :: b
622 a(i) = b(i) + c(i) + d(i)
629 integer,
intent(in) :: n
630 real(kind=
rp),
dimension(n),
intent(inout) :: a
631 real(kind=
rp),
dimension(n),
intent(inout) :: b
642 integer,
intent(in) :: n
643 real(kind=
rp),
dimension(n),
intent(inout) :: a
644 real(kind=
rp),
dimension(n),
intent(in) :: b
645 real(kind=
rp),
dimension(n),
intent(in) :: c
658 integer,
intent(in) :: n
659 real(kind=
rp),
dimension(n),
intent(inout) :: a
660 real(kind=
rp),
dimension(n),
intent(inout) :: b
661 real(kind=
rp),
intent(in) :: c1
665 a(i) = c1 * a(i) + b(i)
673 integer,
intent(in) :: n
674 real(kind=
rp),
dimension(n),
intent(inout) :: a
675 real(kind=
rp),
dimension(n),
intent(inout) :: b
676 real(kind=
rp),
intent(in) :: c1
680 a(i) = a(i) + c1 * b(i)
687 integer,
intent(in) :: n
688 real(kind=
rp),
dimension(n),
intent(inout) :: a
689 real(kind=
rp),
dimension(n),
intent(in) :: b
690 real(kind=
rp),
intent(in) :: c1
694 a(i) = a(i) + c1 * ( b(i) * b(i) )
701 integer,
intent(in) :: n
702 real(kind=
rp),
dimension(n),
intent(inout) :: a
703 real(kind=
rp),
dimension(n),
intent(in) :: b
704 real(kind=
rp),
intent(in) :: c
715 integer,
intent(in) :: n
716 real(kind=
rp),
dimension(n),
intent(inout) :: a
717 real(kind=
rp),
dimension(n),
intent(in) :: b
721 a(i) =
real(a(i),
xp) /b(i)
729 integer,
intent(in) :: n
730 real(kind=
rp),
dimension(n),
intent(inout) :: a
731 real(kind=
rp),
dimension(n),
intent(in) :: b
742 integer,
intent(in) :: n
743 real(kind=
rp),
dimension(n),
intent(inout) :: a
744 real(kind=
rp),
dimension(n),
intent(in) :: b
745 real(kind=
rp),
dimension(n),
intent(in) :: c
756 integer,
intent(in) :: n
757 real(kind=
rp),
dimension(n),
intent(inout) :: a
758 real(kind=
rp),
dimension(n),
intent(in) :: b
759 real(kind=
rp),
dimension(n),
intent(in) :: c
763 a(i) = a(i) - b(i) * c(i)
770 integer,
intent(in) :: n
771 real(kind=
rp),
dimension(n),
intent(inout) :: a
772 real(kind=
rp),
dimension(n),
intent(in) :: b
773 real(kind=
rp),
dimension(n),
intent(in) :: c
774 real(kind=
rp),
intent(in) :: c1, c2
778 a(i) = c1 * b(i) + c2 * c(i)
786 integer,
intent(in) :: n
787 real(kind=
rp),
dimension(n),
intent(inout) :: a
788 real(kind=
rp),
dimension(n),
intent(in) :: b
789 real(kind=
rp),
dimension(n),
intent(in) :: c
790 real(kind=
rp),
dimension(n),
intent(in) :: d
794 a(i) = a(i) - b(i) * c(i) * d(i)
801 integer,
intent(in) :: n
802 real(kind=
rp),
dimension(n),
intent(inout) :: a
803 real(kind=
rp),
dimension(n),
intent(in) :: b
804 real(kind=
rp),
dimension(n),
intent(in) :: c
808 a(i) = a(i) + b(i) * c(i)
815 integer,
intent(in) :: n
816 real(kind=
rp),
dimension(n),
intent(inout) :: a
817 real(kind=
rp),
dimension(n),
intent(in) :: b
818 real(kind=
rp),
dimension(n),
intent(in) :: c
819 real(kind=
rp),
dimension(n),
intent(in) :: d
823 a(i) = a(i) + b(i) * c(i) * d(i)
830 integer,
intent(in) :: n
831 real(kind=
rp),
dimension(n),
intent(inout) :: a
832 real(kind=
rp),
dimension(n),
intent(in) :: b
833 real(kind=
rp),
dimension(n),
intent(in) :: c
834 real(kind=
rp),
dimension(n),
intent(in) :: d
835 real(kind=
rp),
dimension(n),
intent(in) :: e
839 a(i) = b(i)*c(i)-d(i)*e(i)
846 integer,
intent(in) :: n
847 real(kind=
rp),
dimension(n),
intent(inout) :: a
848 real(kind=
rp),
dimension(n),
intent(in) :: b
849 real(kind=
rp),
dimension(n),
intent(in) :: c
850 real(kind=
rp),
intent(in) :: c1, c2
854 a(i) = b(i) + c1*(a(i)-c2*c(i))
861 integer,
intent(in) :: n
862 real(kind=
rp),
dimension(n),
intent(inout) :: a
863 real(kind=
rp),
dimension(n),
intent(in) :: b
864 real(kind=
rp),
dimension(n),
intent(in) :: c
865 real(kind=
rp),
intent(in) :: c1, c2
869 a(i) = a(i) + c1*b(i)+c2*c(i)
876 integer,
intent(in) :: n
877 real(kind=
rp),
dimension(n),
intent(in) :: a
878 real(kind=
rp),
dimension(n),
intent(in) :: b
885 tmp = tmp + a(i) * b(i)
888 call mpi_allreduce(mpi_in_place, tmp, 1, &
895 integer,
intent(in) :: n
896 real(kind=
rp),
dimension(n),
intent(in) :: a
897 real(kind=
rp),
dimension(n),
intent(in) :: b
898 real(kind=
rp),
dimension(n),
intent(in) :: c
905 tmp = tmp + a(i) * b(i) * c(i)
908 call mpi_allreduce(mpi_in_place, tmp, 1, &
914 integer,
intent(in) :: n
915 real(kind=
rp),
dimension(n),
intent(in) :: a
916 real(kind=
rp),
dimension(n),
intent(in) :: b
917 real(kind=
rp),
dimension(n),
intent(in) :: c
918 real(kind=
rp),
dimension(n),
intent(in) :: d
925 tmp = tmp + a(i) * b(i) * c(i) * d(i)
928 call mpi_allreduce(mpi_in_place, tmp, 1, &
940 integer,
intent(in) :: n
941 real(kind=
rp),
intent(inout) :: a(n)
942 integer,
intent(out) :: ind(n)
944 integer :: j, ir, i, ii, l
976 if ( a(j) .lt. a(j+1) ) j = j + 1
978 if (aa .lt. a(j))
then
998 integer,
intent(in) :: n
999 integer(i4),
intent(inout) :: a(n)
1000 integer,
intent(out) :: ind(n)
1002 integer :: j, ir, i, ii, l
1008 if (n .le. 1)
return
1031 do while (j .le. ir)
1033 if ( a(j) .lt. a(j + 1) ) j = j + 1
1035 if (aa .lt. a(j))
then
1054 integer,
intent(in) :: n
1055 real(kind=
rp),
intent(inout) :: b(n)
1056 integer,
intent(in) :: ind(n)
1057 real(kind=
rp) :: temp(n)
1074 integer,
intent(in) :: n
1075 integer(i4),
intent(inout) :: b(n)
1076 integer,
intent(in) :: ind(n)
1077 integer(i4) :: temp(n)
1094 integer,
intent(in) :: n
1095 real(kind=
rp),
intent(inout) :: b(n)
1096 integer,
intent(in) :: ind(n)
1097 real(kind=
rp) :: temp(n)
1114 integer,
intent(in) :: n
1115 integer(i4),
intent(inout) :: b(n)
1116 integer,
intent(in) :: ind(n)
1117 integer(i4) :: temp(n)
1134 integer,
intent(in) :: n
1135 real(kind=
rp),
intent(inout) :: b(n)
1136 integer,
intent(inout) :: ind(n)
1137 real(kind=
rp) :: temp(n)
1138 integer :: tempind(n)
1144 tempind(jj) = ind(i)
1157 integer,
intent(in) :: n
1158 integer(i4),
intent(inout) :: b(n)
1159 integer,
intent(inout) :: ind(n)
1160 integer(i4) :: temp(n)
1161 integer :: tempind(n)
1167 tempind(jj) = ind(i)
1179 integer,
intent(in) :: n
1180 real(kind=
rp),
dimension(n),
intent(inout) :: a
1192 integer,
intent(in) :: n
1193 real(kind=
rp),
dimension(n),
intent(inout) :: a
1194 real(kind=
rp),
dimension(n),
intent(in) :: b
1198 a(i) =
max(a(i), b(i))
1204 integer,
intent(in) :: n
1205 real(kind=
rp),
dimension(n),
intent(inout) :: a
1206 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1210 a(i) =
max(b(i), c(i))
1216 integer,
intent(in) :: n
1217 real(kind=
rp),
dimension(n),
intent(inout) :: a
1218 real(kind=
rp),
intent(in) :: b
1228 integer,
intent(in) :: n
1229 real(kind=
rp),
dimension(n),
intent(inout) :: a
1230 real(kind=
rp),
dimension(n),
intent(in) :: b
1231 real(kind=
rp),
intent(in) :: c
1241 integer,
intent(in) :: n
1242 real(kind=
rp),
dimension(n),
intent(inout) :: a
1243 real(kind=
rp),
dimension(n),
intent(in) :: b
1247 a(i) = min(a(i), b(i))
1253 integer,
intent(in) :: n
1254 real(kind=
rp),
dimension(n),
intent(inout) :: a
1255 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1259 a(i) = min(b(i), c(i))
1265 integer,
intent(in) :: n
1266 real(kind=
rp),
dimension(n),
intent(inout) :: a
1267 real(kind=
rp),
intent(in) :: b
1277 integer,
intent(in) :: n
1278 real(kind=
rp),
dimension(n),
intent(inout) :: a
1279 real(kind=
rp),
dimension(n),
intent(in) :: b
1280 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.