ucar.ma2.Index.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中ucar.ma2.Index.<init>()方法的一些代码示例,展示了Index.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Index.<init>()方法的具体详情如下:
包路径:ucar.ma2.Index
类名称:Index
方法名:<init>

Index.<init>介绍

[英]General case Index - use when you want to manipulate current elements yourself
[中]常规大小写索引-当您希望自己操作当前元素时使用

代码示例

代码示例来源:origin: edu.ucar/netcdf

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

代码示例来源:origin: edu.ucar/cdm

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

代码示例来源:origin: edu.ucar/netcdf

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

代码示例来源:origin: Unidata/thredds

public int[] getCurrentCounter() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.current;
}

代码示例来源:origin: Unidata/thredds

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}
public int[] getCurrentCounter() {

代码示例来源:origin: edu.ucar/netcdf

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}
public int[] getCurrentCounter() {

代码示例来源:origin: edu.ucar/netcdf

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}

代码示例来源:origin: edu.ucar/cdm

public String toString() {
 if (counter == null)
  counter = new Index(maa.getShape());
 counter.setCurrentCounter( currElement);
 return counter.toString();
}
public int[] getCurrentCounter() {

代码示例来源:origin: edu.ucar/cdm

resultIndex = new Index(shape, resultStrides);

代码示例来源:origin: Unidata/thredds

resultIndex = new Index(shape, resultStrides);

代码示例来源:origin: edu.ucar/netcdf

resultIndex = new Index(shape, resultStrides);

代码示例来源:origin: Unidata/thredds

TileLayout(Section localSection, Section wantSection) throws InvalidRangeException {
 Section dataSection = localSection.compact();
 Section resultSection = wantSection.compact();
 if (debug) System.out.println(" resultSection: " + resultSection);
 if (debug) System.out.println(" dataSection: " + dataSection);
 int rank = dataSection.getRank();
 // total elements to transfer
 total = (int) dataSection.computeSize();
 // figure out the offset
 long product = 1;
 startElem = 0; // offset in want
 for (int ii = rank - 1; ii >= 0; ii--) {
  int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii);
  if (d > 0) startElem += product * d;
  product *= resultSection.getShape(ii);
 }
 resultPos = startElem;
 // we will use an Index object to keep track of the chunks
 // last range length is nelems; reduce index rank
 nelems = localSection.getShape(rank - 1);
 int[] stride = new int[rank - 1];
 int[] shape = new int[rank - 1];
 product = resultSection.getShape(rank - 1);
 for (int ii = rank - 2; ii >= 0; ii--) {
  stride[ii] = (int) product;
  shape[ii] = dataSection.getShape(ii);
  product *= resultSection.getShape(ii);
 }
 index = new Index(shape, stride);
}

代码示例来源:origin: edu.ucar/cdm

TileLayout(Section localSection, Section wantSection) throws InvalidRangeException {
 Section dataSection = localSection.compact();
 Section resultSection = wantSection.compact();
 if (debug) System.out.println(" resultSection: " + resultSection);
 if (debug) System.out.println(" dataSection: " + dataSection);
 int rank = dataSection.getRank();
 // total elements to transfer
 total = (int) dataSection.computeSize();
 // figure out the offset
 long product = 1;
 startElem = 0; // offset in want
 for (int ii = rank - 1; ii >= 0; ii--) {
  int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii);
  if (d > 0) startElem += product * d;
  product *= resultSection.getShape(ii);
 }
 resultPos = startElem;
 // we will use an Index object to keep track of the chunks
 // last range length is nelems; reduce index rank
 nelems = localSection.getShape(rank - 1);
 int[] stride = new int[rank - 1];
 int[] shape = new int[rank - 1];
 product = resultSection.getShape(rank - 1);
 for (int ii = rank - 2; ii >= 0; ii--) {
  stride[ii] = (int) product;
  shape[ii] = dataSection.getShape(ii);
  product *= resultSection.getShape(ii);
 }
 index = new Index(shape, stride);
}

代码示例来源:origin: edu.ucar/netcdf

