Skip to content
Snippets Groups Projects
Commit d0064ffb authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'dtype-for-add_arrays' into 'master'

Add dtype to DataHandling.add_arrays

See merge request !124
parents 99d4b9fc 245e8331
Branches
Tags
No related merge requests found
...@@ -62,7 +62,7 @@ class DataHandling(ABC): ...@@ -62,7 +62,7 @@ class DataHandling(ABC):
pystencils field, that can be used to formulate symbolic kernels 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` """Adds multiple arrays using a string description similar to :func:`pystencils.fields`
...@@ -77,6 +77,7 @@ class DataHandling(ABC): ...@@ -77,6 +77,7 @@ class DataHandling(ABC):
Args: Args:
description (str): String description of the fields to add description (str): String description of the fields to add
dtype: data type of the array as numpy data type
Returns: Returns:
Fields representing the just created arrays Fields representing the just created arrays
""" """
...@@ -85,7 +86,7 @@ class DataHandling(ABC): ...@@ -85,7 +86,7 @@ class DataHandling(ABC):
names = [] names = []
for name, indices in _parse_part1(description): for name, indices in _parse_part1(description):
names.append(name) 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) return (self.fields[n] for n in names)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment