summaryrefslogtreecommitdiff
path: root/lib/core
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-02-20 13:55:00 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-02-20 13:55:00 +0100
commitcb514e099515934322d9400d559a65b831cf4c5f (patch)
tree6838d5fe0ce9f5c1bb3c8abcf17549cd113c5f86 /lib/core
parent17919d7dd2640190956bbee4aab0d31ce31244b7 (diff)
downloadlibs-lbm-cb514e099515934322d9400d559a65b831cf4c5f.tar.gz
Adding fake particles
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/c++/particle.hpp2
-rw-r--r--lib/core/c++/particle/particle.hpp14
-rw-r--r--lib/core/tests/particles.cpp18
3 files changed, 19 insertions, 15 deletions
diff --git a/lib/core/c++/particle.hpp b/lib/core/c++/particle.hpp
index f8a5cb0..b098ecc 100644
--- a/lib/core/c++/particle.hpp
+++ b/lib/core/c++/particle.hpp
@@ -24,8 +24,8 @@ public:
verlet_step_lambda<T,Descriptor::D>(p,{1.0});
// Update porosity over lattice nodes
+
-
}
};
}
diff --git a/lib/core/c++/particle/particle.hpp b/lib/core/c++/particle/particle.hpp
index a82b12d..8ef590d 100644
--- a/lib/core/c++/particle/particle.hpp
+++ b/lib/core/c++/particle/particle.hpp
@@ -40,19 +40,21 @@ using ParticleRigidBody = Struct<
template<typename T>
using ParticleCollisionSpheroid = Struct<
- Member<T, "radius">
+ Member<Scalar<T>, "radius">
>;
template<typename T, uint64_t D, typename CollisionType = ParticleCollisionSpheroid<T>>
using Particle = Struct<
Member<ParticleRigidBody<T,D>, "rigid_body">,
Member<CollisionType, "collision">,
- Member<T, "mass">
+ // Problem is that dynamic data would two layered
+ // Member<FixedArray<Float64,D,D,D>, "mask">,
+ Member<Scalar<T>, "mass">
>;
}
template<typename T, uint64_t D>
-saw::data<sch::Particle<T,D>, sch::ParticleCollisionSpheroid<T>> create_spheroid_particle(
+saw::data<sch::Particle<T,D, sch::ParticleCollisionSpheroid<T>>> create_spheroid_particle(
saw::data<sch::Vector<T,D>> pos_p,
saw::data<sch::Vector<T,D>> vec_p,
saw::data<sch::Vector<T,D>> acc_p,
@@ -175,9 +177,11 @@ constexpr auto broadphase_collision_distance_squared = [](saw::data<sch::Particl
auto norm_2 = saw::math::dot(pos_dist,pos_dist);
- auto rad_ab_2 = rad_l * rad_l + rad_r * rad_r + rad_r * rad_l * static_cast<saw::native_data_type<T>::type>(2);
+ saw::data<sch::Scalar<T>> two;
+ two.at({}) = 2.0;
+ auto rad_ab_2 = rad_l * rad_l + rad_r * rad_r + rad_r * rad_l * two;
- return std::make_pair((norm_2.at({}).get() < rad_ab_2.get()), norm_2);
+ return std::make_pair((norm_2.at({}).get() < rad_ab_2.at({}).get()), norm_2);
};
/**
*
diff --git a/lib/core/tests/particles.cpp b/lib/core/tests/particles.cpp
index fcca19a..a9984ec 100644
--- a/lib/core/tests/particles.cpp
+++ b/lib/core/tests/particles.cpp
@@ -40,7 +40,7 @@ SAW_TEST("No Collision Spheroid 2D"){
auto& coll = part_a.template get<"collision">();
auto& radius = coll.template get<"radius">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = 0.1;
pos.at({{1u}}) = 0.2;
@@ -53,7 +53,7 @@ SAW_TEST("No Collision Spheroid 2D"){
auto& coll = part_b.template get<"collision">();
auto& radius = coll.template get<"radius">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = -2.1;
pos.at({{1u}}) = 0.0;
@@ -73,7 +73,7 @@ SAW_TEST("Collision Spheroid 2D"){
auto& coll = part_a.template get<"collision">();
auto& radius = coll.template get<"radius">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = 0.1;
pos.at({{1u}}) = 0.2;
@@ -86,7 +86,7 @@ SAW_TEST("Collision Spheroid 2D"){
auto& coll = part_b.template get<"collision">();
auto& radius = coll.template get<"radius">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = -1.5;
pos.at({{1u}}) = 0.0;
@@ -108,7 +108,7 @@ SAW_TEST("Moving particles 2D"){
auto& radius = coll.template get<"radius">();
auto& acc = body.template get<"acceleration">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = -5.0;
pos.at({{1u}}) = 0.2;
@@ -125,7 +125,7 @@ SAW_TEST("Moving particles 2D"){
auto& radius = coll.template get<"radius">();
auto& acc = body.template get<"acceleration">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = 5.0;
pos.at({{1u}}) = 0.0;
@@ -162,7 +162,7 @@ SAW_TEST("Particle Matrix Rotation"){
auto& radius = coll.template get<"radius">();
auto& acc = body.template get<"acceleration">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = -5.0;
pos.at({{1u}}) = 0.2;
@@ -185,7 +185,7 @@ SAW_TEST("Particle Collision Impulse"){
auto& radius = coll.template get<"radius">();
auto& acc = body.template get<"acceleration">();
- radius.set(1.0);
+ radius.at({}).set(1.0);
pos.at({{0u}}) = -5.0;
pos.at({{1u}}) = 0.2;
@@ -202,7 +202,7 @@ SAW_TEST("Particle Collision Impulse"){
auto& radius = coll.template get<"radius">();
auto& acc = body.template get<"acceleration">();
- radius.set(1.5);
+ radius.at({}).set(1.5);
pos.at({{0u}}) = 5.0;
pos.at({{1u}}) = 0.0;