From eeb01452fe46fcb5efdc9c34b660305262097ca4 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 10 Dec 2025 11:26:13 +0100 Subject: Dangling changes --- lib/core/c++/particle/particle.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/core/c++') diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp index c87f15e..446e8a3 100644 --- a/lib/core/c++/particle/particle.hpp +++ b/lib/core/c++/particle/particle.hpp @@ -43,6 +43,28 @@ using Particle = Struct< >; } +template +constexpr auto verlet_step_lambda = [](saw::data>& particle, saw::data time_step_delta){ + auto& body = particle.template get<"rigid_body">(); + + auto& pos = body.template get<"position">(); + auto& pos_old = body.template get<"position_old">(); + + // auto& rot = body.template get<"rotation">(); + auto& acc = body.template get<"acceleration">(); + + auto tsd_squared = time_step_delta * time_step_delta; + + saw::data> pos_new; + // Actual step + for(uint64_t i = 0u; i < D; ++i){ + pos_new.at({{i}}) = saw::data{2.0} * pos.at({{i}}) - pos_old.at({{i}}) + acc.at({{i}}) * tsd_squared; + } + + pos_old = pos; + pos = pos_new; +}; + template > class particle_system { private: -- cgit v1.2.3