From 1d4f28f02e28fb7de9b9273ca936640818b45c6e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 15 Jan 2026 15:36:45 +0100 Subject: Trying to find a simple approach to handling the data --- lib/core/c++/particle/particle.hpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'lib/core/c++/particle') diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp index 9bf310e..8509df6 100644 --- a/lib/core/c++/particle/particle.hpp +++ b/lib/core/c++/particle/particle.hpp @@ -60,13 +60,15 @@ saw::data, sch::ParticleCollisionSpheroid> create_spheroid saw::data> rot_vel_p, saw::data> rot_acc_p, saw::data> rad_p, - saw::data> density_p + saw::data> density_p, + saw::data> dt ){ saw::data> part; auto& body = part.template get<"rigid_body">(); + auto& mass = part.template get<"mass">(); + auto& pos = body.template get<"position">(); - auto& pos_old = body.template get<"position_old">(); auto& acc = body.template get<"acceleration">(); @@ -77,10 +79,26 @@ saw::data, sch::ParticleCollisionSpheroid> create_spheroid auto& rad = coll.template get<"radius">(); pos = pos_p; - pos_old = pos - vec_p; + pos_old = pos - vec_p * dt; acc = acc_p; rad = rad_p; + if constexpr ( D == 1u){ + saw::data> c; + c.at({}).set(2.0); + mass = rad_p * c * density_p; + } else if constexpr ( D == 2u){ + saw::data> pi; + pi.at({}).set(3.14159); + mass = rad_p * rad_p * pi * density_p; + } else if constexpr ( D == 3u ){ + saw::data> c; + c.at({}).set(3.14159 * 4.0 / 3.0); + mass = rad_p * rad_p * rad_p * c * density_p; + } else { + static_assert(D == 0u or D > 3u, "Dimensions only supported for Dim 1,2 & 3."); + } + return part; } -- cgit v1.2.3