From e60db388693b63be6d7e4c03234976b567378e94 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 21 Jan 2026 17:20:08 +0100 Subject: Fixing compilation errors --- examples/poiseulle_particles_2d_gpu/sim.cpp | 98 ++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 14 deletions(-) (limited to 'examples/poiseulle_particles_2d_gpu/sim.cpp') diff --git a/examples/poiseulle_particles_2d_gpu/sim.cpp b/examples/poiseulle_particles_2d_gpu/sim.cpp index 8bc60c9..be6b4f0 100644 --- a/examples/poiseulle_particles_2d_gpu/sim.cpp +++ b/examples/poiseulle_particles_2d_gpu/sim.cpp @@ -1,8 +1,15 @@ #include -#include +#include + +#include +#include namespace kel { namespace lbm { + +constexpr uint64_t dim_x = 16u; +constexpr uint64_t dim_y = 4u; + namespace sch { using namespace saw::schema; @@ -14,6 +21,63 @@ using CellStruct = Struct< Member, "velocity">, Member, "force"> >; + + +using InfoChunk = Chunk; + +template +using DfChunk = Chunk, 1u, dim_x, dim_y>; + +template +using ChunkStruct = Struct< + Member +>; + +} + +template +saw::error_or setup_initial_conditions(saw::data>& fields){ + auto& info_f = fields.get<"info">(); + // Set everything as walls + iterator::apply( + [&](auto& index){ + info_f.at(index).set(2u); + }, + {{0u,0u}}, + {{dim_x, dim_y}}, + {{0u,0u}} + ); + // Fluid + iterator::apply( + [&](auto& index){ + info_f.at(index).set(1u); + }, + {{0u,0u}}, + {{dim_x, dim_y}}, + {{1u,1u}} + ); + + // Inflow + iterator::apply( + [&](auto& index){ + info_f.at(index).set(3u); + }, + {{0u,0u}}, + {{1u, dim_y}}, + {{0u,1u}} + ); + + // Outflow + iterator::apply( + [&](auto& index){ + info_f.at(index).set(4u); + }, + {{dim_x-1u,0u}}, + {{dim_x, dim_y}}, + {{0u,1u}} + ); + + return saw::make_void(); } template @@ -25,48 +89,54 @@ saw::error_or step(){ } template -saw::error_or kel_main(int argc, char** argv){ - using namespace kel; +saw::error_or lbm_main(int argc, char** argv){ + using namespace kel::lbm; - using dfi = lbm::df_info; + using dfi = df_info; - auto eo_lbm_dir = lbm::output_directory(); + auto eo_lbm_dir = output_directory(); if(eo_lbm_dir.is_error()){ return std::move(eo_lbm_dir.get_error()); } auto& lbm_dir = eo_lbm_dir.get_value(); auto out_dir = lbm_dir / "poiseulle_particles_2d_gpu"; - lbm::converter conv { + converter conv { // delta_x {{1.0}}, // delta_t {{1.0}} }; - uint64_t x_d = 256u; - uint64_t y_d = 64u; - saw::data> meta{{x_d,y_d}}; - saw::data,Desc::D>> lbm_data{meta}; + // saw::data> meta{{dim_x,dim_y}}; + saw::data> lbm_data{}; acpp::sycl::queue sycl_q; sycl_q.wait(); { - auto eov = setup_initial_conditions(lbm_data); + auto eov = setup_initial_conditions(lbm_data); if(eov.is_error()){ return eov; } } - + /* + iterator::apply( + [&](auto& index){ + std::cout<().at(index).template cast_to().get()<<"\n"; + }, + {{0u,0u}}, + {{dim_x, dim_y}} + ); + */ return saw::make_void(); } -using FloatT = kel::sch::Float32; +using FloatT = kel::lbm::sch::Float32; int main(int argc, char** argv){ - auto eov = kel_main(argc, argv); + auto eov = lbm_main(argc, argv); if(eov.is_error()){ auto& err = eov.get_error(); std::cerr<<"[Error] "<