From 869974982752cd37e808283af629ea0bbb680393 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 11 Jul 2025 14:14:36 +0200 Subject: Writing was flipped on non square, cubic domains --- c++/descriptor.hpp | 1 + c++/geometry.hpp | 2 ++ c++/iterator.hpp | 14 ++++++++++++++ c++/lbm.hpp | 1 + c++/write_vtk.hpp | 10 +++++----- 5 files changed, 23 insertions(+), 5 deletions(-) (limited to 'c++') diff --git a/c++/descriptor.hpp b/c++/descriptor.hpp index 23c82f2..0d05a04 100644 --- a/c++/descriptor.hpp +++ b/c++/descriptor.hpp @@ -202,6 +202,7 @@ public: data& operator()(const data& index){ return inner_.at(index); } + const data& operator()(const data& index)const{ return inner_.at(index); } diff --git a/c++/geometry.hpp b/c++/geometry.hpp index fe0fe7e..9802feb 100644 --- a/c++/geometry.hpp +++ b/c++/geometry.hpp @@ -2,11 +2,13 @@ namespace kel { namespace lbm { +/* template struct geometry { void apply(const saw::data& field, const saw::data>& start, const saw::data>& end, const saw::data& type){ } }; +*/ } } diff --git a/c++/iterator.hpp b/c++/iterator.hpp index fcc50bc..78babff 100644 --- a/c++/iterator.hpp +++ b/c++/iterator.hpp @@ -14,5 +14,19 @@ void iterate_over(Func&& func, const saw::data>& } return; } +/* Ambiguous +template +void iterate_over(Func&& func, const saw::data>& start, const saw::data>& end, const saw::data>& dist = {{{0u,0u,0u}}}){ + // static_assert(D == 2u, "Currently a lazy implementation for AND combinations of intervalls."); + for(saw::data i{start.at({0u}) + dist.at({0u})}; (i+dist.at({0u})) < end.at({0u}); ++i){ + for(saw::data j{start.at({1u}) + dist.at({1u})}; (j+dist.at({1u})) < end.at({1u}); ++j){ + for(saw::data k{start.at({2u}) + dist.at({2u})}; (j+dist.at({2u})) < end.at({2u}); ++j){ + func({{k,j,i}}); + } + } + } + return; +} +*/ } } diff --git a/c++/lbm.hpp b/c++/lbm.hpp index d331c6a..6bcd1e7 100644 --- a/c++/lbm.hpp +++ b/c++/lbm.hpp @@ -5,6 +5,7 @@ #include "config.hpp" #include "component.hpp" #include "equilibrium.hpp" +#include "macroscopic.hpp" #include "write_vtk.hpp" #include diff --git a/c++/write_vtk.hpp b/c++/write_vtk.hpp index 5cbc6c0..40597fd 100644 --- a/c++/write_vtk.hpp +++ b/c++/write_vtk.hpp @@ -62,13 +62,13 @@ struct lbm_vtk_writer...> , constexpr auto Lit = saw::parameter_key_pack_type::literal; using Type = typename saw::parameter_pack_type::type; - if constexpr (Dep == Dim){ + if constexpr (Dep == 0u){ return lbm_vtk_writer::apply(vtk_file, field.at(index).template get()); } else { // Dep < Dim // I hope - static_assert(Dep < Dim, "Don't fall into this case"); - for(index.at({Dep}) = 0; index.at({Dep}) < field.get_dims().at({Dep}); ++index.at({Dep})){ - auto eov = write_i_iterate_d(vtk_file, field, index); + static_assert(Dep > 0u, "Don't fall into this case"); + for(index.at({Dep-1u}) = 0; index.at({Dep-1u}) < field.get_dims().at({Dep-1u}); ++index.at({Dep-1u})){ + auto eov = write_i_iterate_d(vtk_file, field, index); if(eov.is_error()){ return eov; } @@ -95,7 +95,7 @@ struct lbm_vtk_writer...> , } } - return write_i_iterate_d(vtk_file, field, index); + return write_i_iterate_d(vtk_file, field, index); } template -- cgit v1.2.3