public ProductionField(int x, int y, float initialPressure, float permeability, float averagePorosity, FluidType fluid, float cellSize) { xDims = x; yDims = y; simulationCells = new SimulationCell[x][]; this.cellSize = cellSize; // populate cartesian simulation cell array for (int i = 0; i < x; i++) { simulationCells[i] = new SimulationCell[y]; for (int j = 0; j < y; j++) { simulationCells[i][j] = new SimulationCell(initialPressure, permeability, averagePorosity, fluid, cellSize); } } // Once all cells placed, link all cells to siblings for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { foreach (var cell in GetCellNeighbours(i, j)) { simulationCells[i][j].AddAdjacentCell(cell); } } } // initialise simulation datastructures implicitCalculationMask = GenerateImplicitMatrixMask(); implicitCellMatrix = buildCellMatrix(); implicitCalculationMatrix = new float[xDims * yDims, xDims *yDims]; }
public void AddAdjacentCell(SimulationCell otherCell) { if (adjacentCells.Count >= 6) { return; } else { adjacentCells.Add(otherCell); } }