From bfc5f97de2e228f2e7fbe10c01da687e574039dc Mon Sep 17 00:00:00 2001
From: Sebastian Eibl <sebastian.eibl@fau.de>
Date: Mon, 10 Apr 2017 14:45:55 +0200
Subject: [PATCH] added assert to check if StaticTypeIDs are initialized

---
 src/pe/rigidbody/BoxFactory.cpp     | 2 ++
 src/pe/rigidbody/CapsuleFactory.cpp | 2 ++
 src/pe/rigidbody/PlaneFactory.cpp   | 2 ++
 src/pe/rigidbody/SphereFactory.cpp  | 1 +
 4 files changed, 7 insertions(+)

diff --git a/src/pe/rigidbody/BoxFactory.cpp b/src/pe/rigidbody/BoxFactory.cpp
index 0a8bb3082..6473eaa18 100644
--- a/src/pe/rigidbody/BoxFactory.cpp
+++ b/src/pe/rigidbody/BoxFactory.cpp
@@ -34,6 +34,8 @@ BoxID createBox(       BodyStorage& globalStorage, BlockStorage& blocks, BlockDa
                        MaterialID material,
                        bool global, bool communicating, bool infiniteMass )
 {
+   WALBERLA_ASSERT_UNEQUAL( Box::getStaticTypeID(), std::numeric_limits<id_t>::max(), "Box TypeID not initalized!");
+
    // Checking the side lengths
    if( lengths[0] <= real_t(0) || lengths[1] <= real_t(0) || lengths[2] <= real_t(0) )
       throw std::invalid_argument( "Invalid side length" );
diff --git a/src/pe/rigidbody/CapsuleFactory.cpp b/src/pe/rigidbody/CapsuleFactory.cpp
index 75393bb46..44b7839d1 100644
--- a/src/pe/rigidbody/CapsuleFactory.cpp
+++ b/src/pe/rigidbody/CapsuleFactory.cpp
@@ -34,6 +34,8 @@ CapsuleID createCapsule(   BodyStorage& globalStorage, BlockStorage& blocks, Blo
                            MaterialID material,
                            bool global, bool communicating, bool infiniteMass )
 {
+   WALBERLA_ASSERT_UNEQUAL( Capsule::getStaticTypeID(), std::numeric_limits<id_t>::max(), "Capsule TypeID not initalized!");
+
    // Checking the radius and the length
    WALBERLA_ASSERT_GREATER( radius, real_t(0), "Invalid capsule radius" );
    WALBERLA_ASSERT_GREATER( length, real_t(0), "Invalid capsule length" );
diff --git a/src/pe/rigidbody/PlaneFactory.cpp b/src/pe/rigidbody/PlaneFactory.cpp
index cc5377452..f1bee615c 100644
--- a/src/pe/rigidbody/PlaneFactory.cpp
+++ b/src/pe/rigidbody/PlaneFactory.cpp
@@ -33,6 +33,8 @@ namespace pe {
 
 PlaneID createPlane( BodyStorage& globalStorage, id_t uid, Vec3 normal, const Vec3& gpos, MaterialID material)
 {
+   WALBERLA_ASSERT_UNEQUAL( Plane::getStaticTypeID(), std::numeric_limits<id_t>::max(), "Plane TypeID not initalized!");
+
    // Checking the normal of the plane
    if( floatIsEqual(normal.sqrLength(), real_c(0) ) )
       throw std::invalid_argument( "Invalid plane normal!" );
diff --git a/src/pe/rigidbody/SphereFactory.cpp b/src/pe/rigidbody/SphereFactory.cpp
index 92edd0b05..c9487031d 100644
--- a/src/pe/rigidbody/SphereFactory.cpp
+++ b/src/pe/rigidbody/SphereFactory.cpp
@@ -34,6 +34,7 @@ SphereID createSphere( BodyStorage& globalStorage, BlockStorage& blocks, BlockDa
                        MaterialID material,
                        bool global, bool communicating, bool infiniteMass )
 {
+   WALBERLA_ASSERT_UNEQUAL( Sphere::getStaticTypeID(), std::numeric_limits<id_t>::max(), "Sphere TypeID not initalized!");
    // Checking the radius
    if( radius <= real_c(0) )
       throw std::invalid_argument( "Invalid sphere radius" );
-- 
GitLab