Example #1
0
 /** Initializes the animation. */
 public void initialize() {
   size = control.getInt("size");
   Exy = new double[2][size][size];
   maxwell = new Maxwell(size);
   frame.setAll(Exy);
   frame.setPreferredMinMax(0, Maxwell.dl * size, Maxwell.dl * size, 0);
   plotField();
 }
Example #2
0
 /** Plots the electric field using the arrays in the Maxwell object. */
 void plotField() {
   double[][][][] E = maxwell.E; // electric field
   int mid = size / 2;
   for (int i = 0; i < size; i++) {
     for (int j = 0; j < size; j++) {
       Exy[0][i][j] = E[i][j][mid][0]; // Ex
       Exy[1][i][j] = E[i][j][mid][1]; // Ey
     }
   }
   frame.setAll(Exy);
 }
Example #3
0
 /** Does a time step. */
 protected void doStep() {
   maxwell.doStep();
   plotField();
   frame.setMessage("t=" + decimalFormat.format(maxwell.t));
 }
Example #4
0
 /** Constructor MaxwellApp */
 public MaxwellApp() {
   frame.setZRange(false, 0, 1.0);
 }