Esempio n. 1
0
  /*------------------------------------------------------------------*/
  double getInitialCausalCoefficientMirrorOnBounds(double[] c, double z, double tolerance) {
    double z1 = z, zn = Math.pow(z, c.length - 1);
    double sum = c[0] + zn * c[c.length - 1];
    int horizon = c.length;

    if (0.0 < tolerance) {
      horizon = 2 + (int) (Math.log(tolerance) / Math.log(Math.abs(z)));
      horizon = (horizon < c.length) ? (horizon) : (c.length);
    }
    zn = zn * zn;
    for (int n = 1; (n < (horizon - 1)); n++) {
      zn = zn / z;
      sum = sum + (z1 + zn) * c[n];
      z1 = z1 * z;
    }
    return (sum / (1.0 - Math.pow(z, 2 * c.length - 2)));
  } /* end getInitialCausalCoefficientMirrorOnBounds */
  void sauvegarde(
      int v1[],
      double v2[],
      double s[],
      double s2[],
      double xg[],
      double yg[],
      double zg[],
      double[][] J,
      double[][][] dir,
      int n,
      byte[] bord,
      double[][] lmin,
      double[][] lmax,
      String directory,
      String name) {
    double sp;

    PrintWriter pw = null;
    try {
      FileOutputStream fos = new FileOutputStream(directory + name);
      BufferedOutputStream bos = new BufferedOutputStream(fos);
      pw = new PrintWriter(bos);
    } catch (IOException e) {
      return;
    }

    pw.println(
        "nb xg yg zg volpix volmarch surfacemarch surfacemarchnb sphericity I1 I2 I3 vI1x vI1y vI1z  vI2x vI2y vI2z  vI3x vI3y vI3z a b c Fab Fac Fbc xmin xmax ymin ymax zmin zmax dx dy dz border");

    for (int i = 0; i < n; i++) {
      pw.print(i + 1);
      pw.print(" ");
      pw.print(xg[i]);
      pw.print(" ");
      pw.print(yg[i]);
      pw.print(" ");
      pw.print(zg[i]);
      pw.print(" ");
      pw.print(v1[i]);
      pw.print(" ");
      pw.print(v2[i]);
      pw.print(" ");
      pw.print(s[i]);
      pw.print(" ");
      pw.print(s2[i]);
      sp = 6 * v2[i] * Math.sqrt(3.14159265 / (s2[i] * s2[i] * s2[i]));
      pw.print(" ");
      pw.print(sp);
      pw.print(" ");
      pw.print(J[0][i]);
      pw.print(" ");
      pw.print(J[1][i]);
      pw.print(" ");
      pw.print(J[2][i]);
      pw.print(" ");
      pw.print(dir[0][0][i]);
      pw.print(" ");
      pw.print(dir[1][0][i]);
      pw.print(" ");
      pw.print(dir[2][0][i]);
      pw.print(" ");
      pw.print(dir[0][1][i]);
      pw.print(" ");
      pw.print(dir[1][1][i]);
      pw.print(" ");
      pw.print(dir[2][1][i]);
      pw.print(" ");
      pw.print(dir[0][2][i]);
      pw.print(" ");
      pw.print(dir[1][2][i]);
      pw.print(" ");
      pw.print(dir[2][2][i]);
      pw.print(" ");
      double ma = (J[0][i] + J[1][i] - J[2][i]);
      double mb = (J[0][i] - J[1][i] + J[2][i]);
      double mc = (-J[0][i] + J[1][i] + J[2][i]);
      double b1 = (3 * mb * mb / (16 * Math.sqrt(ma * mc)));
      b1 = Math.pow(b1, 0.2);
      double a = b1 * Math.sqrt(ma / mb);
      double b = b1;
      double c = b * Math.sqrt(mc / mb);
      double Fab = Math.sqrt((J[0][i] + J[1][i] - J[2][i]) / (J[0][i] - J[1][i] + J[2][i]));
      double Fac = Math.sqrt((J[0][i] + J[1][i] - J[2][i]) / (-J[0][i] + J[1][i] + J[2][i]));
      double Fbc = Math.sqrt((J[0][i] - J[1][i] + J[2][i]) / (-J[0][i] + J[1][i] + J[2][i]));
      pw.print(a);
      pw.print(" ");
      pw.print(b);
      pw.print(" ");
      pw.print(c);
      pw.print(" ");
      pw.print(Fab);
      pw.print(" ");
      pw.print(Fac);
      pw.print(" ");
      pw.print(Fbc);
      pw.print(" ");
      pw.print(lmin[i][0] - 0.5);
      pw.print(" ");
      pw.print(lmax[i][0] + 0.5);
      pw.print(" ");
      pw.print(lmin[i][1] - 0.5);
      pw.print(" ");
      pw.print(lmax[i][1] + 0.5);
      pw.print(" ");
      pw.print(lmin[i][2] - 0.5);
      pw.print(" ");
      pw.print(lmax[i][2] + 0.5);
      pw.print(" ");
      double dx = lmax[i][0] - lmin[i][0] + 1;
      double dy = lmax[i][1] - lmin[i][1] + 1;
      double dz = lmax[i][2] - lmin[i][2] + 1;
      double a1 = dx;
      if (dy < a1) a1 = dy;
      if (dz < a1) a1 = dz;

      double a3 = dx;
      if (dy > a3) a3 = dy;
      if (dz > a3) a3 = dz;
      double a2 = dx;

      if (dx != a1 && dx != a3) a2 = dx;
      if (dy != a1 && dy != a3) a2 = dy;
      if (dz != a1 && dz != a3) a2 = dz;

      pw.print(" ");
      pw.print(a1);
      pw.print(" ");
      pw.print(a2);
      pw.print(" ");
      pw.print(a3);
      pw.print(" ");
      pw.println(bord[i]);
    }
    pw.close();
  }