From 8975c76406bf328af54898d23be66b950b35a7e5 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Wed, 6 May 2020 10:04:05 +0200 Subject: [PATCH] [BUGFIX] disallow bool as particle property type since std::vector<bool> behaves differently to std::vector using bool can cause troubles --- python/mesa_pd/data/ParticleStorage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/mesa_pd/data/ParticleStorage.py b/python/mesa_pd/data/ParticleStorage.py index 61264f240..65193bab2 100644 --- a/python/mesa_pd/data/ParticleStorage.py +++ b/python/mesa_pd/data/ParticleStorage.py @@ -26,6 +26,10 @@ def create_particle_property(name, type, access="grs", defValue="", syncMode="AL 'ALWAYS', this property has to be synced in every iteration """ + if (type == 'bool'): + raise RuntimeError(f"Due to flaws in the implementation of std::vector<bool>, bool is not supported as a " + f"property type! Please use char instead.") + # sort access specifier and remove duplicates foo = "".join(sorted(access)) access = ''.join([foo[i] for i in range(len(foo) - 1) if foo[i + 1] != foo[i]] + [foo[-1]]) -- GitLab