CellularAutomata
Loading...
Searching...
No Matches
kernels.inl
1#pragma once
2
3#include "../core/common.hpp"
4
5namespace CellularAutomata
6{
7 namespace Kernels
8 {
9 template <typename T>
10 void ones(T* array, const unsigned int s)
11 {
12 for (int i = 0; i < s * s; i++)
13 {
14 array[i] = static_cast<T>(1);
15 }
16 }
17
18 template <typename T>
19 void life(T* array, const unsigned int s)
20 {
21 int center = (s * s) / 2;
22 for (int i = 0; i < s * s; i++)
23 {
24 if (i == center)
25 array[i] = static_cast<T>(16);
26 else
27 array[i] = static_cast<T>(1);
28 }
29 }
30
31 // template <typename T>
32 // void normal(T* array, const int s);
33 }
34}
void ones(T *array, const unsigned int s)
Fills the kernel with ones.
Definition kernels.inl:10
void life(T *array, const unsigned int s)
Fills the kernel with a pattern to run Conway's Game of Life.
Definition kernels.inl:19
Main namespace.
Definition common.hpp:33