From 6b1a01d1cbf3809ddcf6bfb14c337d89f6f7c2b5 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 3 Apr 2025 13:13:37 +0200 Subject: Wrote test for opposite index and corresponding dirs --- c++/descriptor.hpp | 4 ++++ tests/descriptor.cpp | 30 ++++++++++++++++++++++++++++++ tests/equilibrium.cpp | 3 --- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 tests/descriptor.cpp delete mode 100644 tests/equilibrium.cpp diff --git a/c++/descriptor.hpp b/c++/descriptor.hpp index 8c0036a..5ee9918 100644 --- a/c++/descriptor.hpp +++ b/c++/descriptor.hpp @@ -41,6 +41,8 @@ class df_info{}; template class df_info> { public: + using Descriptor = sch::Descriptor<2,5>; + static constexpr uint64_t D = 2u; static constexpr uint64_t Q = 5u; @@ -75,6 +77,8 @@ public: template class df_info> { public: + using Descriptor = sch::Descriptor<2,9>; + static constexpr uint64_t D = 2u; static constexpr uint64_t Q = 9u; diff --git a/tests/descriptor.cpp b/tests/descriptor.cpp new file mode 100644 index 0000000..5e23ebc --- /dev/null +++ b/tests/descriptor.cpp @@ -0,0 +1,30 @@ +#include + +#include "../c++/descriptor.hpp" + + +namespace { +template +void check_opposite_dirs(){ + using namespace kel; + + using dfi = lbm::df_info; + + for(uint64_t k = 0u; k < Descriptor::Q; ++k){ + auto k_inv = dfi::opposite_index[k]; + + for(uint64_t i = 0u; i < Descriptor::D; ++i){ + SAW_EXPECT(dfi::directions[k][i] == (-1*dfi::directions[k_inv][i]), "Opposites are inconsistent"); + } + } +} + +SAW_TEST("Opposites and Dirs D2Q5"){ + using namespace kel; + check_opposite_dirs>(); +} +SAW_TEST("Opposites and Dirs D2Q9"){ + using namespace kel; + check_opposite_dirs>(); +} +} diff --git a/tests/equilibrium.cpp b/tests/equilibrium.cpp deleted file mode 100644 index 8d53125..0000000 --- a/tests/equilibrium.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include - -#include "../c++/descriptor.hpp" -- cgit v1.2.3