|
CellModules
|
Template class for a 2D grid physics-based plugin. More...
#include <Plugin2DGrid.hpp>
Public Member Functions | |
| Plugin2DGrid () | |
| Default constructor. More... | |
| void | resizeCellGrid (int w, int h) |
| Resizes the cell grid to the given width and height. More... | |
| void | resizeCellGrid (int size) |
| Resizes the cell grid to a square of the given size. More... | |
| void | setToreX (bool b) |
| Sets the toric property on the X-axis. More... | |
| void | setToreY (bool b) |
| Sets the toric property on the Y-axis. More... | |
| void | setTore (bool x, bool y) |
| Sets the toric properties on both X and Y axes. More... | |
| double | getNbOccupiedPositions () const |
| Gets the number of occupied positions. More... | |
| double | getOccupationSurfaceRatio () const |
| Gets the occupation surface ratio. More... | |
| template<typename world_t > | |
| double | getGlobalDensity (world_t *w) const |
| Gets the global density of the grid. More... | |
| CellGrid< cell_t > * | getCellGrid () |
| Gets the cell grid. More... | |
| template<typename world_t > | |
| void | onAddCell (world_t *w) |
| Hook called when cells is added to the world. More... | |
| template<typename world_t > | |
| void | preBehaviorUpdate (world_t *w) |
| Hook called before the behavior update of the world. More... | |
| template<typename world_t > | |
| void | preDeleteDeadCellsUpdate (world_t *w) |
| Hook called before deleting dead cells from the world. More... | |
Private Member Functions | |
| void | updateNeighbouringLocation (cell_t *c) |
| Updates the number of neighbouring locations for a cell. More... | |
| void | computeNeighbouringCells (cell_t *c) |
| Computes the neighbouring cells for a given cell. More... | |
Private Attributes | |
| double | nbOccupiedPositions = 0 |
| CellGrid< cell_t > | cellGrid |
Template class for a 2D grid physics-based plugin.
| cell_t | Type of the cell used in the grid. |
Definition at line 28 of file Plugin2DGrid.hpp.
|
inline |
Default constructor.
Definition at line 106 of file Plugin2DGrid.hpp.
|
inlineprivate |
Computes the neighbouring cells for a given cell.
| c | Pointer to the cell |
Definition at line 63 of file Plugin2DGrid.hpp.
|
inline |
Gets the cell grid.
Definition at line 182 of file Plugin2DGrid.hpp.
|
inline |
Gets the global density of the grid.
| world_t | Type of the world |
| w | Pointer to the world |
Definition at line 174 of file Plugin2DGrid.hpp.
|
inline |
Gets the number of occupied positions.
Definition at line 153 of file Plugin2DGrid.hpp.
|
inline |
Gets the occupation surface ratio.
Returns the ratio of occupied positions to the total number of possible locations.
Definition at line 163 of file Plugin2DGrid.hpp.
|
inline |
Hook called when cells is added to the world.
| world_t | Type of the world |
| w | Pointer to the world |
Definition at line 190 of file Plugin2DGrid.hpp.
|
inline |
Hook called before the behavior update of the world.
| world_t | Type of the world |
| w | Pointer to the world |
Definition at line 204 of file Plugin2DGrid.hpp.
|
inline |
Hook called before deleting dead cells from the world.
| world_t | Type of the world |
| w | Pointer to the world |
Definition at line 217 of file Plugin2DGrid.hpp.
|
inline |
Resizes the cell grid to a square of the given size.
| size | Size of the grid (both width and height) |
Definition at line 122 of file Plugin2DGrid.hpp.
|
inline |
Resizes the cell grid to the given width and height.
| w | Width of the grid |
| h | Height of the grid |
Definition at line 114 of file Plugin2DGrid.hpp.
|
inline |
Sets the toric properties on both X and Y axes.
| x | Boolean value to set toreX |
| y | Boolean value to set toreY |
Definition at line 147 of file Plugin2DGrid.hpp.
|
inline |
Sets the toric property on the X-axis.
| b | Boolean value to set toreX |
Definition at line 130 of file Plugin2DGrid.hpp.
|
inline |
Sets the toric property on the Y-axis.
| b | Boolean value to set toreY |
Definition at line 138 of file Plugin2DGrid.hpp.
|
inlineprivate |
Updates the number of neighbouring locations for a cell.
| c | Pointer to the cell |
Sets the number of locations based on the Moore neighbourhood, taking toricity into account.
Definition at line 41 of file Plugin2DGrid.hpp.
|
private |
Grid containing the cells
Definition at line 33 of file Plugin2DGrid.hpp.
|
private |
Number of occupied locations
Definition at line 31 of file Plugin2DGrid.hpp.