From 18ab6246aef41a84e47bec5c947b9535718f9653 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Fri, 2 Aug 2019 18:20:21 +0200
Subject: [PATCH] Implement TypedSymbol.is_integer

---
 pystencils/data_types.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pystencils/data_types.py b/pystencils/data_types.py
index 8bf28e777..e4c6723e2 100644
--- a/pystencils/data_types.py
+++ b/pystencils/data_types.py
@@ -127,6 +127,13 @@ class TypedSymbol(sp.Symbol):
     def __getnewargs__(self):
         return self.name, self.dtype
 
+    @property
+    def is_integer(self):
+        if hasattr(self.dtype, 'numpy_dtype'):
+            return np.issubdtype(self.dtype.numpy_dtype, np.integer)
+        else:
+            return False
+
 
 def create_type(specification):
     """Creates a subclass of Type according to a string or an object of subclass Type.
-- 
GitLab