|
T * | get_vector () |
| Get the vector cell grid. More...
|
|
T * | get_next_vector () |
| Get the next state vector cell grid. More...
|
|
T ** | get_matrix () |
| Get the matrix cell grid. More...
|
|
T ** | get_next_matrix () |
| Get the next state matrix cell grid. More...
|
|
T *** | get_tensor () |
| Get the tensor cell grid. More...
|
|
T *** | get_next_tensor () |
| Get the next state tensor cell grid. More...
|
|
int | setup_boundary (CAEnums::Boundary bound_type, int radius) |
| Setup boundary with enum values from boundary and set the boundary radius. More...
|
|
| CellularAutomata () |
| Construct a new Cellular Automata object. More...
|
|
| ~CellularAutomata () |
| Destroy the Cellular Automata object. More...
|
|
int | setup_dimensions_1d (int axis1_dim, int fill_value=0) |
| Set up 1d array of cell states. More...
|
|
int | setup_dimensions_2d (int axis1_dim, int axis2_dim, int fill_value=0) |
| Set up 2d matrix of cell states. More...
|
|
int | setup_dimensions_3d (int axis1_dim, int axis2_dim, int axis3_dim, int fill_value=0) |
| Set up 3d tensor of cell states. More...
|
|
int | init_condition (int x_state, double prob) |
| Initializes the first state of the grid using random numbers. More...
|
|
int | step (void(custom_rule)(int *, int, T *, int, T &)) |
| Simulates a cellular automata step. More...
|
|
int | step () |
| Simulates a cellular automata step. More...
|
|
int | print_grid () |
| Print the current state of the grid. More...
|
|
int | setup_dimensions_1d (int axis1_dim, int fill_value) |
| Set up 1d array of cell states. More...
|
|
int | setup_dimensions_2d (int axis1_dim, int axis2_dim, int fill_value) |
| Set up 2d matrix of cell states. More...
|
|
int | setup_dimensions_3d (int axis1_dim, int axis2_dim, int axis3_dim, int fill_value) |
| Set up 3d tensor of cell states. More...
|
|
int | init_condition (int x_state, double prob) |
| Initializes the first state of the grid using random numbers. More...
|
|
int | print_grid () |
| Print the current state of the grid. More...
|
|
int | step (void(custom_rule)(int *, int, int *, int, int &)) |
| Simulates a cellular automata step. More...
|
|
| BaseCellularAutomata () |
| Construct a new Cellular Automata:: Cellular Automata object. More...
|
|
virtual | ~BaseCellularAutomata () |
| Destroy the Cellular Automata:: Cellular Automata object. More...
|
|
int | setup_neighborhood (CAEnums::Neighborhood neighborhood_type) |
| Setup neighborhood with values from enum neighborhood. More...
|
|
int | setup_cell_states (int num_states) |
| Defines the range of cell states to be used in the CA object. More...
|
|
int | setup_rule (CAEnums::Rule rule_type) |
| Setup the rule choice to specify the rule type to be used in CA object. More...
|
|
void | print_error_status (CAEnums::ErrorCode error) |
| Prints an error message for the given error code. More...
|
|
template<typename T>
class CellularAutomata< T >
A CellularAutomata class for simulating cellular automata models.
This templated class supports structs/class objects or integer states.
The object must contain a .state property that the CellularAutomata class updates.
The object must have a default constructor or default initialzed values.
The object must meet the requirements of CopyConstructible and CopyAssignable (until C++11)MoveConstructible and MoveAssignable (since C++11)
The object must have a defined != operator for the comparison of cell states.
If these requirements are not satisfied then the class will produce undefined behavior.
- Template Parameters
-
T | : struct/class with a .state property, move operator and assignment operator.
|
int | : when cell states are represented by an integer |
Simulates a cellular automata step.
A new state is generated and stored stored as the new state for subsequent calls to step method.
This method supports the use of a custom rule type.
If cell states move on the grid, the user is responsible for handling clashes. If two cells move to the same cell position, the grid will retain the most recent cell assignment (new will replace the old).
- Parameters
-
custom_rule | function that is called when a Custom rule type is specified |
- Returns
- int - error code
Error codes returned by get_state_from_neighborhood_Xd methods
0: no error
Simulates a cellular automata step.
A new state is generated and stored stored as the new state for subsequent calls to step method.
This method supports the use of a custom rule type.
If cell states move on the grid, the user is responsible for handling clashes. If two cells move to the same cell position, the grid will retain the most recent cell assignment (new will replace the old).
- Parameters
-
custom_rule | function that is called when a Custom rule type is specified |
- Returns
- int - error code
Error codes returned by get_state_from_neighborhood_Xd methods
0: no error