HPC_Voxel_Engine 0.2.0
High-Performance C++ Voxel Engine
Loading...
Searching...
No Matches
ThermalSystem.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <atomic>
9#include <barrier>
10#include <memory>
11#include <thread>
12#include <vector>
13
14class ChunkManager;
15// ********************************************************************
16
22public:
23 ThermalSystem(int iNumThreads);
25
30 void UpdateTemperature(float fDeltaTime, ChunkManager& objChunkManager);
31 void SetEnableSIMD(bool bEnable) { m_bIsSIMDEnabled = bEnable; }
32
33private:
37 void workerThreadLoop(int iThreadID);
38
40 std::atomic<bool> m_bIsRunning;
41 std::atomic<bool> m_bIsSIMDEnabled;
42
45
46 std::unique_ptr<std::barrier<>> m_pStartBarrier;
47 std::unique_ptr<std::barrier<>> m_pPhase1Barrier;
48 std::unique_ptr<std::barrier<>> m_pPhase2Barrier;
49
50 std::vector<std::thread> m_vecWorkerThreads;
51};
Orchestrates infinite world generation, active chunk tracking, and multi-threaded data loading.
Definition ChunkManager.h:33
Manages a thread pool to compute 3D explicit thermal diffusion across voxel chunks.
Definition ThermalSystem.h:21
~ThermalSystem()
Definition ThermalSystem.cpp:29
std::unique_ptr< std::barrier<> > m_pPhase2Barrier
Definition ThermalSystem.h:48
void UpdateTemperature(float fDeltaTime, ChunkManager &objChunkManager)
Wakes worker threads to compute the next thermal integration step based on elapsed time.
Definition ThermalSystem.cpp:39
ChunkManager * m_pCurrChunkManager
Definition ThermalSystem.h:44
std::vector< std::thread > m_vecWorkerThreads
Definition ThermalSystem.h:50
std::atomic< bool > m_bIsRunning
Definition ThermalSystem.h:40
void workerThreadLoop(int iThreadID)
Main execution loop for each worker thread, regulated by barrier synchronization.
Definition ThermalSystem.cpp:47
void SetEnableSIMD(bool bEnable)
Definition ThermalSystem.h:31
int m_iNumThreads
Definition ThermalSystem.h:39
std::unique_ptr< std::barrier<> > m_pPhase1Barrier
Definition ThermalSystem.h:47
std::unique_ptr< std::barrier<> > m_pStartBarrier
Definition ThermalSystem.h:46
std::atomic< bool > m_bIsSIMDEnabled
Definition ThermalSystem.h:41
float m_fCurrDeltaTime
Definition ThermalSystem.h:43