IO: Use new XML structure for binary files in write_snapshot_xml().

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2020-08-10 10:32:17 -03:00
parent 220c6028b1
commit 7867d9d062

View File

@ -2431,7 +2431,6 @@ module io
logical :: test
character(len=64) :: dname, fname
character(len=256) :: vars
character(len=22) :: digest_string
integer(kind=8) :: digest, bytes
integer(kind=4) :: lun = 103
integer :: nd, nl, l, p
@ -2556,7 +2555,7 @@ module io
call write_attribute_xml(lun, "isnap" , isnap)
call write_attribute_xml(lun, "variables", trim(vars))
write(lun,"(a)") '</Snapshots>'
write(lun,"(a)") '<Hashes>'
write(lun,"(a)") '<BinaryFiles>'
! prepare and store metablocks
!
@ -2600,15 +2599,15 @@ module io
! store metablock data
!
call write_binary_xml(trim(dname), 'metablock_fields.bin', &
write(fname,"(a,'.bin')") "metablock_fields"
call write_binary_xml(trim(dname), trim(fname), &
transfer(fields, [ 0_1 ]), bytes, digest)
write(digest_string,"('xxh64:', 1z0.16)") digest
call write_attribute_xml(lun, "fields", digest_string)
call write_attribute_xml(lun, "fields", trim(fname), bytes, digest)
call write_binary_xml(trim(dname), 'metablock_bounds.bin', &
write(fname,"(a,'.bin')") "metablock_bounds"
call write_binary_xml(trim(dname), trim(fname), &
transfer(bounds, [ 0_1 ]), bytes, digest)
write(digest_string,"('xxh64:', 1z0.16)") digest
call write_attribute_xml(lun, "bounds", digest_string)
call write_attribute_xml(lun, "bounds", trim(fname), bytes, digest)
if (allocated(fields)) deallocate(fields)
if (allocated(bounds)) deallocate(bounds)
@ -2620,7 +2619,7 @@ module io
return
end if ! allocation
write(lun,"(a)") '</Hashes>'
write(lun,"(a)") '</BinaryFiles>'
write(lun,"(a)") '</AMUNFile>'
close(lun)
@ -2643,7 +2642,7 @@ module io
call write_attribute_xml(lun, "dblocks" , nd)
call write_attribute_xml(lun, "variables", trim(vars))
write(lun,"(a)") '</DataBlocks>'
write(lun,"(a)") '<Hashes>'
write(lun,"(a)") '<BinaryFiles>'
if (nd > 0) then
@ -2670,15 +2669,13 @@ module io
write(fname,"(a,'_',a,'_',i6.6,'.bin')") "datablock", "ids", nproc
call write_binary_xml(trim(dname), trim(fname), &
transfer(ids, [ 0_1 ]), bytes, digest)
write(digest_string,"('xxh64:', 1z0.16)") digest
call write_attribute_xml(lun, "ids", digest_string)
call write_attribute_xml(lun, "ids", trim(fname), bytes, digest)
do p = 1, nv
write(fname,"(a,'_',a,'_',i6.6,'.bin')") "datablock", trim(pvars(p)), nproc
call write_binary_xml(trim(dname), trim(fname), &
transfer(arrays(p,:,:,:,:), [ 0_1 ]), bytes, digest)
write(digest_string,"('xxh64:', 1z0.16)") digest
call write_attribute_xml(lun, trim(pvars(p)), digest_string)
call write_attribute_xml(lun, trim(pvars(p)), trim(fname), bytes, digest)
end do
if (allocated(ids)) deallocate(ids)
@ -2693,7 +2690,7 @@ module io
end if
write(lun,"(a)") '</Hashes>'
write(lun,"(a)") '</BinaryFiles>'
write(lun,"(a)") '</AMUNFile>'
close(lun)