From c59aeef2e0c86ec3f0f34ce77c205f3ef0b034cc Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 8 Nov 2026 22:04:06 +0100 Subject: Abstract move. Forstio independence --- examples/feature_development/common.hpp | 1 - examples/feature_development/init.hpp | 18 ++++++++-------- examples/feature_development/sim.cpp | 38 ++++++++++++++++----------------- examples/feature_development/step.hpp | 30 +++++++++++++------------- 4 files changed, 43 insertions(+), 44 deletions(-) (limited to 'examples/feature_development') diff --git a/examples/feature_development/common.hpp b/examples/feature_development/common.hpp index b321344..6806b2c 100644 --- a/examples/feature_development/common.hpp +++ b/examples/feature_development/common.hpp @@ -19,7 +19,6 @@ constexpr uint64_t dim_x = dim_y * 20ul; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk; diff --git a/examples/feature_development/init.hpp b/examples/feature_development/init.hpp index b7fdeb0..a61ef37 100644 --- a/examples/feature_development/init.hpp +++ b/examples/feature_development/init.hpp @@ -6,11 +6,11 @@ namespace kel { namespace lbm { template -saw::error_or init( +kel::lbm::error_or init( const converter& conv, - saw::data>& fields, - saw::data>& macros, - saw::data>& particles + kel::lbm::data>& fields, + kel::lbm::data>& macros, + kel::lbm::data>& particles ){ (void) conv; @@ -95,7 +95,7 @@ saw::error_or init( iterator::apply( [&](auto& index){ - saw::data> middle, ind_vec; + kel::lbm::data> middle, ind_vec; middle.at({{0u}}) = dim_x * 0.25; middle.at({{1u}}) = dim_y * 0.5; @@ -103,7 +103,7 @@ saw::error_or init( ind_vec.at({{1u}}) = index.at({{1u}}).template cast_to(); auto dist = middle - ind_vec; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}).get() < dim_y*dim_y*0.01){ porous_f.at(index).at({}) = 0.0; } @@ -113,14 +113,14 @@ saw::error_or init( ); { - saw::data> radius_p; + kel::lbm::data> radius_p; radius_p.at({}).set(2); - saw::data> dense_p; + kel::lbm::data> dense_p; dense_p.at({}).set(1); particles = create_spheroid_particle_group(radius_p, dense_p, {{16u}}); } - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/feature_development/sim.cpp b/examples/feature_development/sim.cpp index f5b49e9..e852313 100644 --- a/examples/feature_development/sim.cpp +++ b/examples/feature_development/sim.cpp @@ -8,7 +8,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< Member, @@ -22,7 +21,7 @@ using LbmArgs = Args< } template -saw::error_or lbm_main(const saw::data& args){ +kel::lbm::error_or lbm_main(const kel::lbm::data& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -41,7 +40,7 @@ saw::error_or lbm_main(const saw::data& args){ std::error_code ec; std::filesystem::create_directories(out_dir,ec); if(ec != std::errc{}){ - return saw::make_error("Could not create output directory"); + return kel::lbm::make_error("Could not create output directory"); } } @@ -54,16 +53,17 @@ saw::error_or lbm_main(const saw::data& args){ print_lbm_meta(conv,{0.1},{1e-4},{0.4 * dim_y}); - // saw::data> meta{{dim_x,dim_y}}; - auto lbm_data_ptr = saw::heap>>(); - auto lbm_macro_data_ptr = saw::heap>>(); - auto lbm_particle_data_ptr = saw::heap>>(); + // kel::lbm::data> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap>>(); + auto lbm_macro_data_ptr = kel::lbm::heap>>(); + auto lbm_particle_data_ptr = kel::lbm::heap>>(); std::cout<<"Estimated Bytes: "<,sch::MacroStruct>().get()<( + std::string{eo_aio.get_error().get_message()}); } auto& aio = eo_aio.get_value(); saw::wait_scope wait{aio.event_loop}; @@ -95,9 +95,9 @@ saw::error_or lbm_main(const saw::data& args){ } } - saw::data, encode::Sycl> lbm_sycl_data{sycl_q}; - saw::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; - saw::data, encode::Sycl> lbm_sycl_particle_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_macro_data{sycl_q}; + kel::lbm::data, encode::Sycl> lbm_sycl_particle_data{sycl_q}; sycl_q.wait(); { @@ -117,11 +117,11 @@ saw::error_or lbm_main(const saw::data& args){ auto lsdm_view = make_view(lbm_sycl_macro_data); auto lsdp_view = make_view(lbm_sycl_particle_data); - saw::data time_steps{64u*1024ul}; + kel::lbm::data time_steps{64u*1024ul}; auto& info_f = lsd_view.template get<"info">(); - for(saw::data i{0u}; i < time_steps and krun; ++i){ + for(kel::lbm::data i{0u}; i < time_steps and krun; ++i){ // BC + Collision { auto eov = step(conv,lsd_view,lsdm_view,lsdp_view,i,dev); @@ -147,10 +147,10 @@ saw::error_or lbm_main(const saw::data& args){ } // Stream sycl_q.submit([&](acpp::sycl::handler& h){ - component> stream; + component> stream; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -186,16 +186,16 @@ saw::error_or lbm_main(const saw::data& args){ } sycl_q.wait(); - return saw::make_void(); + return kel::lbm::make_void(); } using FloatT = kel::lbm::sch::Float32; using DescT = kel::lbm::sch::D2Q9; -saw::error_or k_main(int argc, char** argv){ +kel::lbm::error_or k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data args; + kel::lbm::data args; { auto eov = saw::parse_args(args,argc,argv); return eov; @@ -209,7 +209,7 @@ saw::error_or k_main(int argc, char** argv){ // return kmain(args); } - return saw::make_error("Invalid coupling"); + return kel::lbm::make_error("Invalid coupling"); } diff --git a/examples/feature_development/step.hpp b/examples/feature_development/step.hpp index 37eb4e7..ade14ca 100644 --- a/examples/feature_development/step.hpp +++ b/examples/feature_development/step.hpp @@ -6,12 +6,12 @@ namespace kel { namespace lbm { template -saw::error_or step( +kel::lbm::error_or step( const converter& conv, - saw::data>,encode::Sycl>& fields, - saw::data>,encode::Sycl>& macros, - saw::data>,encode::Sycl>& particles, - saw::data t_i, + kel::lbm::data>,encode::Sycl>& fields, + kel::lbm::data>,encode::Sycl>& macros, + kel::lbm::data>,encode::Sycl>& particles, + kel::lbm::data t_i, device& dev ){ auto& q = dev.get_handle(); @@ -19,9 +19,9 @@ saw::error_or step( auto& porous_f = macros.template get<"porosity">(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_reset; + component> hlbm_reset; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -31,10 +31,10 @@ saw::error_or step( }).wait(); q.submit([&](acpp::sycl::handler& h){ - component> hlbm_one_part; + component> hlbm_one_part; h.parallel_for(acpp::sycl::range<1u>{particle_amount}, [=](acpp::sycl::id<1u> idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < 1u; ++i){ index.at({{i}}).set(idx[i]); } @@ -45,10 +45,10 @@ saw::error_or step( // auto coll_ev = q.submit([&](acpp::sycl::handler& h){ - component> collision{0.8}; - component> bb; + component> collision{0.8}; + component> bb; - component,encode::Sycl> flow_in{ + component,encode::Sycl> flow_in{ [&](){ uint64_t target_t_i = 16u; if(t_i.get() < target_t_i){ @@ -57,10 +57,10 @@ saw::error_or step( return 1.01; }() }; - component,encode::Sycl> flow_out{1.0}; + component,encode::Sycl> flow_out{1.0}; h.parallel_for(acpp::sycl::range{dim_x,dim_y}, [=](acpp::sycl::id idx){ - saw::data> index; + kel::lbm::data> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -90,7 +90,7 @@ saw::error_or step( }); }).wait(); - return saw::make_void(); + return kel::lbm::make_void(); } } -- cgit v1.3.1