From 44cb41bbe6128f2c7ca92b06e2267d52e3121721 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 15 Jul 2026 15:39:41 +0200 Subject: Preping two way --- modules/core/c++/particle/aabb.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'modules/core/c++/particle/aabb.hpp') diff --git a/modules/core/c++/particle/aabb.hpp b/modules/core/c++/particle/aabb.hpp index 18426d5..a838401 100644 --- a/modules/core/c++/particle/aabb.hpp +++ b/modules/core/c++/particle/aabb.hpp @@ -10,12 +10,12 @@ class particle_aabb final { static_assert(saw::always_false, "Not supported"); }; -template +template class particle_aabb< - sch::ParticleGroup> + sch::ParticleGroup> > final { public: - using Schema = sch::ParticleGroup>; + using Schema = sch::ParticleGroup>; using AABB = sch::Struct< sch::Member,"a">, @@ -23,7 +23,11 @@ public: >; public: template - static constexpr saw::data calculate(const saw::data& p_grp, const saw::data>& i, const saw::data>& meta){ + static constexpr saw::error_or> calculate(const saw::data& p_grp, const saw::data>& i, const saw::data>& meta){ + static_assert(PC > 0u, "Can't calculate from no particles"); + if(not (i.at({0u}).get() < PC) ){ + return saw::make_error("Too large i in particle_aabb"); + } saw::data aabb; auto& parts = p_grp.template get<"particles">(); @@ -35,7 +39,7 @@ public: auto& a = aabb.template get<"a">(); auto& b = aabb.template get<"b">(); - const saw::data>& rad_d = p_grp.template get<"collision">().at({0u}).template get<"radius">(); + const saw::data>& rad_d = p_grp.template get<"collision">().at(i).template get<"radius">(); saw::data> lower; saw::data> upper; -- cgit v1.2.3 From aedeb28b41ffbe0229d065c69f7d2e4570968ace Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 15 Jul 2026 16:55:56 +0200 Subject: Reworking particle_aabb --- modules/core/c++/particle/aabb.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules/core/c++/particle/aabb.hpp') diff --git a/modules/core/c++/particle/aabb.hpp b/modules/core/c++/particle/aabb.hpp index a838401..983fd97 100644 --- a/modules/core/c++/particle/aabb.hpp +++ b/modules/core/c++/particle/aabb.hpp @@ -22,8 +22,8 @@ public: sch::Member,"b"> >; public: - template - static constexpr saw::error_or> calculate(const saw::data& p_grp, const saw::data>& i, const saw::data>& meta){ + template + static constexpr saw::error_or> calculate(const saw::data& p_grp, const saw::data>& i, const saw::data>& meta){ static_assert(PC > 0u, "Can't calculate from no particles"); if(not (i.at({0u}).get() < PC) ){ return saw::make_error("Too large i in particle_aabb"); @@ -55,5 +55,6 @@ public: } }; + } } -- cgit v1.2.3