public long getTotalNelems() { return chunker.getTotalNelems(); }
public long getTotalNelems() { return chunker.getTotalNelems(); }
public long getTotalNelems() { return chunker.getTotalNelems(); }
/** * Constructor. * * @param startPos starting address of the entire data array. * @param elemSize size of an element in bytes. * @param recSize size of outer stride in bytes * @param srcShape shape of the entire data array. must have rank > 0 * @param wantSection the wanted section of data * @throws ucar.ma2.InvalidRangeException if ranges are misformed */ public LayoutRegularSegmented(long startPos, int elemSize, long recSize, int[] srcShape, Section wantSection) throws InvalidRangeException { assert startPos > 0; assert elemSize > 0; assert recSize > 0; assert srcShape.length > 0; this.startPos = startPos; this.elemSize = elemSize; this.recSize = recSize; chunker = new IndexChunker(srcShape, wantSection); this.total = chunker.getTotalNelems(); this.innerNelems = (srcShape[0] == 0) ? 0 : Index.computeSize(srcShape) / srcShape[0]; this.done = 0; }
/** * Constructor. * * @param startPos starting address of the entire data array. * @param elemSize size of an element in bytes. * @param recSize size of outer stride in bytes * @param srcShape shape of the entire data array. must have rank > 0 * @param wantSection the wanted section of data * @throws ucar.ma2.InvalidRangeException if ranges are misformed */ public LayoutRegularSegmented(long startPos, int elemSize, long recSize, int[] srcShape, Section wantSection) throws InvalidRangeException { assert startPos > 0; assert elemSize > 0; assert recSize > 0; assert srcShape.length > 0; this.startPos = startPos; this.elemSize = elemSize; this.recSize = recSize; chunker = new IndexChunker(srcShape, wantSection); this.total = chunker.getTotalNelems(); this.innerNelems = (srcShape[0] == 0) ? 0 : Index.computeSize(srcShape) / srcShape[0]; this.done = 0; }
/** * Constructor. * * @param startPos starting address of the entire data array. * @param elemSize size of an element in bytes. * @param recSize size of outer stride in bytes * @param srcShape shape of the entire data array. must have rank > 0 * @param wantSection the wanted section of data * @throws ucar.ma2.InvalidRangeException if ranges are misformed */ public LayoutRegularSegmented(long startPos, int elemSize, long recSize, int[] srcShape, Section wantSection) throws InvalidRangeException { assert startPos > 0; assert elemSize > 0; assert recSize > 0; assert srcShape.length > 0; this.startPos = startPos; this.elemSize = elemSize; this.recSize = recSize; chunker = new IndexChunker(srcShape, wantSection); this.total = chunker.getTotalNelems(); this.innerNelems = (srcShape[0] == 0) ? 0 : Index.computeSize(srcShape) / srcShape[0]; this.done = 0; }
this.total = chunker.getTotalNelems(); this.done = 0; this.elemSize = elemSize;
this.total = chunker.getTotalNelems(); this.done = 0; this.elemSize = elemSize;
this.total = chunker.getTotalNelems(); this.done = 0; this.elemSize = elemSize;
@Test public void testPart() throws InvalidRangeException { int[] full = new int[] {2, 10, 20}; int[] part = new int[] {2, 5, 20}; Section section = new Section(part); IndexChunker index = new IndexChunker(full, section); assert index.getTotalNelems() == section.computeSize(); IndexChunker.Chunk chunk = index.next(); assert chunk.getNelems() == section.computeSize()/2; }
@Test public void testFull() throws InvalidRangeException { int[] shape = new int[] {123,22,92,12}; Section section = new Section(shape); IndexChunker index = new IndexChunker(shape, section); assert index.getTotalNelems() == section.computeSize(); IndexChunker.Chunk chunk = index.next(); assert chunk.getNelems() == section.computeSize(); assert !index.hasNext(); }