Skip to content
Snippets Groups Projects
Commit bfc5f97d authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

added assert to check if StaticTypeIDs are initialized

parent def096c5
No related merge requests found
......@@ -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" );
......
......@@ -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" );
......
......@@ -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!" );
......
......@@ -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" );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment