17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-08 00:47:56 +01:00

perf(physics): the steps of the vehicle physics on many threads, in groups of vehicles which act on one another (performance.cpucores, 0: all cores)

This commit is contained in:
2026-10-23 19:56:36 +02:00
parent 2f96dfe767
commit 60667588b5
11 changed files with 403 additions and 4 deletions

View File

@@ -880,6 +880,9 @@ public:
// legacy method, checks for presence and height of traction wire for specified vehicle
void
update_traction( TDynamicObject *Vehicle );
// the steps of the physics of update() on many threads, see the definition
void
update_steps_parallel( double const Deltatime, int const Iterationcount, std::vector<std::uint8_t> const &Coarse );
// legacy method, sends list of vehicles over network
void
DynamicList( bool const Onlycontrolled = false ) const;
@@ -888,6 +891,14 @@ private:
// maintenance; removes from tracks consists with vehicles marked as disabled
bool
erase_disabled();
// working space of update_steps_parallel(), kept between the updates: the groups of the vehicles (joined by union find, by
// the vehicle and by its mover), the group of each root, the groups done on the threads and in the main thread
std::vector<std::uint32_t> m_groupparent;
std::unordered_map<void const *, std::uint32_t> m_grouplookup;
std::vector<std::uint32_t> m_groupof;
std::vector<std::vector<std::uint32_t>> m_groups;
std::vector<std::uint32_t> m_threadgroups;
std::vector<std::uint32_t> m_maingroups;
};