From c0549d71b2109f10c1238db8b22362e7826ba61b Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sun, 5 Jul 2026 15:59:23 +0200 Subject: Just rename from lib to modules --- lib/core/c++/boundary.hpp | 249 ---------------------------------------------- 1 file changed, 249 deletions(-) delete mode 100644 lib/core/c++/boundary.hpp (limited to 'lib/core/c++/boundary.hpp') diff --git a/lib/core/c++/boundary.hpp b/lib/core/c++/boundary.hpp deleted file mode 100644 index 01ae7b5..0000000 --- a/lib/core/c++/boundary.hpp +++ /dev/null @@ -1,249 +0,0 @@ -#pragma once - -#include "component.hpp" -#include "equilibrium.hpp" - -namespace kel { -namespace lbm { -namespace cmpt { -struct BounceBack {}; - -template -struct AntiBounceBack {}; - -template -struct ZouHeHorizontal{}; - -struct Equilibrium {}; - -template -struct ZouHePressureY{}; - -template -struct ZouHeVelocityX {}; -} - -/** - * Full-Way BounceBack. - */ -template -class component { -private: -public: - component() = default; - - using Component = cmpt::BounceBack; - - /** - * Thoughts regarding automating order setup - */ - using access = cmpt::access_tuple< - cmpt::access<"dfs", 1, true, true, true> - >; - - /** - * Thoughts regarding automating order setup - */ - static constexpr saw::string_literal name = "full_way_bounce_back"; - static constexpr saw::string_literal after = ""; - static constexpr saw::string_literal before = "streaming"; - - /** - * Raw setup - */ - template - void apply(const saw::data& field, const saw::data>& index, saw::data time_step)const{ - bool is_even = ((time_step.get() % 2u) == 0u); - - // This is a ref - - // auto& dfs_f = (is_even) ? field.template get<"dfs">() : field.template get<"dfs_old">(); - auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); - - using dfi = df_info; - - // Technically use .copy() - auto& dfs_old = dfs_old_f.at(index); - auto df_cpy = dfs_old; - - for(uint64_t i = 0u; i < Descriptor::Q; ++i){ - dfs_old.at({i}) = df_cpy.at({dfi::opposite_index.at(i)}); - } - } -}; - -/** - * Anti Full-Way BounceBack. - */ -template -class component, Encode> { -private: -public: - component() = default; - - using Component = cmpt::AntiBounceBack; - - /** - * Thoughts regarding automating order setup - */ - using access = cmpt::access_tuple< - cmpt::access<"dfs", 1, true, true, true> - >; - - /** - * Thoughts regarding automating order setup - */ - static constexpr saw::string_literal name = "full_way_anti_bounce_back"; - static constexpr saw::string_literal after = ""; - static constexpr saw::string_literal before = "streaming"; - - /** - * Raw setup - */ - template - void apply(const saw::data& field, const saw::data>& index, saw::data time_step)const{ - bool is_even = ((time_step.get() % 2u) == 0u); - - // This is a ref - - // auto& dfs_f = (is_even) ? field.template get<"dfs">() : field.template get<"dfs_old">(); - auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); - - using dfi = df_info; - - // Technically use .copy() - auto& dfs_old = dfs_old_f.at(index); - auto df_cpy = dfs_old; - - static_assert(Descriptor::D == 2u and Descriptor::Q == 9u, "Some parts are hard coded sadly"); - - dfs_old.at({0u}) = df_cpy.at({0u}); - dfs_old.at({1u}) = df_cpy.at({1u}); - dfs_old.at({2u}) = df_cpy.at({2u}); - dfs_old.at({3u}) = df_cpy.at({4u}); - dfs_old.at({4u}) = df_cpy.at({3u}); - dfs_old.at({5u}) = df_cpy.at({7u}); - dfs_old.at({6u}) = df_cpy.at({8u}); - dfs_old.at({7u}) = df_cpy.at({5u}); - dfs_old.at({8u}) = df_cpy.at({6u}); - } -}; - -template -class component final { -private: - saw::data> density_; - saw::data> velocity_; -public: - component( - saw::data> density__, - saw::data> velocity__ - ): - density_{density__}, - velocity_{velocity__} - {} - - template - void apply(const saw::data& field, const saw::data>& index, saw::data time_step) const { - - bool is_even = ((time_step.get() % 2u) == 0u); - using dfi = df_info; - - auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); - - auto eq = equilibrium(density_,velocity_); - - dfs_old_f.at(index) = eq; - } -}; - -/** - * This is massively hacky and expects a lot of conditions - * Either this or mirrored along the horizontal line works - * - * 0 - 2 - 2 - * 0 - 3 - 1 - * 0 - 3 - 1 - * ......... - * 0 - 3 - 1 - * 0 - 2 - 2 - * - */ -template -class component, Encode> final { -private: - saw::data rho_setting_; -public: - component(const saw::data& rho_setting__): - rho_setting_{rho_setting__} - {} - - template - void apply(const saw::data& field, saw::data> index, saw::data time_step) const { - using dfi = df_info; - - bool is_even = ((time_step.get() % 2) == 0); - - auto& info_f = field.template get<"info">(); - - // auto& dfs_f = (is_even) ? field.template get<"dfs">() : field.template get<"dfs_old">(); - auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); - - auto& dfs_old = dfs_old_f.at(index); - - auto rho_vel_x = [&]() -> saw::data { - if constexpr (Dir){ - auto S = dfs_old.at({0u}) - + dfs_old.at({3u}) + dfs_old.at({4u}) - + (dfs_old.at({1u}) + dfs_old.at({5u}) + dfs_old.at({7u})) * 2u; - return rho_setting_ - S; - } - else if constexpr (not Dir) { - auto S = dfs_old.at({0u}) - + dfs_old.at({3u}) + dfs_old.at({4u}) - + (dfs_old.at({2u}) + dfs_old.at({6u}) + dfs_old.at({8u})) * 2u; - return S - rho_setting_; - } - return {}; - }(); - - static_assert(Descriptor::D == 2u and Descriptor::Q == 9u, "Some parts are hard coded sadly"); - - if constexpr (Dir) { - dfs_old.at({2u}) = dfs_old.at({1u}) + saw::data{2.0 / 3.0} * rho_vel_x; - dfs_old.at({6u}) = dfs_old.at({5u}) + saw::data{1.0 / 6.0} * rho_vel_x + saw::data{0.5} * (dfs_old.at({3u}) - dfs_old.at({4u})); - dfs_old.at({8u}) = dfs_old.at({7u}) + saw::data{1.0 / 6.0} * rho_vel_x + saw::data{0.5} * (dfs_old.at({4u}) - dfs_old.at({3u})); - }else if constexpr (not Dir){ - dfs_old.at({1u}) = dfs_old.at({2u}) - saw::data{2.0 / 3.0} * rho_vel_x; - dfs_old.at({5u}) = dfs_old.at({6u}) - saw::data{1.0 / 6.0} * rho_vel_x + saw::data{0.5} * (dfs_old.at({4u}) - dfs_old.at({3u})); - dfs_old.at({7u}) = dfs_old.at({8u}) - saw::data{1.0 / 6.0} * rho_vel_x + saw::data{0.5} * (dfs_old.at({3u}) - dfs_old.at({4u})); - } - } -}; - -/* -template -class component, Encode> final { -private: - saw::data> velocity_; -public: - component( - saw::data> velocity__ - ): - velocity_{velocity__} - {} - - template - void apply(const saw::data& field, const saw::data>& index, saw::data time_step) const { - - bool is_even = ((time_step.get() % 2u) == 0u); - using dfi = df_info; - - auto& dfs_old_f = (is_even) ? field.template get<"dfs_old">() : field.template get<"dfs">(); - - } -}; -*/ - -} -} -- cgit v1.2.3