/** 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(); }
/** 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); }
/** Does a time step. */ protected void doStep() { maxwell.doStep(); plotField(); frame.setMessage("t=" + decimalFormat.format(maxwell.t)); }
/** Constructor MaxwellApp */ public MaxwellApp() { frame.setZRange(false, 0, 1.0); }