diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-15 16:56:16 +0200 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-07-15 16:56:16 +0200 |
| commit | 91f75c895fb2c344805ddcb91439b93bba0293c4 (patch) | |
| tree | b12c4854cf7a1912f2540f29b23835c82e47432d /modules/core/c++/particle/aabb.hpp | |
| parent | 6c66e5309dbfdcabb852871eade7e21438375742 (diff) | |
| parent | aedeb28b41ffbe0229d065c69f7d2e4570968ace (diff) | |
| download | libs-lbm-91f75c895fb2c344805ddcb91439b93bba0293c4.tar.gz | |
Merge branch 'dev'
Diffstat (limited to 'modules/core/c++/particle/aabb.hpp')
| -rw-r--r-- | modules/core/c++/particle/aabb.hpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/core/c++/particle/aabb.hpp b/modules/core/c++/particle/aabb.hpp index 18426d5..983fd97 100644 --- a/modules/core/c++/particle/aabb.hpp +++ b/modules/core/c++/particle/aabb.hpp @@ -10,20 +10,24 @@ class particle_aabb final { static_assert(saw::always_false<PGroup>, "Not supported"); }; -template<typename T, uint64_t D> +template<typename T, uint64_t D, uint64_t PC> class particle_aabb< - sch::ParticleGroup<T,D,coll::Spheroid<T>> + sch::ParticleGroup<T,D,PC,coll::Spheroid<T>> > final { public: - using Schema = sch::ParticleGroup<T,D,coll::Spheroid<T>>; + using Schema = sch::ParticleGroup<T,D,PC,coll::Spheroid<T>>; using AABB = sch::Struct< sch::Member<sch::FixedArray<sch::UInt64,D>,"a">, sch::Member<sch::FixedArray<sch::UInt64,D>,"b"> >; public: - template<typename Encode> - static constexpr saw::data<AABB> calculate(const saw::data<Schema,Encode>& p_grp, const saw::data<sch::FixedArray<sch::UInt64,1u>>& i, const saw::data<sch::FixedArray<sch::UInt64,D>>& meta){ + template<typename Sch, typename Encode> + static constexpr saw::error_or<saw::data<AABB>> calculate(const saw::data<Sch,Encode>& p_grp, const saw::data<sch::FixedArray<sch::UInt64,1u>>& i, const saw::data<sch::FixedArray<sch::UInt64,D>>& meta){ + static_assert(PC > 0u, "Can't calculate from no particles"); + if(not (i.at({0u}).get() < PC) ){ + return saw::make_error<saw::err::critical>("Too large i in particle_aabb"); + } saw::data<AABB> 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<sch::Scalar<T>>& rad_d = p_grp.template get<"collision">().at({0u}).template get<"radius">(); + const saw::data<sch::Scalar<T>>& rad_d = p_grp.template get<"collision">().at(i).template get<"radius">(); saw::data<sch::Vector<T,D>> lower; saw::data<sch::Vector<T,D>> upper; @@ -51,5 +55,6 @@ public: } }; + } } |
