diff options
-rw-r--r-- | c++/descriptor.hpp | 4 | ||||
-rw-r--r-- | tests/descriptor.cpp | 30 | ||||
-rw-r--r-- | tests/equilibrium.cpp | 3 |
3 files changed, 34 insertions, 3 deletions
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<typename T> class df_info<T,sch::Descriptor<2, 5>> { 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<typename T> class df_info<T,sch::Descriptor<2, 9>> { 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 <forstio/test/suite.hpp> + +#include "../c++/descriptor.hpp" + + +namespace { +template<typename Descriptor> +void check_opposite_dirs(){ + using namespace kel; + + using dfi = lbm::df_info<lbm::sch::Float32, Descriptor>; + + 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<lbm::sch::Descriptor<2,5>>(); +} +SAW_TEST("Opposites and Dirs D2Q9"){ + using namespace kel; + check_opposite_dirs<lbm::sch::Descriptor<2,9>>(); +} +} 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 <forstio/test/suite.hpp> - -#include "../c++/descriptor.hpp" |