Merge branch 'master' into reconnection

This commit is contained in:
Grzegorz Kowal 2020-05-13 14:58:18 -03:00
commit 5696b87e37
3 changed files with 52 additions and 48 deletions

View File

@ -193,9 +193,6 @@ class AmunXML:
rm = np.array([nx, ny])
bm = np.array([nc, nc])
dm = rm[0:nd] * int(nc * 2**(ml - 1) / self.shrink)
arr = np.zeros(dm[:])
dfile = op.join(self.path, 'metablock_fields.bin')
if op.exists(dfile):
mset = np.fromfile(dfile, dtype='int32')
@ -215,6 +212,10 @@ class AmunXML:
for n in range(nm):
level[mset[0,n]] = mset[ 1,n]
coord[mset[0,n]] = mset[2:5,n]
ml = mset[1,:].max()
dm = rm[0:nd] * int(nc * 2**(ml - 1) / self.shrink)
arr = np.zeros(dm[:])
for n in range(self.attributes['nprocs']):

View File

@ -77,23 +77,23 @@ module hash
!
! Arguments:
!
! n - the size of the input vector;
! data - the input vactor of integer values;
! n - the size of the input vector;
! input - the input vactor of integer values;
!
!===============================================================================
!
integer(kind=8) function xxh64_integer(n, data) result(hash)
integer(kind=8) function xxh64_integer(n, input) result(hash)
implicit none
! subroutine arguments
!
integer(kind=4) , intent(in) :: n
integer(kind=4), dimension(n), intent(in) :: data
integer(kind=4), dimension(n), intent(in) :: input
! local variables
!
integer(kind=8) :: remain, offset
integer(kind=4) :: remain, offset
! local arrays
!
@ -112,7 +112,7 @@ module hash
lane(4) = seed - prime1
do while (remain >= 8)
chk(1:4) = transfer(data(offset:offset+7), chk)
chk(1:4) = transfer(input(offset:offset+7), chk)
lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2))
@ -135,10 +135,10 @@ module hash
hash = seed + prime5
end if
hash = hash + int(4 * n, kind = 8)
hash = hash + 4_8 * n
do while (remain >= 2)
chk(1) = transfer(data(offset:offset+1), chk(1))
chk(1) = transfer(input(offset:offset+1), chk(1))
hash = ieor(hash, xxh64_round(0_8, chk(1)))
hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4
@ -148,7 +148,8 @@ module hash
end do
if (remain == 1) then
hash = ieor(hash, data(offset) * prime1)
chk(1) = transfer((/ input(offset), 0 /), chk(1))
hash = ieor(hash, chk(1) * prime1)
hash = xxh64_rotl(hash, 23)
hash = hash * prime2 + prime3
@ -173,23 +174,23 @@ module hash
!
! Arguments:
!
! n - the size of the input vector;
! data - the input vactor of real values;
! n - the size of the input vector;
! input - the input vactor of real values;
!
!===============================================================================
!
integer(kind=8) function xxh64_long(n, data) result(hash)
integer(kind=8) function xxh64_long(n, input) result(hash)
implicit none
! subroutine arguments
!
integer(kind=4) , intent(in) :: n
integer(kind=8), dimension(n), intent(in) :: data
integer(kind=8), dimension(n), intent(in) :: input
! local variables
!
integer(kind=8) :: remain, offset
integer(kind=4) :: remain, offset
! local arrays
!
@ -208,7 +209,7 @@ module hash
lane(4) = seed - prime1
do while (remain >= 4)
chk(1:4) = transfer(data(offset:offset+3), chk)
chk(1:4) = transfer(input(offset:offset+3), chk)
lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2))
@ -231,10 +232,10 @@ module hash
hash = seed + prime5
end if
hash = hash + int(8 * n, kind = 8)
hash = hash + 8_8 * n
do while (remain >= 1)
hash = ieor(hash, xxh64_round(0_8, transfer(data(offset), 0_8)))
hash = ieor(hash, xxh64_round(0_8, transfer(input(offset), 0_8)))
hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4
@ -259,23 +260,23 @@ module hash
!
! Arguments:
!
! n - the size of the input vector;
! data - the input vactor of real values;
! n - the size of the input vector;
! input - the input vactor of real values;
!
!===============================================================================
!
integer(kind=8) function xxh64_double(n, data) result(hash)
integer(kind=8) function xxh64_double(n, input) result(hash)
implicit none
! subroutine arguments
!
integer(kind=4) , intent(in) :: n
real(kind=8), dimension(n), intent(in) :: data
real(kind=8), dimension(n), intent(in) :: input
! local variables
!
integer(kind=8) :: remain, offset
integer(kind=4) :: remain, offset
! local arrays
!
@ -294,7 +295,7 @@ module hash
lane(4) = seed - prime1
do while (remain >= 4)
chk(1:4) = transfer(data(offset:offset+3), chk)
chk(1:4) = transfer(input(offset:offset+3), chk)
lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2))
@ -317,10 +318,10 @@ module hash
hash = seed + prime5
end if
hash = hash + int(8 * n, kind = 8)
hash = hash + 8_8 * n
do while (remain >= 1)
hash = ieor(hash, xxh64_round(0_8, transfer(data(offset), 0_8)))
hash = ieor(hash, xxh64_round(0_8, transfer(input(offset), 0_8)))
hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4
@ -345,23 +346,23 @@ module hash
!
! Arguments:
!
! n - the size of the input vector;
! data - the input vactor of real values;
! n - the size of the input vector;
! input - the input vactor of real values;
!
!===============================================================================
!
integer(kind=8) function xxh64_complex(n, data) result(hash)
integer(kind=8) function xxh64_complex(n, input) result(hash)
implicit none
! subroutine arguments
!
integer(kind=4) , intent(in) :: n
complex(kind=8), dimension(n), intent(in) :: data
complex(kind=8), dimension(n), intent(in) :: input
! local variables
!
integer(kind=8) :: remain, offset
integer(kind=4) :: remain, offset
! local arrays
!
@ -380,7 +381,7 @@ module hash
lane(4) = seed - prime1
do while (remain >= 2)
chk(1:4) = transfer(data(offset:offset+1), chk)
chk(1:4) = transfer(input(offset:offset+1), chk)
lane(1) = xxh64_round(lane(1), chk(1))
lane(2) = xxh64_round(lane(2), chk(2))
@ -403,13 +404,13 @@ module hash
hash = seed + prime5
end if
hash = hash + int(16 * n, kind = 8)
hash = hash + 16_8 * n
if (remain == 1) then
hash = ieor(hash, xxh64_round(0_8, transfer(dreal(data(offset)), 0_8)))
hash = ieor(hash, xxh64_round(0_8, transfer(dreal(input(offset)), 0_8)))
hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4
hash = ieor(hash, xxh64_round(0_8, transfer(dimag(data(offset)), 0_8)))
hash = ieor(hash, xxh64_round(0_8, transfer(dimag(input(offset)), 0_8)))
hash = xxh64_rotl(hash, 27)
hash = hash * prime1 + prime4