TileLayout(Section localSection, Section wantSection) throws InvalidRangeException {
 Section dataSection = localSection.compact();
 Section resultSection = wantSection.compact();
 if (debug) System.out.println(" resultSection: " + resultSection);
 if (debug) System.out.println(" dataSection: " + dataSection);
 int rank = dataSection.getRank();
 // total elements to transfer
 total = (int) dataSection.computeSize();
 // figure out the offset
 long product = 1;
 startElem = 0; // offset in want
 for (int ii = rank - 1; ii >= 0; ii--) {
  int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii);
  if (d > 0) startElem += product * d;
  product *= resultSection.getShape(ii);
 }
 resultPos = startElem;
 // we will use an Index object to keep track of the chunks
 // last range length is nelems; reduce index rank
 nelems = localSection.getShape(rank - 1);
 int[] stride = new int[rank - 1];
 int[] shape = new int[rank - 1];
 product = resultSection.getShape(rank - 1);
 for (int ii = rank - 2; ii >= 0; ii--) {
  stride[ii] = (int) product;
  shape[ii] = dataSection.getShape(ii);
  product *= resultSection.getShape(ii);
 }
 index = new Index(shape, stride);
}

代码示例来源:origin: Unidata/thredds

private static Index factory(int rank) {
 switch (rank) {
  case 0:
   return new Index0D();
  case 1:
   return new Index1D();
  case 2:
   return new Index2D();
  case 3:
   return new Index3D();
  case 4:
   return new Index4D();
  case 5:
   return new Index5D();
  case 6:
   return new Index6D();
  case 7:
   return new Index7D();
  default:
   return new Index(rank);
 }
}

代码示例来源:origin: edu.ucar/netcdf

private static Index factory(int rank) {
 switch (rank) {
  case 0:
   return new Index0D();
  case 1:
   return new Index1D();
  case 2:
   return new Index2D();
  case 3:
   return new Index3D();
  case 4:
   return new Index4D();
  case 5:
   return new Index5D();
  case 6:
   return new Index6D();
  case 7:
   return new Index7D();
  default:
   return new Index(rank);
 }
}

代码示例来源:origin: edu.ucar/cdm

private static Index factory(int rank) {
 switch (rank) {
  case 0:
   return new Index0D();
  case 1:
   return new Index1D();
  case 2:
   return new Index2D();
  case 3:
   return new Index3D();
  case 4:
   return new Index4D();
  case 5:
   return new Index5D();
  case 6:
   return new Index6D();
  case 7:
   return new Index7D();
  default:
   return new Index(rank);
 }
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * Generate a subclass of Index optimized for this array's rank
 * @param shape use this shape
 * @return a subclass of Index optimized for this array's rank
 */
static public Index factory(int[] shape) {
 int rank = shape.length;
 switch (rank) {
  case 0:
   return new Index0D();
  case 1:
   return new Index1D(shape);
  case 2:
   return new Index2D(shape);
  case 3:
   return new Index3D(shape);
  case 4:
   return new Index4D(shape);
  case 5:
   return new Index5D(shape);
  case 6:
   return new Index6D(shape);
  case 7:
   return new Index7D(shape);
  default:
   return new Index(shape);
 }
}

代码示例来源:origin: edu.ucar/cdm

/**
 * Generate a subclass of Index optimized for this array's rank
 * @param shape use this shape
 * @return a subclass of Index optimized for this array's rank
 */
static public Index factory(int[] shape) {
 int rank = shape.length;
 switch (rank) {
  case 0:
   return new Index0D();
  case 1:
   return new Index1D(shape);
  case 2:
   return new Index2D(shape);
  case 3:
   return new Index3D(shape);
  case 4:
   return new Index4D(shape);
  case 5:
   return new Index5D(shape);
  case 6:
   return new Index6D(shape);
  case 7:
   return new Index7D(shape);
  default:
   return new Index(shape);
 }
}

代码示例来源:origin: Unidata/thredds

/**
 * Generate a subclass of Index optimized for this array's rank
 *
 * @param shape use this shape
 * @return a subclass of Index optimized for this array's rank
 */
static public Index factory(int[] shape) {
 int rank = shape.length;
 switch (rank) {
  case 0:
   return new Index0D();
  case 1:
   return new Index1D(shape);
  case 2:
   return new Index2D(shape);
  case 3:
   return new Index3D(shape);
  case 4:
   return new Index4D(shape);
  case 5:
   return new Index5D(shape);
  case 6:
   return new Index6D(shape);
  case 7:
   return new Index7D(shape);
  default:
   return new Index(shape);
 }
}

相关文章