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/poiseulle_3d/poiseulle_3d.cpp | |
| parent | fa6bc96b28f6654040992b282525b88d5d46aca9 (diff) | |
| download | libs-lbm-c59aeef2e0c86ec3f0f34ce77c205f3ef0b034cc.tar.gz | |
Abstract move. Forstio independence
Diffstat (limited to 'examples/poiseulle_3d/poiseulle_3d.cpp')
| -rw-r--r-- | examples/poiseulle_3d/poiseulle_3d.cpp | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/examples/poiseulle_3d/poiseulle_3d.cpp b/examples/poiseulle_3d/poiseulle_3d.cpp index 83d1af1..141dc5f 100644 --- a/examples/poiseulle_3d/poiseulle_3d.cpp +++ b/examples/poiseulle_3d/poiseulle_3d.cpp @@ -146,7 +146,6 @@ public: namespace kel { namespace lbm { namespace sch { -using namespace saw::schema; using T = Float32; using Desc = Descriptor<3u,27u>; @@ -161,21 +160,21 @@ using CellStruct = Struct< Member<CellInfo, "info"> >; } -using SyclKelAllocator = acpp::sycl::usm_allocator<saw::data<sch::CellStruct>, acpp::sycl::usm::alloc::shared>; +using SyclKelAllocator = acpp::sycl::usm_allocator<kel::lbm::data<sch::CellStruct>, acpp::sycl::usm::alloc::shared>; -uint64_t to_flat_index(const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index, const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){ +uint64_t to_flat_index(const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index, const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){ auto flat = index.at({2u}) + meta.at({2u})*(index.at({1u}) + index.at({0u})*meta.at({1u})); return flat.get(); } template<typename StructFieldSchema> -saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKelAllocator>& latt, const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){ +kel::lbm::error_or<void> set_geometry(std::vector<kel::lbm::data<StructFieldSchema>,SyclKelAllocator>& latt, const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){ using namespace kel::lbm; /** * Set ghost */ - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -183,17 +182,17 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe info({0u}).set(0u); }, {{0u,0u}}, meta); - saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> distance; + kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> distance; /** * Set wall */ - iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){ + iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){ distance.at(index.at({0u})) = {1u}; },{{0u}},{{sch::Desc::D}}); /* */ - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -204,12 +203,12 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe /** * Set fluid */ - iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){ + iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){ distance.at(index.at({0u})) = {2u}; },{{0u}},{{sch::Desc::D}}); /* */ - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -222,14 +221,14 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe * Set inflow */ - saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> shifted_point; - iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){ + kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> shifted_point; + iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){ distance.at(index.at({0u})) = (index.at({0u}).get() == 0u)?1u:2u; shifted_point.at(index.at({0u})) = (index.at({0u}).get() == 0u)?3u:meta.at({index.at({0u})}); },{{0u}},{{sch::Desc::D}}); /* */ - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -241,13 +240,13 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe /** * Set outflow */ - iterator<1u>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,1u>>& index){ + iterator<1u>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,1u>>& index){ distance.at(index.at({0u})) = (index.at({0u}).get() == 0u)?1u:2u; shifted_point.at(index.at({0u})) = (index.at({0u}).get() == 0u)?(meta.at({0u})-3u):0u; },{{0u}},{{sch::Desc::D}}); /* */ - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -256,51 +255,51 @@ saw::error_or<void> set_geometry(std::vector<saw::data<StructFieldSchema>,SyclKe }, shifted_point, meta, distance); - return saw::make_void(); + return kel::lbm::make_void(); } template<typename StructFieldSchema> -saw::error_or<void> set_initial_conditions(std::vector<saw::data<StructFieldSchema>,SyclKelAllocator>& latt, const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){ +kel::lbm::error_or<void> set_initial_conditions(std::vector<kel::lbm::data<StructFieldSchema>,SyclKelAllocator>& latt, const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta){ - saw::data<sch::T> rho{1.0}; - saw::data<sch::FixedArray<sch::T,sch::Desc::D>> vel{}; + kel::lbm::data<sch::T> rho{1.0}; + kel::lbm::data<sch::FixedArray<sch::T,sch::Desc::D>> vel{}; vel.at({0u}) = {0.1f}; auto eq = equilibrium<sch::T,sch::Desc>(rho, vel); /** * Set distribution */ - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& dfs = cell.template get<"dfs">(); auto& dfs_old = cell.template get<"dfs_old">(); - for(saw::data<sch::UInt64> k = 0; k < saw::data<sch::UInt64>{sch::Desc::Q}; ++k){ + for(kel::lbm::data<sch::UInt64> k = 0; k < kel::lbm::data<sch::UInt64>{sch::Desc::Q}; ++k){ dfs(k) = eq.at(k); dfs_old(k) = eq.at(k); } }, {}, meta); - return saw::make_void(); + return kel::lbm::make_void(); } template<typename StructFieldSchema> -saw::error_or<void> lbm_step( - std::vector<saw::data<StructFieldSchema>,SyclKelAllocator>& latt, - const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta, - saw::data<sch::UInt64> time_step, +kel::lbm::error_or<void> lbm_step( + std::vector<kel::lbm::data<StructFieldSchema>,SyclKelAllocator>& latt, + const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& meta, + kel::lbm::data<sch::UInt64> time_step, acpp::sycl::queue& sycl_q ){ using dfi = df_info<sch::T,sch::Desc>; bool even_step = ((time_step.get() % 2u) == 0u); - component<sch::T, sch::Desc, cmpt::BGK, saw::encode::Native> coll{0.5384}; - component<sch::T, sch::Desc, cmpt::BounceBack, saw::encode::Native> bb; + component<sch::T, sch::Desc, cmpt::BGK, kel::lbm::enc::Native> coll{0.5384}; + component<sch::T, sch::Desc, cmpt::BounceBack, kel::lbm::enc::Native> bb; /** * Collision */ - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& info = cell.template get<"info">(); @@ -329,7 +328,7 @@ saw::error_or<void> lbm_step( }, {}, meta); // Stream - iterator<sch::Desc::D>::apply([&](const saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ + iterator<sch::Desc::D>::apply([&](const kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>>& index){ auto findex = to_flat_index(index,meta); auto& cell = latt.at(findex); auto& df_new = even_step ? cell.template get<"dfs">() : cell.template get<"dfs_old">(); @@ -352,10 +351,10 @@ saw::error_or<void> lbm_step( } } }, {}, meta); - return saw::make_void(); + return kel::lbm::make_void(); } -saw::error_or<void> real_main(int argc, char** argv){ +kel::lbm::error_or<void> real_main(int argc, char** argv){ using dfi = df_info<sch::T,sch::Desc>; converter<sch::T> conv { @@ -369,10 +368,10 @@ saw::error_or<void> real_main(int argc, char** argv){ /** * Set the meta and initialize the lattice */ - saw::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> meta{{2048u,128u,128u}}; + kel::lbm::data<sch::FixedArray<sch::UInt64,sch::Desc::D>> meta{{2048u,128u,128u}}; SyclKelAllocator sycl_shared_alloc{sycl_q}; - std::vector<saw::data<sch::CellStruct>,SyclKelAllocator> lattice{(meta.at({0u})*meta.at({1u})*meta.at({2u})).get(), sycl_shared_alloc}; + std::vector<kel::lbm::data<sch::CellStruct>,SyclKelAllocator> lattice{(meta.at({0u})*meta.at({1u})*meta.at({2u})).get(), sycl_shared_alloc}; /** * Set the geometry @@ -394,14 +393,14 @@ saw::error_or<void> real_main(int argc, char** argv){ } } - for(saw::data<sch::UInt64> ts{0u}; ts < saw::data<sch::UInt64>{1024u*32u}; ++ts){ + for(kel::lbm::data<sch::UInt64> ts{0u}; ts < kel::lbm::data<sch::UInt64>{1024u*32u}; ++ts){ auto eov = lbm_step(lattice,meta,ts,sycl_q); if(eov.is_error()){ return eov; } } - return saw::make_void(); + return kel::lbm::make_void(); } } // lbm |
