From fb076cd18daa6e2f24448349d1fffb974c845269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= <jgrad@icp.uni-stuttgart.de> Date: Thu, 4 May 2023 14:55:10 +0200 Subject: [PATCH] Fix boundaries code generation --- python/pystencils_walberla/boundary.py | 2 +- python/pystencils_walberla/templates/Boundary.tmpl.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python/pystencils_walberla/boundary.py b/python/pystencils_walberla/boundary.py index 329b68059..ee035a636 100644 --- a/python/pystencils_walberla/boundary.py +++ b/python/pystencils_walberla/boundary.py @@ -97,7 +97,7 @@ def generate_boundary(generation_context, 'inner_or_boundary': boundary_object.inner_or_boundary, 'single_link': boundary_object.single_link, 'additional_data_handler': additional_data_handler, - 'dtype': "double" if is_float else "float", + 'dtype': "float" if is_float else "double", 'layout': layout } diff --git a/python/pystencils_walberla/templates/Boundary.tmpl.h b/python/pystencils_walberla/templates/Boundary.tmpl.h index 03b403aea..f454a975d 100644 --- a/python/pystencils_walberla/templates/Boundary.tmpl.h +++ b/python/pystencils_walberla/templates/Boundary.tmpl.h @@ -238,10 +238,12 @@ public: {%endif%} {%else%} auto flagWithGLayers = flagField->xyzSizeWithGhostLayer(); + {% if single_link %} {{dtype}} dot = 0.0; {{dtype}} maxn = 0.0; cell_idx_t calculated_idx = 0; cell_idx_t dx = 0; cell_idx_t dy = 0; {%if dim == 3%} cell_idx_t dz = 0; {% endif %} cell_idx_t sum_x = 0; cell_idx_t sum_y = 0; {%if dim == 3%} cell_idx_t sum_z = 0; {%endif %} + {% endif -%} for( auto it = flagField->beginWithGhostLayerXYZ(); it != flagField->end(); ++it ) { {% if single_link -%} -- GitLab