From abd0dbdca5735a8281e5df27181cc08ec51dae54 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 19 Feb 2026 18:14:39 +0100 Subject: Proper distribution --- examples/poiseulle_3d_gpu/sim.cpp | 10 ++++--- lib/core/c++/collision.hpp | 9 ++++-- lib/core/c++/descriptor.hpp | 58 +++++++++++++++++++++++++-------------- lib/core/tests/memory.cpp | 4 +-- 4 files changed, 52 insertions(+), 29 deletions(-) diff --git a/examples/poiseulle_3d_gpu/sim.cpp b/examples/poiseulle_3d_gpu/sim.cpp index 624566f..df4647e 100644 --- a/examples/poiseulle_3d_gpu/sim.cpp +++ b/examples/poiseulle_3d_gpu/sim.cpp @@ -59,6 +59,7 @@ using MacroStruct = Struct< template saw::error_or setup_initial_conditions( + converter& conv, saw::data>& fields, saw::data>& macros, saw::data, particle_size>>& particles @@ -148,6 +149,7 @@ saw::error_or setup_initial_conditions( template saw::error_or step( + converter& conv, saw::data>,encode::Sycl>& fields, saw::data>,encode::Sycl>& macros, saw::data t_i, @@ -159,7 +161,7 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ // Need nicer things to handle the flow. I see improvement here - component> collision{0.6}; + component> collision{conv.template kinematic_viscosity_si_to_tau({0.1}).handle()}; // component> collision{0.6}; component> bb; @@ -255,7 +257,7 @@ saw::error_or lbm_main(int argc, char** argv){ } auto& lbm_dir = eo_lbm_dir.get_value(); - auto out_dir = lbm_dir / "poiseulle_particles_3d_gpu"; + auto out_dir = lbm_dir / "poiseulle_3d_gpu"; { std::error_code ec; @@ -302,7 +304,7 @@ saw::error_or lbm_main(int argc, char** argv){ sycl_q.wait(); { - auto eov = setup_initial_conditions(*lbm_data_ptr,*lbm_macro_data_ptr,*lbm_particle_data_ptr); + auto eov = setup_initial_conditions(conv,*lbm_data_ptr,*lbm_macro_data_ptr,*lbm_particle_data_ptr); if(eov.is_error()){ return eov; } @@ -355,7 +357,7 @@ saw::error_or lbm_main(int argc, char** argv){ }*/ } { - auto eov = step(lsd_view,lsdm_view,i,dev); + auto eov = step(conv,lsd_view,lsdm_view,i,dev); if(eov.is_error()){ return eov; } diff --git a/lib/core/c++/collision.hpp b/lib/core/c++/collision.hpp index 349833f..f259c9f 100644 --- a/lib/core/c++/collision.hpp +++ b/lib/core/c++/collision.hpp @@ -18,12 +18,17 @@ struct BGKGuo {}; template class component { private: - typename saw::native_data_type::type relaxation_; + saw::data relaxation_; saw::data frequency_; public: component(typename saw::native_data_type::type relaxation__): + relaxation_{{relaxation__}}, + frequency_{saw::data{1} / relaxation_} + {} + + component(const saw::data& relaxation__): relaxation_{relaxation__}, - frequency_{typename saw::native_data_type::type(1) / relaxation_} + frequency_{saw::data{1} / relaxation_} {} using Component = cmpt::BGK; diff --git a/lib/core/c++/descriptor.hpp b/lib/core/c++/descriptor.hpp index e38daee..73f0cce 100644 --- a/lib/core/c++/descriptor.hpp +++ b/lib/core/c++/descriptor.hpp @@ -54,6 +54,22 @@ struct CellFieldStruct { template class df_info{}; +/* +namespace impl { +template +struct df_ct_helper { + template + static constexpr uint64_t apply_i(const std::array,Desc::Q>& dirs, const std::array& inp){ + if constexpr ( i < Desc::Q ){ + for(uint64_t j = 0u; j < Desc::D; ++j){ + } + } + return 0u; + } +}; +} +*/ + template class df_info> { public: @@ -214,34 +230,34 @@ public: static constexpr std::array::type,Q> weights = { 8./27., // 1D - 2./27., - 2./27., - // 2D - 2./27., - 1./9., 1./36., 1./36., + // 2D 1./36., + 1./54., + 1./54., 1./36., + 1./54., + 1./54., // 3D - 8./27., - 1./9., - 1./9., - 1./9., - 1./9., - 1./36., - 1./36., 1./36., + 1./54., + 1./54., + 1./54., + 1./216., + 1./216., + 1./54., + 1./216., + 1./216., 1./36., - 8./27., - 1./9., - 1./9., - 1./9., - 1./9., - 1./36., - 1./36., - 1./36., - 1./36. + 1./54., + 1./54., + 1./54., + 1./216., + 1./216., + 1./54., + 1./216., + 1./216. }; static constexpr std::array opposite_index = { diff --git a/lib/core/tests/memory.cpp b/lib/core/tests/memory.cpp index cdc6f8c..d59d212 100644 --- a/lib/core/tests/memory.cpp +++ b/lib/core/tests/memory.cpp @@ -46,13 +46,13 @@ SAW_TEST("Memory Estimate Scalar"){ SAW_TEST("Memory Estimate Chunk"){ using namespace kel::lbm; - SAW_EXPECT((memory_estimate().get() == 480u), std::string{"TChunk isn't 480 bytes "} + std::to_string(memory_estimate().get()) ); + SAW_EXPECT((memory_estimate().get() == 480u), std::string{"TChunk isn't 480 bytes, but is "} + std::to_string(memory_estimate().get()) ); } SAW_TEST("Memory Estimate Struct of Chunk"){ using namespace kel::lbm; - SAW_EXPECT((memory_estimate().get() == 960u), std::string{"TChunk isn't 480 bytes "} + std::to_string(memory_estimate().get()) ); + SAW_EXPECT((memory_estimate().get() == 960u), std::string{"TChunkStruct isn't 960 bytes, but is "} + std::to_string(memory_estimate().get()) ); } } -- cgit v1.2.3