diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-05-26 22:24:09 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-05-26 22:24:09 +0200 |
| commit | 960a3ef31095af11c7c764a1bcdcb4b424c529b8 (patch) | |
| tree | 39cdf138c9887022fb87845e6c746ffc6a31c275 /lib/core/c++/particle | |
| parent | 1e2e1755beb592f86f61337524121b98063a0d89 (diff) | |
| download | libs-lbm-960a3ef31095af11c7c764a1bcdcb4b424c529b8.tar.gz | |
Dangling changes. Fixed compilation issues which hurt my brain
Diffstat (limited to 'lib/core/c++/particle')
| -rw-r--r-- | lib/core/c++/particle/particle.hpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp index 7249e6a..5449b88 100644 --- a/lib/core/c++/particle/particle.hpp +++ b/lib/core/c++/particle/particle.hpp @@ -55,8 +55,8 @@ template<typename T, uint64_t D, typename CollisionType = ParticleCollisionSpher using ParticleGroup = Struct< Member<Array<T,D>, "mask">, Member<FixedArray<Scalar<T>,1u>, "density">, - Member<Vector<T,D>, "center_of_mass">, - Member<Scalar<T>, "total_mass">, + Member<FixedArray<Vector<T,D>,1u>, "center_of_mass">, + Member<FixedArray<Scalar<T>,1u>, "total_mass">, Member<Array<Particle<T,D>>, "particles"> >; } @@ -71,7 +71,7 @@ saw::data<sch::ParticleGroup<T,D, sch::ParticleCollisionSpheroid<T,radius>>> cre auto& mask = part.template get<"mask">(); auto& density = part.template get<"density">().at({{0u}}); - auto& total_mass = part.template get<"total_mass">(); + auto& total_mass = part.template get<"total_mass">().at({{0u}}); // Paranoia total_mass.at({}) = {}; @@ -89,7 +89,7 @@ saw::data<sch::ParticleGroup<T,D, sch::ParticleCollisionSpheroid<T,radius>>> cre mask = {mask_dims}; - auto& com = part.template get<"center_of_mass">(); + auto& com = part.template get<"center_of_mass">().at({{0u}}); // Paranoia for(uint64_t i = 0u; i < D; ++i){ com.at({{i}}) = {}; @@ -115,13 +115,16 @@ saw::data<sch::ParticleGroup<T,D, sch::ParticleCollisionSpheroid<T,radius>>> cre auto& dpi = mask.at(index); for(uint64_t i = 0u; i < D; ++i){ - com.at({{i}}) = com.at({{i}}) + index.at({i}).template cast_to<T>() * dpi.at({}); + com.at({{i}}) = com.at({{i}}) + index.at({i}).template cast_to<T>() * dpi; } - total_mass = total_mass + dpi; + total_mass.at({}) = total_mass.at({}) + dpi; },{},mask_dims); + for(uint64_t i = 0u; i < D; ++i){ + com.at({{i}}) = com.at({{i}}) / total_mass.at({}); + } return part; } |
