covid-sim
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Param.cpp
1
#include "Param.h"
2
3
int
Param::get_number_of_micro_cells_wide()
const
{
4
return
this->ncw * this->NMCL;
5
}
6
7
int
Param::get_number_of_micro_cells_high()
const
{
8
return
this->nch * this->NMCL;
9
}
10
11
MicroCellPosition
Param::get_micro_cell_position_from_cell_index(
int
cell_index)
const
{
12
int
x = cell_index / this->get_number_of_micro_cells_high();
13
int
y = cell_index % this->get_number_of_micro_cells_high();
14
return
{x, y};
15
}
16
17
bool
Param::is_in_bounds(
MicroCellPosition
position)
const
{
18
return
position.x >= 0
19
&& position.y >= 0
20
&& position.x < this->get_number_of_micro_cells_wide()
21
&& position.y < this->get_number_of_micro_cells_high();
22
}
23
24
int
Param::get_micro_cell_index_from_position(
MicroCellPosition
position)
const
{
25
int
x = (position.x + this->get_number_of_micro_cells_wide()) % this->get_number_of_micro_cells_wide();
26
int
y = (position.y + this->get_number_of_micro_cells_high()) % this->get_number_of_micro_cells_high();
27
return
x * this->get_number_of_micro_cells_high() + y;
28
}
MicroCellPosition
Definition
MicroCellPosition.hpp:5
Generated by
1.17.0