From 484fc61e2472c2a3752168221bd85510e9b7c53f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 21 Jul 2026 23:42:52 +0200 Subject: Dangling --- modules/core/c++/particle/particle.hpp | 43 +++------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) (limited to 'modules/core/c++/particle') diff --git a/modules/core/c++/particle/particle.hpp b/modules/core/c++/particle/particle.hpp index 29b08e6..f759c8d 100644 --- a/modules/core/c++/particle/particle.hpp +++ b/modules/core/c++/particle/particle.hpp @@ -137,7 +137,7 @@ saw::data>> create_spheroid */ template -constexpr auto verlet_step_lambda_old = [](saw::data>& particle, saw::data> time_step_delta){ +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">(); @@ -158,51 +158,14 @@ constexpr auto verlet_step_lambda_old = [](saw::data>& partic two.at({}).set(2.0); pos_new = pos * two - pos_old + pos_acc * tsd_squared; - // Angular - saw::data::Schema> rot_new; - rot_new = rot * two - rot_old + rot_acc * tsd_squared; - - // Swap - Could be std::swap? + // Swap - Could be std::swap? No, this is device code pos_old = pos; pos = pos_new; - rot_old = rot; - rot = rot_new; -}; - -template -constexpr auto verlet_step_lambda = [](saw::data>& pgrp, saw::data> index, saw::data> time_step_delta){ - auto& parts = pgrp.template get<"particles">(); - auto& particle = parts.at(index); - - auto& body = particle.template get<"rigid_body">(); - - auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); - - auto& pos_acc = body.template get<"acceleration">(); - - auto& rot = body.template get<"rotation">(); - auto& rot_old = body.template get<"rotation_old">(); - - auto& rot_acc = body.template get<"angular_acceleration">(); - - auto tsd_squared = time_step_delta * time_step_delta; - - saw::data> pos_new; - // Actual step - saw::data> two; - two.at({}).set(2.0); - pos_new = pos * two - pos_old + pos_acc * tsd_squared; - // Angular saw::data::Schema> rot_new; rot_new = rot * two - rot_old + rot_acc * tsd_squared; - - // Swap - Could be std::swap? - pos_old = pos; - pos = pos_new; - + rot_old = rot; rot = rot_new; }; -- cgit v1.2.3