From 7fdbe2c2d768faaee3c41b25a501127b5529198e Mon Sep 17 00:00:00 2001
From: clienhar <lienhard@mpq-garching.mpg.de>
Date: Tue, 11 Sep 2018 14:27:39 +0200
Subject: [PATCH] added any() and all() methods to MultiField

not sure if and how the spaces parameter should be passed somehow
---
 nifty4/multi/multi_field.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/nifty4/multi/multi_field.py b/nifty4/multi/multi_field.py
index 9d52cc861..e806f65ec 100644
--- a/nifty4/multi/multi_field.py
+++ b/nifty4/multi/multi_field.py
@@ -160,6 +160,18 @@ class MultiField(object):
                 return False
         return True
 
+    def any(self):
+        result = False
+        for field in self._val.values():
+            result = result or field.any()
+        return result
+
+    def all(self):
+        result = True
+        for field in self._val.values():
+            result = result and field.all()
+        return result
+
 for op in ["__add__", "__radd__", "__iadd__",
            "__sub__", "__rsub__", "__isub__",
            "__mul__", "__rmul__", "__imul__",
-- 
GitLab