diff --git a/pystencils/gpucuda/kernelcreation.py b/pystencils/gpucuda/kernelcreation.py index eecfe278e4378cdbed8738275d2cfe813d350d7b..d002cb0f050c0faaa9ea987d49ff7d0385df7cbe 100644 --- a/pystencils/gpucuda/kernelcreation.py +++ b/pystencils/gpucuda/kernelcreation.py @@ -16,6 +16,7 @@ def create_cuda_kernel(assignments, ghost_layers=None, skip_independence_check=False, use_textures_for_interpolation=True): + assert assignments, "Assignments must not be empty!" fields_read, fields_written, assignments = add_types(assignments, type_info, not skip_independence_check) all_fields = fields_read.union(fields_written) read_only_fields = set([f.name for f in fields_read - fields_written]) diff --git a/pystencils/kernelcreation.py b/pystencils/kernelcreation.py index 408cc506b56f1da5c42522d24e28b7a902f391ad..555196a623ce61fcfd2a9a40272f06c27fb70e54 100644 --- a/pystencils/kernelcreation.py +++ b/pystencils/kernelcreation.py @@ -1,5 +1,5 @@ -from types import MappingProxyType from itertools import combinations +from types import MappingProxyType import sympy as sp @@ -74,6 +74,7 @@ def create_kernel(assignments, [0., 0., 0., 0., 0.]]) """ # ---- Normalizing parameters + assert assignments, "Assignments must not be empty!" split_groups = () if isinstance(assignments, AssignmentCollection): if 'split_groups' in assignments.simplification_hints: diff --git a/pystencils/simp/assignment_collection.py b/pystencils/simp/assignment_collection.py index bf4074ed9287d5c9c77ef4776c62ceb1e4ffff4b..e4827cdbc09ccc8c6f692b86c64970e1f2b90983 100644 --- a/pystencils/simp/assignment_collection.py +++ b/pystencils/simp/assignment_collection.py @@ -404,6 +404,9 @@ class AssignmentCollection: def __eq__(self, other): return set(self.all_assignments) == set(other.all_assignments) + def __bool__(self): + return bool(self.all_assignments) + class SymbolGen: """Default symbol generator producing number symbols ζ_0, ζ_1, ..."""