From 245e83311c7a9de4b654fd2c587cd72178d0d881 Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Wed, 15 Jan 2020 12:31:53 +0100 Subject: [PATCH] Add dtype to DataHandling.add_arrays --- pystencils/datahandling/datahandling_interface.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pystencils/datahandling/datahandling_interface.py b/pystencils/datahandling/datahandling_interface.py index 84e31d365..75586f637 100644 --- a/pystencils/datahandling/datahandling_interface.py +++ b/pystencils/datahandling/datahandling_interface.py @@ -62,7 +62,7 @@ class DataHandling(ABC): pystencils field, that can be used to formulate symbolic kernels """ - def add_arrays(self, description: str) -> Tuple[Field]: + def add_arrays(self, description: str, dtype=np.float64) -> Tuple[Field]: """Adds multiple arrays using a string description similar to :func:`pystencils.fields` @@ -77,6 +77,7 @@ class DataHandling(ABC): Args: description (str): String description of the fields to add + dtype: data type of the array as numpy data type Returns: Fields representing the just created arrays """ @@ -85,7 +86,7 @@ class DataHandling(ABC): names = [] for name, indices in _parse_part1(description): names.append(name) - self.add_array(name, values_per_cell=indices) + self.add_array(name, values_per_cell=indices, dtype=dtype) return (self.fields[n] for n in names) -- GitLab