Serial Implementation
The serial implementation of the above algorithm divides the problem in two three distinct classes.
- Cellular - the class which defines the cell. It keeps track of the generation, pointer to a world class which defines the dimensions in which the cell exists and a pointer to the rule class which governs the change in the cell on every generation.
- World - the class which defines the world, the environment for the cell in which the cell undergoes evolution. The class contains the dimensions for the 2D dimensional matrix where the cell is positioned.
- Rule - the class which defines the rule which govern the evolution in every generation. It contains pointers to two world object, the current and the next computed one.
Serial Hot Spot
The serial implementation basically applies the rule to every cell in the 2D dimensional matrix, and computes another world determining the position of every cell using the number of neighbours surrounding it. The following loop takes the maximum amount of computation time in determining the position of the cells in the next generation. This will be parallelized in the coming sections.