Package org.jamesii.model.ca.grid

Examples of org.jamesii.model.ca.grid.ICAGrid


    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());
    }
  }
View Full Code Here


    return c;
  }

  @Override
  protected void nextStep() {
    final ICAGrid model = getModel();

    counter++;

    ForLoop.FOR(0, gridFrom.length, kernel, maxThreads);

    // flip grids
    Object[] temp = gridFrom;
    gridFrom = gridTo;
    gridTo = temp;

    if (counter >= writeBackInterval) {
      counter = 0;
      model.changed();
      changed();

      model.getState().changed();
      model.getState().isChangedRR();
    }

    time += model.timeAdvance();
  }
View Full Code Here

    if (!(model instanceof ICAGrid)) {
      modelGraph = new SimpleGraph(1);
      return modelGraph;
    }

    ICAGrid caModel = (ICAGrid) model;

    int vertexCount = countNodes(caModel);

    modelGraph = new SimpleGraph(vertexCount);
View Full Code Here

TOP

Related Classes of org.jamesii.model.ca.grid.ICAGrid

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.