View File

@ -1572,16 +1572,18 @@ module io
! check the number of forcing modes
!
if (lnmodes == nmodes .and. lnmodes > 0) then
write(fname,"(a,'forcing_coefficients.bin')") trim(dname)
open(newunit = lun, file = fname, form = 'unformatted', &
access = 'direct', recl = sizeof(fcoefs))
read(lun, rec = 1) fcoefs
close(lun)
read(hforce(7:), fmt = "(1z16)") hash
if (hash /= xxh64_complex(size(fcoefs), fcoefs)) then
write(error_unit,"('[',a,']: ',a)") trim(loc) &
, "'" // trim(fname) // "' seems to be corrupted!"
if (lnmodes == nmodes) then
if (lnmodes > 0) then
write(fname,"(a,'forcing_coefficients.bin')") trim(dname)
open(newunit = lun, file = fname, form = 'unformatted', &
access = 'direct', recl = sizeof(fcoefs))
read(lun, rec = 1) fcoefs
close(lun)
read(hforce(7:), fmt = "(1z16)") hash
if (hash /= xxh64_complex(size(fcoefs), fcoefs)) then
write(error_unit,"('[',a,']: ',a)") trim(loc) &
, "'" // trim(fname) // "' seems to be corrupted!"
end if
end if
else
write(error_unit,"('[',a,']: ',a)") trim(loc) &
@ -2025,7 +2027,7 @@ module io
! prepare and store metablocks
!
allocate(fields(nm,14), children(nm,nc), bounds(nm,3,2), &
allocate(fields(nm,14), children(nm,nc), bounds(nm,NDIMS,2), &
#if NDIMS == 3
faces(nm,NDIMS,ns,ns,ns), &
edges(nm,NDIMS,ns,ns,ns), corners(nm,ns,ns,ns), &