From 0786c15aa982d37d12ff9fdc40c02c8b0a65c917 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 29 Apr 2025 17:36:16 +0200 Subject: wip dangling changes --- c++/particle/geometry/circle.hpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'c++/particle/geometry/circle.hpp') diff --git a/c++/particle/geometry/circle.hpp b/c++/particle/geometry/circle.hpp index 65b8966..e7b78f1 100644 --- a/c++/particle/geometry/circle.hpp +++ b/c++/particle/geometry/circle.hpp @@ -1,15 +1,15 @@ #pragma once +#include "../particle.hpp" + namespace kel { namespace lbm { template class particle_circle_geometry { private: - saw::data radius_; public: - particle_circle_geometry(saw::data radius__): - radius_{radius__} + particle_circle_geometry() {} template @@ -18,19 +18,25 @@ public: auto& grid = mask.template get<"grid">(); - uint64_t size = resolution + 2*boundary_nodes; - grid = {{size,size}}; - - saw::data radius_squared = radius_ * radius_; - + //uint64_t rad_i = static_cast(resolution * radius_.get())+1u; + uint64_t rad_i = resolution; + uint64_t size = rad_i + 2*boundary_nodes; + grid = {{{size,size}}}; + saw::data delta_x{2.0 / rad_i}; + saw::data center = (saw::data{1.0} + saw::data{2.0} * saw::data{static_cast::type>(boundary_nodes)/rad_i}); 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{ - + grid.at({{i,j}}).set(0); + if(i >= boundary_nodes and j >= boundary_nodes and i < (rad_i + boundary_nodes) and j < (rad_i + boundary_nodes) ){ + saw::data fi = saw::data{0.5+static_cast::type>(i)} * delta_x - center; + saw::data fj = saw::data{0.5+static_cast::type>(j)} * delta_x - center; + + auto norm_f_ij = fi*fi + fj*fj; + if(norm_f_ij.get() <= 1){ + grid.at({{i,j}}).set(1); + } } } } -- cgit v1.2.3