示例#1
0
 public Array3d clone() {
   try {
     Array3d ret = (Array3d) super.clone();
     ret._a = DoubleArray.clone(_a);
     return ret;
   } catch (CloneNotSupportedException e) {
     return null;
   }
 }
示例#2
0
 public void shift(double x, double y, double z) {
   int xs = (int) Math.round(x / (_lx / _nx));
   int ys = (int) Math.round(y / (_ly / _ny));
   int zs = (int) Math.round(z / (_lz / _nz));
   Array3d scratch = clone();
   for (int k = 0; k < _nz; k++) {
     int kp = (k + zs + _nz) % _nz;
     for (int j = 0; j < _ny; j++) {
       int jp = (j + ys + _ny) % _ny;
       for (int i = 0; i < _nx; i++) {
         int ip = (i + xs + _nx) % _nx;
         scratch.set(i, j, k, get(ip, jp, kp));
       }
     }
   }
   DoubleArray.copy(scratch._a, _a);
 }