From b0a68aba927aaafc97816d18b50b219a595b4dd2 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 18 Apr 2025 16:35:52 +0200 Subject: Compileable state --- c++/descriptor.hpp | 3 +++ c++/macroscopic.hpp | 12 +++++++----- examples/cavity_2d.cpp | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/c++/descriptor.hpp b/c++/descriptor.hpp index aa8c943..b1ee5b1 100644 --- a/c++/descriptor.hpp +++ b/c++/descriptor.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include namespace kel { namespace lbm { @@ -164,10 +165,12 @@ public: factory_struct_{inp} {} + /* template constexpr auto require() const noexcept { return {factory_struct_.add_maybe()}; } + */ }; } diff --git a/c++/macroscopic.hpp b/c++/macroscopic.hpp index 608b89e..43c727b 100644 --- a/c++/macroscopic.hpp +++ b/c++/macroscopic.hpp @@ -1,18 +1,20 @@ #pragma once +#include "descriptor.hpp" + namespace kel { namespace lbm { /** * Calculate the macroscopic variables rho and u in Lattice Units. */ -template +template void compute_rho_u ( - const saw::data>& dfs, - typename saw::native_data_type::type& rho, - std::array::type, 2>& vel + saw::data>& dfs, + typename saw::native_data_type::type& rho, + std::array::type, 2>& vel ) { - using dfi = df_info; + using dfi = df_info; rho = 0; std::fill(vel.begin(), vel.end(), 0); diff --git a/examples/cavity_2d.cpp b/examples/cavity_2d.cpp index 5085635..55223a4 100644 --- a/examples/cavity_2d.cpp +++ b/examples/cavity_2d.cpp @@ -193,7 +193,7 @@ public: void apply(saw::data>& dfs){ typename saw::native_data_type::type rho; std::array::type, Desc::D> vel; - compute_rho_u(dfs,rho,vel); + compute_rho_u(dfs,rho,vel); auto eq = equilibrium(rho,vel); for(uint64_t i = 0u; i < Desc::Q; ++i){ @@ -420,7 +420,7 @@ int main(){ auto& dfs = cell.template get<"dfs">(); typename saw::native_data_type::type rho; std::array::type, sch::D2Q9::D> vel; - compute_rho_u(dfs,rho,vel); + compute_rho_u(dfs,rho,vel); if(i > 1 && (i+2) < dim_x && j > 1 && (j+2) < dim_y){ sum += rho; @@ -517,7 +517,7 @@ int main(){ typename saw::native_data_type::type rho; std::array::type, sch::D2Q9::D> vel; - compute_rho_u(dfs,rho,vel); + compute_rho_u(dfs,rho,vel); vtk_file << static_cast(vel[0u]) << " " << static_cast(vel[1u])<<" 0.0\n"; }, lattice); -- cgit v1.2.3