/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class FloodIsolation
{
private final static int nEdges = 6;
private final int numberOfCells;
private boolean[] floodedCells;
private boolean[] floodedCellsTimeInterval;
private int[] neighborIds;
private double[] valueOfCellIds;
private double[] h;
private double[] h0;
private double[] vU;
private double[] vV;
private double[] vUh;
private double[] vVh;
private double[] vUh0;
private double[] vVh0;
private double[] ghh;
private double[] sfx;
private double[] sfy;
private double[] qInflow;
private double[] qStartTime;
private double[] qEndTime;
private double[] qIn;
private int[] lowerFloorCells;
private boolean[] flagInterface;
private int[] typeInterface;
private double[] cellLocationX;
private double[] cellLocationY;
private double[] cellLocationZ;
private int[] levelOfCell;
{
FloodIsolation isolation = new FloodIsolation();
long start
= System.
currentTimeMillis(); for (int i = 0; i < 400; i++) {
if(i % 100 == 0) {
}
isolation.isUpdateNeeded();
}
long stop
= System.
currentTimeMillis(); System.
out.
println("Time: " + (stop
- start
)); }
public FloodIsolation() {
this.numberOfCells = 20000;
this.h = new double[numberOfCells];
this.floodedCells = new boolean[numberOfCells];
this.floodedCellsTimeInterval = new boolean[numberOfCells];
this.qInflow = new double[numberOfCells];
this.qStartTime = new double[numberOfCells];
this.qEndTime = new double[numberOfCells];
this.lowerFloorCells = new int[numberOfCells];
this.cellLocationX = new double[numberOfCells];
this.cellLocationY = new double[numberOfCells];
this.cellLocationZ = new double[numberOfCells];
this.levelOfCell = new int[numberOfCells];
this.valueOfCellIds = new double[numberOfCells];
this.h0 = new double[numberOfCells];
this.vU = new double[numberOfCells];
this.vV = new double[numberOfCells];
this.vUh = new double[numberOfCells];
this.vVh = new double[numberOfCells];
this.vUh0 = new double[numberOfCells];
this.vVh0 = new double[numberOfCells];
this.ghh = new double[numberOfCells];
this.sfx = new double[numberOfCells];
this.sfy = new double[numberOfCells];
this.qIn = new double[numberOfCells];
this.neighborIds = new int[numberOfCells * nEdges];
this.flagInterface = new boolean[numberOfCells * nEdges];
this.typeInterface = new int[numberOfCells * nEdges];
}
public void isUpdateNeeded() {
for (int i = 0; i < numberOfCells; ++i) {
h[i] = h[i] + 1;
floodedCells[i] = !floodedCells[i];
floodedCellsTimeInterval[i] = !floodedCellsTimeInterval[i];
qInflow[i] = qInflow[i] + 1;
qStartTime[i] = qStartTime[i] + 1;
qEndTime[i] = qEndTime[i] + 1;
lowerFloorCells[i] = lowerFloorCells[i] + 1;
cellLocationX[i] = cellLocationX[i] + 1;
cellLocationY[i] = cellLocationY[i] + 1;
cellLocationZ[i] = cellLocationZ[i] + 1;
levelOfCell[i] = levelOfCell[i] + 1;
valueOfCellIds[i] = valueOfCellIds[i] + 1;
h0[i] = h0[i] + 1;
vU[i] = vU[i] + 1;
vV[i] = vV[i] + 1;
vUh[i] = vUh[i] + 1;
vVh[i] = vVh[i] + 1;
vUh0[i] = vUh0[i] + 1;
vVh0[i] = vVh0[i] + 1;
ghh[i] = ghh[i] + 1;
sfx[i] = sfx[i] + 1;
sfy[i] = sfy[i] + 1;
qIn[i] = qIn[i] + 1;
for(int j = 0; j < nEdges; ++j) {
flagInterface[i * nEdges + j] = !flagInterface[i * nEdges + j];
typeInterface[i * nEdges + j] = typeInterface[i * nEdges + j] + 1;
neighborIds[i * nEdges + j] = neighborIds[i * nEdges + j] + 1;
}
}
}
}