diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-11-08 22:04:06 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2026-11-08 22:04:06 +0100 |
| commit | c59aeef2e0c86ec3f0f34ce77c205f3ef0b034cc (patch) | |
| tree | 7e29aea25537b31040c5bb3649749706e54e5706 /examples/stdkr_2d_bgk | |
| parent | fa6bc96b28f6654040992b282525b88d5d46aca9 (diff) | |
| download | libs-lbm-c59aeef2e0c86ec3f0f34ce77c205f3ef0b034cc.tar.gz | |
Abstract move. Forstio independence
Diffstat (limited to 'examples/stdkr_2d_bgk')
| -rw-r--r-- | examples/stdkr_2d_bgk/common.hpp | 1 | ||||
| -rw-r--r-- | examples/stdkr_2d_bgk/init.hpp | 16 | ||||
| -rw-r--r-- | examples/stdkr_2d_bgk/sim.cpp | 34 | ||||
| -rw-r--r-- | examples/stdkr_2d_bgk/step.hpp | 28 |
4 files changed, 39 insertions, 40 deletions
diff --git a/examples/stdkr_2d_bgk/common.hpp b/examples/stdkr_2d_bgk/common.hpp index 0b597c0..cac01fd 100644 --- a/examples/stdkr_2d_bgk/common.hpp +++ b/examples/stdkr_2d_bgk/common.hpp @@ -30,7 +30,6 @@ constexpr uint64_t dim_x = 220u; constexpr uint64_t particle_amount = 1ul; namespace sch { -using namespace saw::schema; using InfoChunk = Chunk<UInt8, 0u, dim_x, dim_y>; diff --git a/examples/stdkr_2d_bgk/init.hpp b/examples/stdkr_2d_bgk/init.hpp index 3127c88..10edd9c 100644 --- a/examples/stdkr_2d_bgk/init.hpp +++ b/examples/stdkr_2d_bgk/init.hpp @@ -6,10 +6,10 @@ namespace kel { namespace lbm { template<typename T, typename Desc, typename Coll> -saw::error_or<void> init( +kel::lbm::error_or<void> init( const converter<T>& conv, - saw::data<sch::ChunkStruct<T,Desc>>& fields, - saw::data<sch::MacroStruct<T,Desc>>& macros + kel::lbm::data<sch::ChunkStruct<T,Desc>>& fields, + kel::lbm::data<sch::MacroStruct<T,Desc>>& macros ){ (void) conv; @@ -92,12 +92,12 @@ saw::error_or<void> init( iterator<Desc::D>::apply( [&](const auto& index){ auto& info = info_f.at(index); - saw::data<sch::Scalar<T>> radius_p; + kel::lbm::data<sch::Scalar<T>> radius_p; radius_p.at({}).set(conv.meter_si_to_lbm({{0.05}}).handle().get()); - saw::data<sch::Scalar<T>> dense_p; + kel::lbm::data<sch::Scalar<T>> dense_p; dense_p.at({}).set(1); - saw::data<sch::Vector<T,Desc::D>> middle,ind_vec; + kel::lbm::data<sch::Vector<T,Desc::D>> middle,ind_vec; middle.at({{0u}}) = conv.meter_si_to_lbm({{0.16}}).handle(); middle.at({{1u}}) = conv.meter_si_to_lbm({{0.2}}).handle(); @@ -106,7 +106,7 @@ saw::error_or<void> init( } auto dist = ind_vec - middle; - auto dist_2 = saw::math::dot(dist,dist); + auto dist_2 = kel::lbm::math::dot(dist,dist); if(dist_2.at({}) < radius_p.at({}) * radius_p.at({})){ info_f.at(index) = 1u; @@ -115,7 +115,7 @@ saw::error_or<void> init( {},// 0-index df_f.get_dims() ); - return saw::make_void(); + return kel::lbm::make_void(); } } diff --git a/examples/stdkr_2d_bgk/sim.cpp b/examples/stdkr_2d_bgk/sim.cpp index 36147d5..9b9b5a7 100644 --- a/examples/stdkr_2d_bgk/sim.cpp +++ b/examples/stdkr_2d_bgk/sim.cpp @@ -9,7 +9,6 @@ * For deciding what parameters to use maybe? */ namespace args { -using namespace saw::schema; using LbmArgsStruct = Struct< >; @@ -21,7 +20,7 @@ using LbmArgs = Args< } template<typename T, typename Desc, typename Coll> -saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){ +kel::lbm::error_or<void> lbm_main(const kel::lbm::data<args::LbmArgs>& args){ using namespace kel::lbm; auto& an = args.template get<"args">(); @@ -40,7 +39,7 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){ std::error_code ec; std::filesystem::create_directories(out_dir,ec); if(ec != std::errc{}){ - return saw::make_error<saw::err::critical>("Could not create output directory"); + return kel::lbm::make_error<kel::lbm::err::critical>("Could not create output directory"); } } @@ -53,15 +52,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){ print_lbm_meta<T,Desc>(conv,{1e-3},{1e-4},{0.5 * dim_y}); - // saw::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}}; - auto lbm_data_ptr = saw::heap<saw::data<sch::ChunkStruct<T,Desc>>>(); - auto lbm_macro_data_ptr = saw::heap<saw::data<sch::MacroStruct<T,Desc>>>(); + // kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> meta{{dim_x,dim_y}}; + auto lbm_data_ptr = kel::lbm::heap<kel::lbm::data<sch::ChunkStruct<T,Desc>>>(); + auto lbm_macro_data_ptr = kel::lbm::heap<kel::lbm::data<sch::MacroStruct<T,Desc>>>(); std::cout<<"Estimated Bytes: "<<memory_estimate<sch::ChunkStruct<T,Desc>,sch::MacroStruct<T,Desc>>().get()<<std::endl; auto eo_aio = saw::setup_async_io(); if(eo_aio.is_error()){ - return std::move(eo_aio.get_error()); + return kel::lbm::make_error<kel::lbm::err::critical>( + std::string{eo_aio.get_error().get_message()}); } auto& aio = eo_aio.get_value(); saw::wait_scope wait{aio.event_loop}; @@ -93,8 +93,8 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){ } } - saw::data<sch::ChunkStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_data{sycl_q}; - saw::data<sch::MacroStruct<T,Desc>, encode::Sycl<saw::encode::Native>> lbm_sycl_macro_data{sycl_q}; + kel::lbm::data<sch::ChunkStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_data{sycl_q}; + kel::lbm::data<sch::MacroStruct<T,Desc>, encode::Sycl<kel::lbm::enc::Native>> lbm_sycl_macro_data{sycl_q}; sycl_q.wait(); { @@ -113,11 +113,11 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){ auto lsd_view = make_view(lbm_sycl_data); auto lsdm_view = make_view(lbm_sycl_macro_data); - saw::data<sch::UInt64> time_steps{64u*1024ul}; + kel::lbm::data<sch::UInt64> time_steps{64u*1024ul}; auto& info_f = lsd_view.template get<"info">(); - for(saw::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){ + for(kel::lbm::data<sch::UInt64> i{0u}; i < time_steps and krun; ++i){ // BC + Collision { auto eov = step<T,Desc,Coll>(conv,lsd_view,lsdm_view,i,dev); @@ -143,10 +143,10 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& args){ } // Stream sycl_q.submit([&](acpp::sycl::handler& h){ - component<T,Desc,cmpt::Stream,encode::Sycl<saw::encode::Native>> stream; + component<T,Desc,cmpt::Stream,encode::Sycl<kel::lbm::enc::Native>> stream; h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){ - saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index; + kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -182,16 +182,16 @@ saw::error_or<void> lbm_main(const saw::data<args::LbmArgs>& 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<void> k_main(int argc, char** argv){ +kel::lbm::error_or<void> k_main(int argc, char** argv){ using namespace kel::lbm; - saw::data<args::LbmArgs> args; + kel::lbm::data<args::LbmArgs> args; { auto eov = saw::parse_args(args,argc,argv); if(eov.is_error()){ @@ -201,7 +201,7 @@ saw::error_or<void> k_main(int argc, char** argv){ return lbm_main<FloatT,DescT,method::Bgk>(args); - return saw::make_error<saw::err::critical>("Invalid coupling"); + return kel::lbm::make_error<kel::lbm::err::critical>("Invalid coupling"); } diff --git a/examples/stdkr_2d_bgk/step.hpp b/examples/stdkr_2d_bgk/step.hpp index cbf9f43..67f8486 100644 --- a/examples/stdkr_2d_bgk/step.hpp +++ b/examples/stdkr_2d_bgk/step.hpp @@ -6,26 +6,26 @@ namespace kel { namespace lbm { template<typename T, typename Desc, typename Coll> -saw::error_or<void> step( +kel::lbm::error_or<void> step( const converter<T>& conv, - saw::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& fields, - saw::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<saw::encode::Native>>& macros, - saw::data<sch::UInt64> t_i, + kel::lbm::data<sch::Ptr<sch::ChunkStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& fields, + kel::lbm::data<sch::Ptr<sch::MacroStruct<T,Desc>>,encode::Sycl<kel::lbm::enc::Native>>& macros, + kel::lbm::data<sch::UInt64> t_i, device& dev ){ - static constexpr saw::data<sch::UInt64> sub_steps{0u}; + static constexpr kel::lbm::data<sch::UInt64> sub_steps{0u}; auto& q = dev.get_handle(); auto& info_f = fields.template get<"info">(); { q.submit([&](acpp::sycl::handler& h){ - component<T,Desc,cmpt::BGK,encode::Sycl<saw::encode::Native>> collision{1.0}; - component<T,Desc,cmpt::BounceBack,encode::Sycl<saw::encode::Native>> bb; - component<T,Desc,cmpt::ZouHePressureX<false>,encode::Sycl<saw::encode::Native>> flow_out{1.0}; + component<T,Desc,cmpt::BGK,encode::Sycl<kel::lbm::enc::Native>> collision{1.0}; + component<T,Desc,cmpt::BounceBack,encode::Sycl<kel::lbm::enc::Native>> bb; + component<T,Desc,cmpt::ZouHePressureX<false>,encode::Sycl<kel::lbm::enc::Native>> flow_out{1.0}; h.parallel_for(acpp::sycl::range<Desc::D>{dim_x,dim_y}, [=](acpp::sycl::id<Desc::D> idx){ - saw::data<sch::FixedArray<sch::UInt64,Desc::D>> index; + kel::lbm::data<sch::FixedArray<sch::UInt64,Desc::D>> index; for(uint64_t i = 0u; i < Desc::D; ++i){ index.at({{i}}).set(idx[i]); } @@ -43,12 +43,12 @@ saw::error_or<void> step( break; case 3u: { - component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<saw::encode::Native>> flow_in{ - [&]() -> saw::data<sch::Vector<T,Desc::D>> { - saw::data<sch::Vector<T,Desc::D>> vel; + component<T,Desc,cmpt::ZouHeVelocityX<true>,encode::Sycl<kel::lbm::enc::Native>> flow_in{ + [&]() -> kel::lbm::data<sch::Vector<T,Desc::D>> { + kel::lbm::data<sch::Vector<T,Desc::D>> vel; { auto y_si = conv.meter_lbm_to_si(index.at({{1u}}).template cast_to<T>()).handle(); - vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename saw::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); + vel.at({{0u}}) = conv.velocity_si_to_lbm({{static_cast<typename kel::lbm::native_data_type<T>::type>((1.2 / 0.41) * y_si.get() - (1.2 / (0.41*0.41)) * y_si.get() * y_si.get())}}).handle(); vel.at({{1u}}) = 0.0f; } return vel; @@ -69,7 +69,7 @@ saw::error_or<void> step( }).wait(); } - return saw::make_void(); + return kel::lbm::make_void(); } } |
