23 for (
int i = 0; i < axis1_dim; i++)
25 std::swap(vector[i], next_vector[i]);
39void swap_states(T **matrix, T **next_matrix,
int axis1_dim,
int axis2_dim)
41 for (
int i = 0; i < axis1_dim; i++)
43 for (
int j = 0; j < axis2_dim; j++)
45 std::swap(matrix[i][j], next_matrix[i][j]);
46 next_matrix[i][j] = T();
61void swap_states(T ***tensor, T ***next_tensor,
int axis1_dim,
int axis2_dim,
int axis3_dim)
63 for (
int i = 0; i < axis1_dim; i++)
65 for (
int j = 0; j < axis2_dim; j++)
67 for (
int k = 0; k < axis3_dim; k++)
69 std::swap(tensor[i][j][k], next_tensor[i][j][k]);
70 next_tensor[i][j][k] = T();
119bool less_than_votes(
const std::pair<int, int> &a,
const std::pair<int, int> &b);
157void get_density(std::ifstream& data, std::ofstream& result);
bool is_diagonal_neighboring_cell_3d(int i, int j, int k)
determines if a cell is diagonal to the central cell if k == 0 then both i and j have be non-zero dia...
Definition: CA_utils.cpp:28
bool less_than_votes(const std::pair< int, int > &a, const std::pair< int, int > &b)
Determines if a has less votes than b.
Definition: CA_utils.cpp:49
bool is_diagonal_neighboring_cell_2d(int i, int j)
determines if a cell is diagonal to the central cell diagram of slice: 1 = diagonal cell 1 0 1 0 0 0 ...
Definition: CA_utils.cpp:19
void get_periodic_von_neumann_neighbor_index(int rank, int radius, int neighborhood_array_index, int *neighbor_index)
Get the periodic Von Neumann neighbor index [x, y, z] from a flattened neighborhood array index.
Definition: CA_utils.cpp:114
void swap_states(T *vector, T *next_vector, int axis1_dim)
swaps the computed next_vector to the current vector
Definition: CAutils.h:21
int get_periodic_index(int i, int di, int axis_dim)
get the periodic index used for finding periodic boundary neighbors
Definition: CA_utils.cpp:54
void get_density(std::ifstream &data, std::ofstream &result)
Get the density result output to the result file.
Definition: CA_utils.cpp:217
void get_periodic_moore_neighbor_index(int rank, int radius, int neighborhood_array_index, int *neighbor_index)
Get the periodic Moore neighbor index [x, y, z] from a flattened neighborhood array index.
Definition: CA_utils.cpp:59