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++/macroscopic.hpp | 93 +++----------------------------------------- 1 file changed, 6 insertions(+), 87 deletions(-) (limited to 'lib/core/c++/macroscopic.hpp') diff --git a/lib/core/c++/macroscopic.hpp b/lib/core/c++/macroscopic.hpp index 1532873..19ab3e9 100644 --- a/lib/core/c++/macroscopic.hpp +++ b/lib/core/c++/macroscopic.hpp @@ -4,113 +4,32 @@ namespace kel { namespace lbm { -template -void compute_rho_u ( - const saw::data>& dfs, - saw::data& rho, - saw::data>& vel - ) -{ - using dfi = df_info; - - rho = 0; - for(size_t j = 0; j < Desc::D; ++j){ - vel.at({{j}}).set(0); - } - - for(size_t j = 0; j < Desc::Q; ++j){ - rho = rho + dfs.at({j}); - for(size_t i = 0; i < Desc::D; ++i){ - vel.at({{i}}) = vel.at({{i}}) + dfi::directions[j][i] * dfs.at({j}).get(); - } - } - - for(size_t i = 0; i < Desc::D; ++i){ - vel.at({i}) = vel.at({i}) / rho; - } -} -/** - * Calculate the macroscopic variables rho and u in Lattice Units. - */ -template -void compute_rho_u ( - const saw::data>& dfs, - typename saw::native_data_type::type& rho, - std::array::type, 2>& vel - ) -{ - using dfi = df_info; - - rho = 0; - std::fill(vel.begin(), vel.end(), 0); - - for(size_t j = 0; j < Desc::Q; ++j){ - rho += dfs(j).get(); - for(size_t i = 0; i < Desc::D; ++i){ - vel[i] += dfi::directions[j][i] * dfs(j).get(); - } - } - - for(size_t i = 0; i < Desc::D; ++i){ - vel[i] /= rho; - } -} - /** * Calculate the macroscopic variables rho and u in Lattice Units. */ template void compute_rho_u ( - const saw::data>& dfs, - saw::ref> rho, - saw::ref>> vel - ) -{ - using dfi = df_info; - - rho().set(0); - for(uint64_t i = 0; i < Desc::D; ++i){ - vel().at({i}).set(0); - } - - for(size_t j = 0; j < Desc::Q; ++j){ - rho() = rho() + dfs(j); - for(size_t i = 0; i < Desc::D; ++i){ - vel().at({i}) = vel().at({i}) + saw::data{static_cast::type>(dfi::directions[j][i])} * dfs(j); - } - } - - for(size_t i = 0; i < Desc::D; ++i){ - vel().at({i}) = vel().at({i}) / rho(); - } -} - -/** - * Calculate the macroscopic variables rho and u in Lattice Units. - */ -template -void compute_rho_u ( - const saw::data>& dfs, - saw::ref> rho, + const saw::data>& dfs, + saw::ref>> rho, saw::ref>> vel ) { using dfi = df_info; - rho().set(0); + rho().at({}).set(0); for(uint64_t i = 0; i < Desc::D; ++i){ vel().at({{i}}).set(0); } for(size_t j = 0; j < Desc::Q; ++j){ - rho() = rho() + dfs(j); + rho().at({}) = rho().at({}) + dfs.at({j}); for(size_t i = 0; i < Desc::D; ++i){ - vel().at({{i}}) = vel().at({{i}}) + saw::data{static_cast::type>(dfi::directions[j][i])} * dfs(j); + vel().at({{i}}) = vel().at({{i}}) + saw::data{static_cast::type>(dfi::directions[j][i])} * dfs.at({j}); } } for(size_t i = 0; i < Desc::D; ++i){ - vel().at({{i}}) = vel().at({{i}}) / rho(); + vel().at({{i}}) = vel().at({{i}}) / rho().at({}); } } } -- cgit v1.2.3