From ba9c23e4177ab9309f69155601578b118b2fd782 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Wed, 4 Feb 2026 16:28:48 +0100 Subject: Weird missing vtk writes --- lib/core/c++/collision.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/core/c++/collision.hpp') diff --git a/lib/core/c++/collision.hpp b/lib/core/c++/collision.hpp index ed26a08..a05e263 100644 --- a/lib/core/c++/collision.hpp +++ b/lib/core/c++/collision.hpp @@ -61,6 +61,28 @@ public: dfs_old_f.at(index).at({i}) = dfs_old_f.at(index).at({i}) + frequency_ * (eq.at(i) - dfs_old_f.at(index).at({i})); } } + + template + void apply(const saw::data& field, const saw::data& macros, saw::data> index, saw::data time_step) const { + bool is_even = ((time_step.get() % 2) == 0); + + // 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& rho_f = macros.template get<"density">(); + auto& vel_f = macros.template get<"velocity">(); + + saw::data>& rho = rho_f.at(index); + saw::data>& vel = vel_f.at(index); + + compute_rho_u(dfs_old_f.at(index),rho,vel); + + auto eq = equilibrium(rho,vel); + + for(uint64_t i = 0u; i < Descriptor::Q; ++i){ + dfs_old_f.at(index).at({i}) = dfs_old_f.at(index).at({i}) + frequency_ * (eq.at(i) - dfs_old_f.at(index).at({i})); + } + } }; template -- cgit v1.2.3