avoid constant reallocation, it is slow for large vtr files

This commit is contained in:
Martin Diehl 2020-12-05 12:46:48 +01:00
parent 42eb802126
commit 78a246b44a
1 changed files with 2 additions and 2 deletions

View File

@ -404,12 +404,12 @@ subroutine readVTR(grid,geomSize,origin,material)
size_deflated = temp(4:) size_deflated = temp(4:)
bytes_inflated = base64_to_bytes(base64_str(base64_nChar(headerLen)+1_pI64:)) bytes_inflated = base64_to_bytes(base64_str(base64_nChar(headerLen)+1_pI64:))
allocate(bytes(0)) allocate(bytes(sum(size_inflated)))
e = 0_pI64 e = 0_pI64
do b = 1, nBlock do b = 1, nBlock
s = e + 1_pI64 s = e + 1_pI64
e = s + size_deflated(b) - 1_pI64 e = s + size_deflated(b) - 1_pI64
bytes = [bytes,zlib_inflate(bytes_inflated(s:e),size_inflated(b))] bytes(sum(size_inflated(:b-1))+1_pI64:sum(size_inflated(:b))) = zlib_inflate(bytes_inflated(s:e),size_inflated(b))
enddo enddo
end function asBytes_compressed end function asBytes_compressed