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

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

本文整理了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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public int[] getCurrentCounter() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.current;
  6. }

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }
  7. public int[] getCurrentCounter() {

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }
  7. public int[] getCurrentCounter() {

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }

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

  1. public String toString() {
  2. if (counter == null)
  3. counter = new Index(maa.getShape());
  4. counter.setCurrentCounter( currElement);
  5. return counter.toString();
  6. }
  7. public int[] getCurrentCounter() {

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

  1. resultIndex = new Index(shape, resultStrides);

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

  1. resultIndex = new Index(shape, resultStrides);

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

  1. resultIndex = new Index(shape, resultStrides);

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

  1. TileLayout(Section localSection, Section wantSection) throws InvalidRangeException {
  2. Section dataSection = localSection.compact();
  3. Section resultSection = wantSection.compact();
  4. if (debug) System.out.println(" resultSection: " + resultSection);
  5. if (debug) System.out.println(" dataSection: " + dataSection);
  6. int rank = dataSection.getRank();
  7. // total elements to transfer
  8. total = (int) dataSection.computeSize();
  9. // figure out the offset
  10. long product = 1;
  11. startElem = 0; // offset in want
  12. for (int ii = rank - 1; ii >= 0; ii--) {
  13. int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii);
  14. if (d > 0) startElem += product * d;
  15. product *= resultSection.getShape(ii);
  16. }
  17. resultPos = startElem;
  18. // we will use an Index object to keep track of the chunks
  19. // last range length is nelems; reduce index rank
  20. nelems = localSection.getShape(rank - 1);
  21. int[] stride = new int[rank - 1];
  22. int[] shape = new int[rank - 1];
  23. product = resultSection.getShape(rank - 1);
  24. for (int ii = rank - 2; ii >= 0; ii--) {
  25. stride[ii] = (int) product;
  26. shape[ii] = dataSection.getShape(ii);
  27. product *= resultSection.getShape(ii);
  28. }
  29. index = new Index(shape, stride);
  30. }

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

  1. TileLayout(Section localSection, Section wantSection) throws InvalidRangeException {
  2. Section dataSection = localSection.compact();
  3. Section resultSection = wantSection.compact();
  4. if (debug) System.out.println(" resultSection: " + resultSection);
  5. if (debug) System.out.println(" dataSection: " + dataSection);
  6. int rank = dataSection.getRank();
  7. // total elements to transfer
  8. total = (int) dataSection.computeSize();
  9. // figure out the offset
  10. long product = 1;
  11. startElem = 0; // offset in want
  12. for (int ii = rank - 1; ii >= 0; ii--) {
  13. int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii);
  14. if (d > 0) startElem += product * d;
  15. product *= resultSection.getShape(ii);
  16. }
  17. resultPos = startElem;
  18. // we will use an Index object to keep track of the chunks
  19. // last range length is nelems; reduce index rank
  20. nelems = localSection.getShape(rank - 1);
  21. int[] stride = new int[rank - 1];
  22. int[] shape = new int[rank - 1];
  23. product = resultSection.getShape(rank - 1);
  24. for (int ii = rank - 2; ii >= 0; ii--) {
  25. stride[ii] = (int) product;
  26. shape[ii] = dataSection.getShape(ii);
  27. product *= resultSection.getShape(ii);
  28. }
  29. index = new Index(shape, stride);
  30. }

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

  1. TileLayout(Section localSection, Section wantSection) throws InvalidRangeException {
  2. Section dataSection = localSection.compact();
  3. Section resultSection = wantSection.compact();
  4. if (debug) System.out.println(" resultSection: " + resultSection);
  5. if (debug) System.out.println(" dataSection: " + dataSection);
  6. int rank = dataSection.getRank();
  7. // total elements to transfer
  8. total = (int) dataSection.computeSize();
  9. // figure out the offset
  10. long product = 1;
  11. startElem = 0; // offset in want
  12. for (int ii = rank - 1; ii >= 0; ii--) {
  13. int d = dataSection.getOrigin(ii) - resultSection.getOrigin(ii);
  14. if (d > 0) startElem += product * d;
  15. product *= resultSection.getShape(ii);
  16. }
  17. resultPos = startElem;
  18. // we will use an Index object to keep track of the chunks
  19. // last range length is nelems; reduce index rank
  20. nelems = localSection.getShape(rank - 1);
  21. int[] stride = new int[rank - 1];
  22. int[] shape = new int[rank - 1];
  23. product = resultSection.getShape(rank - 1);
  24. for (int ii = rank - 2; ii >= 0; ii--) {
  25. stride[ii] = (int) product;
  26. shape[ii] = dataSection.getShape(ii);
  27. product *= resultSection.getShape(ii);
  28. }
  29. index = new Index(shape, stride);
  30. }

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

  1. private static Index factory(int rank) {
  2. switch (rank) {
  3. case 0:
  4. return new Index0D();
  5. case 1:
  6. return new Index1D();
  7. case 2:
  8. return new Index2D();
  9. case 3:
  10. return new Index3D();
  11. case 4:
  12. return new Index4D();
  13. case 5:
  14. return new Index5D();
  15. case 6:
  16. return new Index6D();
  17. case 7:
  18. return new Index7D();
  19. default:
  20. return new Index(rank);
  21. }
  22. }

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

  1. private static Index factory(int rank) {
  2. switch (rank) {
  3. case 0:
  4. return new Index0D();
  5. case 1:
  6. return new Index1D();
  7. case 2:
  8. return new Index2D();
  9. case 3:
  10. return new Index3D();
  11. case 4:
  12. return new Index4D();
  13. case 5:
  14. return new Index5D();
  15. case 6:
  16. return new Index6D();
  17. case 7:
  18. return new Index7D();
  19. default:
  20. return new Index(rank);
  21. }
  22. }

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

  1. private static Index factory(int rank) {
  2. switch (rank) {
  3. case 0:
  4. return new Index0D();
  5. case 1:
  6. return new Index1D();
  7. case 2:
  8. return new Index2D();
  9. case 3:
  10. return new Index3D();
  11. case 4:
  12. return new Index4D();
  13. case 5:
  14. return new Index5D();
  15. case 6:
  16. return new Index6D();
  17. case 7:
  18. return new Index7D();
  19. default:
  20. return new Index(rank);
  21. }
  22. }

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

  1. /**
  2. * Generate a subclass of Index optimized for this array's rank
  3. * @param shape use this shape
  4. * @return a subclass of Index optimized for this array's rank
  5. */
  6. static public Index factory(int[] shape) {
  7. int rank = shape.length;
  8. switch (rank) {
  9. case 0:
  10. return new Index0D();
  11. case 1:
  12. return new Index1D(shape);
  13. case 2:
  14. return new Index2D(shape);
  15. case 3:
  16. return new Index3D(shape);
  17. case 4:
  18. return new Index4D(shape);
  19. case 5:
  20. return new Index5D(shape);
  21. case 6:
  22. return new Index6D(shape);
  23. case 7:
  24. return new Index7D(shape);
  25. default:
  26. return new Index(shape);
  27. }
  28. }

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

  1. /**
  2. * Generate a subclass of Index optimized for this array's rank
  3. * @param shape use this shape
  4. * @return a subclass of Index optimized for this array's rank
  5. */
  6. static public Index factory(int[] shape) {
  7. int rank = shape.length;
  8. switch (rank) {
  9. case 0:
  10. return new Index0D();
  11. case 1:
  12. return new Index1D(shape);
  13. case 2:
  14. return new Index2D(shape);
  15. case 3:
  16. return new Index3D(shape);
  17. case 4:
  18. return new Index4D(shape);
  19. case 5:
  20. return new Index5D(shape);
  21. case 6:
  22. return new Index6D(shape);
  23. case 7:
  24. return new Index7D(shape);
  25. default:
  26. return new Index(shape);
  27. }
  28. }

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

  1. /**
  2. * Generate a subclass of Index optimized for this array's rank
  3. *
  4. * @param shape use this shape
  5. * @return a subclass of Index optimized for this array's rank
  6. */
  7. static public Index factory(int[] shape) {
  8. int rank = shape.length;
  9. switch (rank) {
  10. case 0:
  11. return new Index0D();
  12. case 1:
  13. return new Index1D(shape);
  14. case 2:
  15. return new Index2D(shape);
  16. case 3:
  17. return new Index3D(shape);
  18. case 4:
  19. return new Index4D(shape);
  20. case 5:
  21. return new Index5D(shape);
  22. case 6:
  23. return new Index6D(shape);
  24. case 7:
  25. return new Index7D(shape);
  26. default:
  27. return new Index(shape);
  28. }
  29. }

相关文章