chore: some comments on variables in simulation.cpp

This commit is contained in:
Sara Gerretsen 2025-09-23 14:24:47 +02:00
parent 8538c91206
commit 74e6456343

View file

@ -20,22 +20,27 @@
#define SIM_MULTITHREADING 1
namespace simulation {
bool drawDebugInfo{ true };
// Encapsulates the data relevant to a GoL rule's workload
struct ThreadWorkload {
size_t seg_idx{0}, seg_len{1};
std::mutex mtx{};
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>> underpopulated{};
static std::vector<std::shared_ptr<ThreadWorkload>> born{};
static uint64_t generationStartTime{ 0 };
static unsigned tasks{ 0 }; std::mutex tasksMutex{};
// Multithreading
static unsigned tasks{ 0 };
static std::mutex tasksMutex{};
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)
: state{ begin } , begin{ begin }, end{ end } {}