super(model);
writeBackInterval = writeBack;
this.maxThreads = maxThreads;
ICAGrid camodel = getModel();
dimensions = camodel.getDimensions();
// create internal grid
int max = 1;
for (int v : dimensions) {
max *= v;
}
gridFrom = new Object[max];
gridTo = new Object[max];
nStates = new NeighborStates[max];
this.indexCache = indexCache;
if (indexCache) {
coordsCache = new int[max][];
}
// fill from grid
for (int i = 0; i < gridFrom.length; i++) {
Cell<? extends CAState<Object>, Object> cell =
(Cell<? extends CAState<Object>, Object>) camodel
.getCell(indexToModel(i));
gridFrom[i] = cell.getState();
nStates[i] = new NeighborStates(this, cell, dimensions, cell.isTorus());
}
}