Manages a grid of molecules for diffusion.
More...
#include <DiffusionGrid.hpp>
Manages a grid of molecules for diffusion.
Definition at line 71 of file DiffusionGrid.hpp.
◆ DiffusionGrid()
| Diffusion2D::DiffusionGrid::DiffusionGrid |
( |
| ) |
|
|
default |
◆ addMolecule()
| void Diffusion2D::DiffusionGrid::addMolecule |
( |
int |
id, |
|
|
Molecule |
m |
|
) |
| |
|
inline |
Adds a molecule to the grid.
- Parameters
-
| id | id of the molecule. if you use Enum, you can cast it to int. |
| m | Molecule to be added. |
Definition at line 250 of file DiffusionGrid.hpp.
◆ computeMolecules()
template<typename world_t >
| void Diffusion2D::DiffusionGrid::computeMolecules |
( |
world_t * |
w | ) |
|
|
inline |
Computes the quantities of molecules in the grid.
- Template Parameters
-
| world_t | Type of the world. |
- Parameters
-
Definition at line 287 of file DiffusionGrid.hpp.
◆ computeStep()
| void Diffusion2D::DiffusionGrid::computeStep |
( |
| ) |
|
|
inlineprivate |
◆ diffuse()
| void Diffusion2D::DiffusionGrid::diffuse |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
|
inlineprivate |
Applies diffusion to the molecule at position (x, y).
- Parameters
-
| x | X-coordinate. |
| y | Y-coordinate. |
Definition at line 103 of file DiffusionGrid.hpp.
◆ getGrid()
◆ getHeight()
| int Diffusion2D::DiffusionGrid::getHeight |
( |
| ) |
const |
|
inline |
Gets the height of the grid.
- Returns
- Height of the grid.
Definition at line 230 of file DiffusionGrid.hpp.
◆ getMolecule()
| double Diffusion2D::DiffusionGrid::getMolecule |
( |
int |
x, |
|
|
int |
y, |
|
|
int |
m |
|
) |
| |
|
inline |
Gets the quantity of a molecule at a specific position.
- Parameters
-
| x | X-coordinate. |
| y | Y-coordinate. |
| m | Number of the molecule. |
- Returns
- Quantity of the molecule.
Definition at line 218 of file DiffusionGrid.hpp.
◆ getMolecules()
Gets the molecules in the grid.
- Returns
- Vector of molecules.
Definition at line 242 of file DiffusionGrid.hpp.
◆ getWidth()
| int Diffusion2D::DiffusionGrid::getWidth |
( |
| ) |
const |
|
inline |
Gets the width of the grid.
- Returns
- Width of the grid.
Definition at line 224 of file DiffusionGrid.hpp.
◆ initGrid() [1/2]
| void Diffusion2D::DiffusionGrid::initGrid |
( |
int |
size | ) |
|
|
inline |
◆ initGrid() [2/2]
| void Diffusion2D::DiffusionGrid::initGrid |
( |
int |
w, |
|
|
int |
h |
|
) |
| |
|
inline |
Initializes the grid with dimensions.
- Parameters
-
| w | Width of the grid. |
| h | Height of the grid. |
Definition at line 261 of file DiffusionGrid.hpp.
◆ preStep()
| void Diffusion2D::DiffusionGrid::preStep |
( |
| ) |
|
|
inlineprivate |
◆ setTore()
| void Diffusion2D::DiffusionGrid::setTore |
( |
bool |
x, |
|
|
bool |
y |
|
) |
| |
|
inline |
Sets the toroidal properties on both axes.
- Parameters
-
| x | Boolean value for the x-axis. |
| y | Boolean value for the y-axis. |
Definition at line 208 of file DiffusionGrid.hpp.
◆ setToreX()
| void Diffusion2D::DiffusionGrid::setToreX |
( |
bool |
b | ) |
|
|
inline |
Sets the toroidal property on the x-axis.
- Parameters
-
| b | Boolean value for the toroidal property. |
Definition at line 193 of file DiffusionGrid.hpp.
◆ setToreY()
| void Diffusion2D::DiffusionGrid::setToreY |
( |
bool |
b | ) |
|
|
inline |
Sets the toroidal property on the y-axis.
- Parameters
-
| b | Boolean value for the toroidal property. |
Definition at line 200 of file DiffusionGrid.hpp.
◆ updateConsumptions()
template<typename world_t >
| void Diffusion2D::DiffusionGrid::updateConsumptions |
( |
world_t * |
w | ) |
|
|
inlineprivate |
Updates the consumptions for each cell.
- Template Parameters
-
| world_t | Type of the world. |
- Parameters
-
Definition at line 172 of file DiffusionGrid.hpp.
◆ grid
◆ height
| int Diffusion2D::DiffusionGrid::height = 10 |
|
private |
◆ molecules
◆ moleculesDict
| std::unordered_map<int,int> Diffusion2D::DiffusionGrid::moleculesDict |
◆ toreX
| bool Diffusion2D::DiffusionGrid::toreX = true |
|
private |
◆ toreY
| bool Diffusion2D::DiffusionGrid::toreY = true |
|
private |
◆ width
| int Diffusion2D::DiffusionGrid::width = 10 |
|
private |
The documentation for this class was generated from the following file: