From 24bf28a8fb9cc8c3a90b77de9b60728bece7885d Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Sat, 18 Oct 2025 18:01:14 +0200 Subject: Moving project structure for more less compilation --- lib/tests/equilibrium.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/tests/equilibrium.cpp (limited to 'lib/tests/equilibrium.cpp') diff --git a/lib/tests/equilibrium.cpp b/lib/tests/equilibrium.cpp new file mode 100644 index 0000000..9201e55 --- /dev/null +++ b/lib/tests/equilibrium.cpp @@ -0,0 +1,40 @@ +#include + +#include "../c++/equilibrium.hpp" + + +namespace { + +template +void check_equilibrium(){ + using namespace kel; + + using dfi = lbm::df_info; + + saw::data rho{1.0}; + saw::data> vel; + for(saw::data i{0u}; i.get() < Descriptor::D; ++i){ + vel.at(i) = {0.0}; + } + auto eq = lbm::equilibrium(rho,vel); + + for(saw::data i{0u}; i.get() < Descriptor::Q; ++i){ + SAW_EXPECT(eq.at(i).get() == dfi::weights[i.get()], std::string{"No velocity and normalized rho should be exactly the weights: "} + std::to_string(eq.at(i).get()) + std::string{" "} + std::to_string(dfi::weights[i.get()])); + } +} + +SAW_TEST("Equilibrium at rest D1Q3"){ + using namespace kel; + check_equilibrium>(); +} + +SAW_TEST("Equilibrium at rest D2Q5"){ + using namespace kel; + check_equilibrium>(); +} + +SAW_TEST("Equilibrium at rest D2Q9"){ + using namespace kel; + check_equilibrium>(); +} +} -- cgit v1.2.3