From 1dc57770fe88b0564463d67a77a4c35f403c5d7f Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 23 Apr 2025 20:19:36 +0200 Subject: Working on mask generation of static solid particles --- c++/collision.hpp | 2 ++ c++/config.hpp | 3 ++- c++/particle/geometry/circle.hpp | 43 ++++++++++++++++++++++++++++++++++++++++ c++/particle/particle.hpp | 18 ++++++++++++----- 4 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 c++/particle/geometry/circle.hpp (limited to 'c++') diff --git a/c++/collision.hpp b/c++/collision.hpp index ba35be1..9143862 100644 --- a/c++/collision.hpp +++ b/c++/collision.hpp @@ -40,6 +40,8 @@ public: } + + }; } } diff --git a/c++/config.hpp b/c++/config.hpp index 64f7a0f..aefd833 100644 --- a/c++/config.hpp +++ b/c++/config.hpp @@ -16,7 +16,8 @@ template using LbmConfig = Struct< Member, Member, - Member + Member, + Member, "dims"> >; } diff --git a/c++/particle/geometry/circle.hpp b/c++/particle/geometry/circle.hpp new file mode 100644 index 0000000..65b8966 --- /dev/null +++ b/c++/particle/geometry/circle.hpp @@ -0,0 +1,43 @@ +#pragma once + +namespace kel { +namespace lbm { + +template +class particle_circle_geometry { +private: + saw::data radius_; +public: + particle_circle_geometry(saw::data radius__): + radius_{radius__} + {} + + template + saw::data> generate_mask(uint64_t resolution, uint64_t boundary_nodes = 0) const { + saw::data> mask; + + auto& grid = mask.template get<"grid">(); + + uint64_t size = resolution + 2*boundary_nodes; + grid = {{size,size}}; + + saw::data radius_squared = radius_ * radius_; + + + + for(uint64_t i = 0; i < size; ++i){ + for(uint64_t j = 0; j < size; ++j){ + if(i < boundary_nodes || j < boundary_nodes || i >= resolution+boundary_nodes || j >= resolution + boundary_nodes ){ + grid.at({i,j}).set(0); + }else{ + + } + } + } + + return mask; + } +}; + +} +} diff --git a/c++/particle/particle.hpp b/c++/particle/particle.hpp index aeda17f..f893b9b 100644 --- a/c++/particle/particle.hpp +++ b/c++/particle/particle.hpp @@ -18,22 +18,30 @@ using ParticleRigidBody = Struct< template using ParticleMask = Struct< - Member, "mask"> + Member, "grid"> >; template using Particle = Struct< - Member, "rigid_body"> + Member, "rigid_body">, + Member, "mask"> >; } -template +template class particle_system { private: - saw::data>> particles_; + saw::data> particles_; public: - void step(T time_step){ + void step(T time_step_delta){ + for(auto& iter : particles_){ + verlet_step(time_step_delta); + } + } + + template + void update_mask(saw::data& latt){ for(auto& iter : particles_){ } -- cgit v1.2.3