本文整理了Java中ucar.ma2.Index.computeSize()
方法的一些代码示例,展示了Index.computeSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Index.computeSize()
方法的具体详情如下:
包路径:ucar.ma2.Index
类名称:Index
方法名:computeSize
[英]Compute total number of elements in the array. Stop at vlen
[中]计算数组中元素的总数。在维伦停车
代码示例来源:origin: edu.ucar/netcdf
public Member(String name, String desc, String units, DataType dtype, int[] shape) {
this.name = name;
this.desc = desc;
this.units = units;
this.dtype = dtype;
this.shape = shape;
this.size = (int) Index.computeSize(shape);
}
代码示例来源:origin: edu.ucar/netcdf
public Member(Member from) {
this.name = from.name;
this.desc = from.desc;
this.units = from.units;
this.dtype = from.dtype;
this.shape = from.shape;
this.size = (int) Index.computeSize(shape);
this.members = from.members;
}
代码示例来源:origin: Unidata/thredds
CoordIterator() {
done = 0;
total = Index.computeSize(shape); // total number of elements
}
代码示例来源:origin: edu.ucar/cdm
public void setShape(int[] shape) {
this.shape = shape;
this.size = (int) Index.computeSize(shape);
this.isVariableLength = (shape.length > 0 && shape[shape.length - 1] < 0);
}
代码示例来源:origin: Unidata/thredds
public void setShape(int[] shape) {
this.shape = Objects.requireNonNull(shape);
this.size = (int) Index.computeSize(shape);
this.isVariableLength = (shape.length > 0 && shape[shape.length - 1] < 0);
}
代码示例来源:origin: edu.ucar/cdm
/**
* /** Compute total number of elements represented by the section.
*
* @param section List of Range objects
* @return total number of elements
* @deprecated use Section.computeSize()
*/
static public long computeSize(List section) {
int[] shape = getShape(section);
return Index.computeSize(shape);
}
代码示例来源:origin: edu.ucar/netcdf
/**
* /** Compute total number of elements represented by the section.
*
* @param section List of Range objects
* @return total number of elements
* @deprecated use Section.computeSize()
*/
static public long computeSize(List section) {
int[] shape = getShape(section);
return Index.computeSize(shape);
}
代码示例来源:origin: Unidata/thredds
SectionIterator() {
int ss = 1;
for (int i = getRank() - 1; i >= 0; i--) { // fastest varying last
stride[i] = ss;
ss *= fullShape[i];
}
for (int i = 0; i < getRank(); i++) {
java.util.Iterator<Integer> iter = getRange(i).iterator();
odo[i] = iter.next();
rangeIterList.add(iter);
}
done = 0;
total = Index.computeSize(getShape()); // total in the section
}
代码示例来源:origin: edu.ucar/netcdf
Iterator(int[] shape) {
int ss = 1;
for (int i = getRank() - 1; i >= 0; i--) {
odo[i] = getRange(i).first();
stride[i] = ss;
ss *= shape[i];
}
done = 0;
total = Index.computeSize(getShape()); // total in the section
}
代码示例来源:origin: edu.ucar/cdm
Iterator(int[] shape) {
int ss = 1;
for (int i = getRank() - 1; i >= 0; i--) {
odo[i] = getRange(i).first();
stride[i] = ss;
ss *= shape[i];
}
done = 0;
total = Index.computeSize(getShape()); // total in the section
}
代码示例来源:origin: edu.ucar/netcdf
static public void main2(String args[]) throws InvalidRangeException {
int[] totalShape = new int[] {1, 40, 530, 240};
int[] chunkShape = new int[] {1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
long size = 0;
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: edu.ucar/cdm
static public void main2(String args[]) throws InvalidRangeException {
int[] totalShape = new int[]{1, 40, 530, 240};
int[] chunkShape = new int[]{1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: Unidata/thredds
static public void main2(String args[]) throws InvalidRangeException {
int[] totalShape = new int[]{1, 40, 530, 240};
int[] chunkShape = new int[]{1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: edu.ucar/netcdf
static public void main2(String args[]) throws InvalidRangeException {
int[] totalShape = new int[]{1, 40, 530, 240};
int[] chunkShape = new int[]{1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
long size = 0;
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: edu.ucar/cdm
static public void main2(String args[]) throws InvalidRangeException {
int[] totalShape = new int[] {1, 40, 530, 240};
int[] chunkShape = new int[] {1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: edu.ucar/cdm
static public void main(String args[]) throws InvalidRangeException {
long maxChunkElems = maxChunk / 4;
int[] totalShape = new int[]{1, 40, 530, 240};
//int[] chunkShape = new int[] {1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
int[] chunkShape = index.computeChunkShape(maxChunkElems);
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: edu.ucar/cdm
static public void main(String args[]) throws InvalidRangeException {
long maxChunkElems = maxChunk / 4;
int[] totalShape = new int[] {1, 40, 530, 240};
//int[] chunkShape = new int[] {1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
int[] chunkShape = index.computeChunkShape(maxChunkElems);
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: Unidata/thredds
static public void main(String args[]) throws InvalidRangeException {
long maxChunkElems = maxChunk / 4;
int[] totalShape = new int[]{1, 40, 530, 240};
//int[] chunkShape = new int[] {1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
int[] chunkShape = index.computeChunkShape(maxChunkElems);
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: edu.ucar/netcdf
static public void main(String args[]) throws InvalidRangeException {
long maxChunkElems = maxChunk / 4;
int[] totalShape = new int[] {1, 40, 530, 240};
//int[] chunkShape = new int[] {1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
long size = 0;
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
int[] chunkShape = index.computeChunkShape(maxChunkElems);
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
代码示例来源:origin: edu.ucar/netcdf
static public void main(String args[]) throws InvalidRangeException {
long maxChunkElems = maxChunk / 4;
int[] totalShape = new int[]{1, 40, 530, 240};
//int[] chunkShape = new int[] {1, 1, 530, 240};
FileWriter2.ChunkingIndex index = new FileWriter2.ChunkingIndex(totalShape);
long size = 0;
while (index.currentElement() < index.getSize()) {
int[] chunkOrigin = index.getCurrentCounter();
int[] chunkShape = index.computeChunkShape(maxChunkElems);
System.out.printf(" %s%n", new Section(chunkOrigin, chunkShape));
index.setCurrentCounter(index.currentElement() + (int) Index.computeSize(chunkShape));
}
}
内容来源于网络,如有侵权,请联系作者删除!