From 63be89c80d52925481db8f1b65206d9173289473 Mon Sep 17 00:00:00 2001
From: markus holzer <markus.holzer@fau.de>
Date: Sun, 30 May 2021 11:05:47 +0200
Subject: [PATCH] revoke changes on flag field

---
 pystencils/boundaries/boundaryhandling.py      |  2 +-
 pystencils/boundaries/createindexlist.py       | 18 +++++++++---------
 .../boundaries/createindexlistcython.pyx       | 16 ++++++++--------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/pystencils/boundaries/boundaryhandling.py b/pystencils/boundaries/boundaryhandling.py
index 7af729ac..a1d23a37 100644
--- a/pystencils/boundaries/boundaryhandling.py
+++ b/pystencils/boundaries/boundaryhandling.py
@@ -22,7 +22,7 @@ try:
 except ImportError:
     ParallelDataHandling = None
 
-DEFAULT_FLAG_TYPE = np.uint64
+DEFAULT_FLAG_TYPE = np.uint32
 
 
 class FlagInterface:
diff --git a/pystencils/boundaries/createindexlist.py b/pystencils/boundaries/createindexlist.py
index 0e23b93e..42a9079c 100644
--- a/pystencils/boundaries/createindexlist.py
+++ b/pystencils/boundaries/createindexlist.py
@@ -28,17 +28,17 @@ boundary_index_array_coordinate_names = ["x", "y", "z"]
 direction_member_name = "dir"
 
 
-def numpy_data_type_for_boundary_object(boundary_object, dim):
+def numpy_data_type_for_boundary_object(boundary_object, dim, data_type=np.int64):
     coordinate_names = boundary_index_array_coordinate_names[:dim]
-    return np.dtype([(name, np.int64) for name in coordinate_names]
-                    + [(direction_member_name, np.int64)]
+    return np.dtype([(name, data_type) for name in coordinate_names]
+                    + [(direction_member_name, data_type)]
                     + [(i[0], i[1].numpy_dtype) for i in boundary_object.additional_data], align=True)
 
 
 def _create_boundary_neighbor_index_list_python(flag_field_arr, nr_of_ghost_layers, boundary_mask,
-                                                fluid_mask, stencil, single_link):
+                                                fluid_mask, stencil, single_link, data_type=np.int64):
     coordinate_names = boundary_index_array_coordinate_names[:len(flag_field_arr.shape)]
-    index_arr_dtype = np.dtype([(name, np.int64) for name in coordinate_names] + [(direction_member_name, np.int64)])
+    index_arr_dtype = np.dtype([(name, data_type) for name in coordinate_names] + [(direction_member_name, data_type)])
 
     result = []
     gl = nr_of_ghost_layers
@@ -57,9 +57,9 @@ def _create_boundary_neighbor_index_list_python(flag_field_arr, nr_of_ghost_laye
 
 
 def _create_boundary_cell_index_list_python(flag_field_arr, boundary_mask,
-                                            fluid_mask, stencil, single_link):
+                                            fluid_mask, stencil, single_link, data_type=np.int64):
     coordinate_names = boundary_index_array_coordinate_names[:len(flag_field_arr.shape)]
-    index_arr_dtype = np.dtype([(name, np.int64) for name in coordinate_names] + [(direction_member_name, np.int64)])
+    index_arr_dtype = np.dtype([(name, data_type) for name in coordinate_names] + [(direction_member_name, data_type)])
 
     result = []
     for cell in itertools.product(*reversed([range(0, i) for i in flag_field_arr.shape])):
@@ -96,9 +96,9 @@ def create_boundary_index_list(flag_field, stencil, boundary_mask, fluid_mask,
     """
     dim = len(flag_field.shape)
     coordinate_names = boundary_index_array_coordinate_names[:dim]
-    index_arr_dtype = np.dtype([(name, np.int64) for name in coordinate_names] + [(direction_member_name, np.int64)])
+    index_arr_dtype = np.dtype([(name, np.int32) for name in coordinate_names] + [(direction_member_name, np.int32)])
 
-    stencil = np.array(stencil, dtype=np.int64)
+    stencil = np.array(stencil, dtype=np.int32)
     args = (flag_field, nr_of_ghost_layers, boundary_mask, fluid_mask, stencil, single_link)
     args_no_gl = (flag_field, boundary_mask, fluid_mask, stencil, single_link)
 
diff --git a/pystencils/boundaries/createindexlistcython.pyx b/pystencils/boundaries/createindexlistcython.pyx
index bf8bc7e4..0931fdc7 100644
--- a/pystencils/boundaries/createindexlistcython.pyx
+++ b/pystencils/boundaries/createindexlistcython.pyx
@@ -19,8 +19,8 @@ ctypedef fused IntegerType:
 def create_boundary_neighbor_index_list_2d(object[IntegerType, ndim=2] flag_field,
                                            int nr_of_ghost_layers, IntegerType boundary_mask, IntegerType fluid_mask,
                                            object[int, ndim=2] stencil, int single_link):
-    cdef long long xs, ys, x, y
-    cdef long long dirIdx, num_directions, dx, dy
+    cdef int xs, ys, x, y
+    cdef int dirIdx, num_directions, dx, dy
 
     xs, ys = flag_field.shape
     boundary_index_list = []
@@ -44,8 +44,8 @@ def create_boundary_neighbor_index_list_2d(object[IntegerType, ndim=2] flag_fiel
 def create_boundary_neighbor_index_list_3d(object[IntegerType, ndim=3] flag_field,
                                            int nr_of_ghost_layers, IntegerType boundary_mask, IntegerType fluid_mask,
                                            object[int, ndim=2] stencil, int single_link):
-    cdef long long xs, ys, zs, x, y, z
-    cdef long long dirIdx, num_directions, dx, dy, dz
+    cdef int xs, ys, zs, x, y, z
+    cdef int dirIdx, num_directions, dx, dy, dz
 
     xs, ys, zs = flag_field.shape
     boundary_index_list = []
@@ -72,8 +72,8 @@ def create_boundary_neighbor_index_list_3d(object[IntegerType, ndim=3] flag_fiel
 def create_boundary_cell_index_list_2d(object[IntegerType, ndim=2] flag_field,
                                        IntegerType boundary_mask, IntegerType fluid_mask,
                                        object[int, ndim=2] stencil, int single_link):
-    cdef long long xs, ys, x, y
-    cdef long long dirIdx, num_directions, dx, dy
+    cdef int xs, ys, x, y
+    cdef int dirIdx, num_directions, dx, dy
 
     xs, ys = flag_field.shape
     boundary_index_list = []
@@ -98,8 +98,8 @@ def create_boundary_cell_index_list_2d(object[IntegerType, ndim=2] flag_field,
 def create_boundary_cell_index_list_3d(object[IntegerType, ndim=3] flag_field,
                                        IntegerType boundary_mask, IntegerType fluid_mask,
                                        object[int, ndim=2] stencil, int single_link):
-    cdef long long xs, ys, zs, x, y, z
-    cdef long long dirIdx, num_directions, dx, dy, dz
+    cdef int xs, ys, zs, x, y, z
+    cdef int dirIdx, num_directions, dx, dy, dz
 
     xs, ys, zs = flag_field.shape
     boundary_index_list = []
-- 
GitLab