chore: some comments on variables in simulation.cpp
This commit is contained in:
parent
8538c91206
commit
74e6456343
|
|
@ -20,22 +20,27 @@
|
||||||
#define SIM_MULTITHREADING 1
|
#define SIM_MULTITHREADING 1
|
||||||
|
|
||||||
namespace simulation {
|
namespace simulation {
|
||||||
bool drawDebugInfo{ true };
|
// Encapsulates the data relevant to a GoL rule's workload
|
||||||
|
|
||||||
struct ThreadWorkload {
|
struct ThreadWorkload {
|
||||||
size_t seg_idx{0}, seg_len{1};
|
size_t seg_idx{0}, seg_len{1};
|
||||||
std::mutex mtx{};
|
std::mutex mtx{};
|
||||||
std::vector<Cell> changes{};
|
std::vector<Cell> changes{};
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::set<Cell> living{};
|
bool drawDebugInfo{ true }; // draw next step's changes over current state
|
||||||
|
|
||||||
|
static std::set<Cell> living{}; // The set of currently alive cells
|
||||||
|
|
||||||
|
// Ruleset workload abstraction
|
||||||
static std::vector<std::shared_ptr<ThreadWorkload>> overpopulated{};
|
static std::vector<std::shared_ptr<ThreadWorkload>> overpopulated{};
|
||||||
static std::vector<std::shared_ptr<ThreadWorkload>> underpopulated{};
|
static std::vector<std::shared_ptr<ThreadWorkload>> underpopulated{};
|
||||||
static std::vector<std::shared_ptr<ThreadWorkload>> born{};
|
static std::vector<std::shared_ptr<ThreadWorkload>> born{};
|
||||||
static uint64_t generationStartTime{ 0 };
|
// Multithreading
|
||||||
static unsigned tasks{ 0 }; std::mutex tasksMutex{};
|
static unsigned tasks{ 0 };
|
||||||
|
static std::mutex tasksMutex{};
|
||||||
static std::condition_variable tasksChanged{};
|
static std::condition_variable tasksChanged{};
|
||||||
|
// ns timestamp of the start of the last generation change calculation
|
||||||
|
static uint64_t generationStartTime{ 0 };
|
||||||
|
|
||||||
CellIterator::CellIterator(Cell begin, Cell end)
|
CellIterator::CellIterator(Cell begin, Cell end)
|
||||||
: state{ begin } , begin{ begin }, end{ end } {}
|
: state{ begin } , begin{ begin }, end{ end } {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue