From b79e5cf1a3c07cad4edcad2c909318a5a5b6115e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 5 Feb 2026 18:05:18 +0100 Subject: Fixing boundary conditions --- lib/core/c++/write_vtk.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/core/c++/write_vtk.hpp') diff --git a/lib/core/c++/write_vtk.hpp b/lib/core/c++/write_vtk.hpp index 3c60a66..751ec50 100644 --- a/lib/core/c++/write_vtk.hpp +++ b/lib/core/c++/write_vtk.hpp @@ -67,12 +67,14 @@ struct lbm_vtk_writer> { template struct lbm_vtk_writer> { + template static saw::error_or apply_d(std::ostream& vtk_file, const saw::data>& field, saw::data>& index){ - - if constexpr ( d < sizeof...(D)){ - for(index.at({d}) = 0u; index.at({d}) < field.get_dims().at({d}); ++index.at({d})){ - auto eov = apply_d(vtk_file, field, index); + // VTK wants to iterate over z,y,x instead of x,y,z + // We could reorder the dimensions, but eh + if constexpr ( d > 0u){ + for(index.at({d-1u}) = 0u; index.at({d-1u}) < field.get_dims().at({d-1u}); ++index.at({d-1u})){ + auto eov = apply_d(vtk_file, field, index); } }else{ auto eov = lbm_vtk_writer::apply(vtk_file, field.at(index)); @@ -94,7 +96,7 @@ struct lbm_vtk_writer> { } { - auto eov = apply_d<0u>(vtk_file, field, index); + auto eov = apply_d(vtk_file, field, index); if(eov.is_error()){ return eov; } -- cgit v1.2.3