summaryrefslogtreecommitdiff
path: root/lib/core/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2025-12-10 11:26:13 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2025-12-10 11:26:13 +0100
commiteeb01452fe46fcb5efdc9c34b660305262097ca4 (patch)
tree804f2355ef8bc4c256b10f76006f752430a72975 /lib/core/c++
parent1d7c55abaa8a17905e5b523f1fdd5c0080b97b7b (diff)
downloadlibs-lbm-eeb01452fe46fcb5efdc9c34b660305262097ca4.tar.gz
Dangling changes
Diffstat (limited to 'lib/core/c++')
-rw-r--r--lib/core/c++/particle/particle.hpp22
1 files changed, 22 insertions, 0 deletions
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<typename T,uint64_t D>
+constexpr auto verlet_step_lambda = [](saw::data<sch::Particle<T,D>>& particle, saw::data<T> 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<sch::Vector<T,D>> pos_new;
+ // Actual step
+ for(uint64_t i = 0u; i < D; ++i){
+ pos_new.at({{i}}) = saw::data<T>{2.0} * pos.at({{i}}) - pos_old.at({{i}}) + acc.at({{i}}) * tsd_squared;
+ }
+
+ pos_old = pos;
+ pos = pos_new;
+};
+
template<typename T, uint64_t D, typename ParticleCollision = sch::ParticleMask<T,D> >
class particle_system {
private: