@@ -27,14 +27,10 @@ internal fun <T> H5builder.readChunkedData(v2: Variable<T>, wantSection: Section
2727 throw RuntimeException (" Illegal nbytes to read = $sizeBytes " )
2828 }
2929 val ba = ByteArray (sizeBytes.toInt())
30-
31- // just reading into memory the entire index for now
32- // val index = BTree2j(h5, v2.name, vinfo.dataPos, vinfo.storageDims)
33-
3430 val filters = FilterPipeline (v2.name, vinfo.mfp, vinfo.h5type.isBE)
3531 val state = OpenFileState (0L , vinfo.h5type.isBE)
3632
37- // just run through all the chunks, we wont read any that we dont need
33+ // run through all the chunks, we wont read any that we dont need
3834 for (dataChunk: DataChunk in index) {
3935 val dataSection = IndexSpace (v2.rank, dataChunk.offsets.toLongArray(), vinfo.storageDims)
4036 val chunker = Chunker (dataSection, wantSpace) // each DataChunkEntry has its own Chunker iteration
@@ -62,60 +58,6 @@ internal fun <T> H5builder.readChunkedData(v2: Variable<T>, wantSection: Section
6258 }
6359}
6460
65- /* DataLayoutBTreeVer1
66- internal fun <T> H5builder.readBtree1data(v2: Variable<T>, wantSection: Section): ArrayTyped<T> {
67- val vinfo = v2.spObject as DataContainerVariable
68- val h5type = vinfo.h5type
69-
70- val elemSize = vinfo.storageDims[vinfo.storageDims.size - 1].toInt() // last one is always the elements size
71- val datatype = vinfo.h5type.datatype()
72-
73- val wantSpace = IndexSpace(wantSection)
74- val sizeBytes = wantSpace.totalElements * elemSize
75- if (sizeBytes <= 0 || sizeBytes >= Int.MAX_VALUE) {
76- throw RuntimeException("Illegal nbytes to read = $sizeBytes")
77- }
78- val ba = ByteArray(sizeBytes.toInt())
79-
80- val btree1 = if (vinfo.mdl is DataLayoutBTreeVer1) {
81- val rafext: OpenFileExtended = this.openNewFileExtended()
82- BTree1data(rafext, vinfo.dataPos, v2.shape, vinfo.storageDims)
83- } else {
84- throw RuntimeException("Unsupported mdl ${vinfo.mdl}")
85- }
86-
87- //val tiledData = H5TiledData1(btree1, v2.shape, vinfo.storageDims)
88- val filters = FilterPipeline(v2.name, vinfo.mfp, vinfo.h5type.isBE)
89- //if (debugChunking) println(" readChunkedData tiles=${tiledData.tiling}")
90-
91- var transferChunks = 0
92- val state = OpenFileState(0L, vinfo.h5type.isBE)
93- btree1.asSequence().forEach { dataChunk ->
94- val dataSection = IndexSpace(v2.rank, dataChunk.offsets.toLongArray(), vinfo.storageDims)
95- val chunker = Chunker(dataSection, wantSpace) // each DataChunkEntry has its own Chunker iteration
96- if (dataChunk.isMissing()) {
97- if (debugChunking) println(" missing ${dataChunk.show()}")
98- chunker.transferMissing(vinfo.fillValue, elemSize, ba)
99- } else {
100- if (debugChunking) println(" chunk=${dataChunk.show()}")
101- state.pos = dataChunk.address
102- val chunkData = this.raf.readByteArray(state, dataChunk.size)
103- val filteredData = if (dataChunk.filterMask == null) chunkData
104- else filters.apply(chunkData, dataChunk.filterMask)
105- chunker.transferBA(filteredData, 0, elemSize, ba, 0)
106- transferChunks += chunker.transferChunks
107- }
108- }
109-
110- val shape = wantSpace.shape.toIntArray()
111-
112- return if (h5type.datatype5 == Datatype5.Vlen) {
113- this.processVlenIntoArray(h5type, shape, ba, wantSpace.totalElements.toInt(), elemSize)
114- } else {
115- this.processDataIntoArray(ba, vinfo.h5type.isBE, datatype, shape, h5type, elemSize) as ArrayTyped<T>
116- }
117- } */
118-
11961internal fun <T > readChunkedDataWithIterator (hdf5 : Hdf5File , v2 : Variable <T >, wantSection : SectionPartial ? ): ArrayTyped <T > {
12062 val vinfo = v2.spObject as DataContainerVariable
12163 val datatype = vinfo.h5type.datatype()
@@ -149,7 +91,6 @@ internal fun <T> readChunkedDataWithIterator(hdf5: Hdf5File, v2: Variable<T>, wa
14991 val dataSection = IndexSpace (dataChunk.chunkSection)
15092 val chunker = Chunker (dataSection, wantSpace) // each DataChunkEntry has its own Chunker iteration
15193 chunker.forEach {
152- // println(it)
15394 dataChunk.array.transfer(values, it)
15495 }
15596 }
0 commit comments