Skip to content
Snippets Groups Projects
Commit bd03d2d3 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

pe_coupling geometry: squirmers are spheres too

parent 3ebfa15a
No related merge requests found
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "pe/rigidbody/RigidBody.h" #include "pe/rigidbody/RigidBody.h"
#include "pe/rigidbody/Sphere.h" #include "pe/rigidbody/Sphere.h"
#include "pe/rigidbody/Plane.h" #include "pe/rigidbody/Plane.h"
#include "pe/rigidbody/Squirmer.h"
namespace walberla { namespace walberla {
namespace geometry { namespace geometry {
...@@ -83,6 +84,21 @@ template<> inline bool contains( const pe::Sphere & peSphere, const Vector3<real ...@@ -83,6 +84,21 @@ template<> inline bool contains( const pe::Sphere & peSphere, const Vector3<real
return peSphere.containsPoint( point[0], point[1], point[2] ); return peSphere.containsPoint( point[0], point[1], point[2] );
} }
template<> inline FastOverlapResult fastOverlapCheck( const pe::Squirmer & peSquirmer, const AABB & box )
{
return fastOverlapCheck( static_cast<const pe::Sphere &>(peSquirmer), box );
}
template<> inline FastOverlapResult fastOverlapCheck( const pe::Squirmer & peSquirmer, const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx )
{
return fastOverlapCheck( static_cast<const pe::Sphere &>(peSquirmer), cellMidpoint, dx );
}
template<> inline bool contains( const pe::Squirmer & peSquirmer, const Vector3<real_t> & point )
{
return contains( static_cast<const pe::Sphere &>(peSquirmer), point );
}
///////////////////////////////////////////////// /////////////////////////////////////////////////
// specialization for pe::Plane // // specialization for pe::Plane //
///////////////////////////////////////////////// /////////////////////////////////////////////////
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "pe/rigidbody/Ellipsoid.h" #include "pe/rigidbody/Ellipsoid.h"
#include "pe/rigidbody/Plane.h" #include "pe/rigidbody/Plane.h"
#include "pe/rigidbody/Sphere.h" #include "pe/rigidbody/Sphere.h"
#include "pe/rigidbody/Squirmer.h"
#include "pe/Types.h" #include "pe/Types.h"
...@@ -52,7 +53,7 @@ inline real_t intersectionRatio( const pe::RigidBody & peRigidBody, ...@@ -52,7 +53,7 @@ inline real_t intersectionRatio( const pe::RigidBody & peRigidBody,
const Vector3<real_t> & direction, const Vector3<real_t> & direction,
const real_t epsilon ) const real_t epsilon )
{ {
if( peRigidBody.getTypeID() == pe::Sphere::getStaticTypeID() ) if( peRigidBody.getTypeID() == pe::Sphere::getStaticTypeID() || peRigidBody.getTypeID() == pe::Squirmer::getStaticTypeID() )
{ {
const pe::Sphere & sphere = static_cast< const pe::Sphere & >( peRigidBody ); const pe::Sphere & sphere = static_cast< const pe::Sphere & >( peRigidBody );
const real_t ratio = intersectionRatioSpherePe( sphere, fluidPoint, direction ); const real_t ratio = intersectionRatioSpherePe( sphere, fluidPoint, direction );
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "pe/rigidbody/RigidBody.h" #include "pe/rigidbody/RigidBody.h"
#include "pe/rigidbody/Sphere.h" #include "pe/rigidbody/Sphere.h"
#include "pe/rigidbody/Squirmer.h"
#include "pe/rigidbody/Plane.h" #include "pe/rigidbody/Plane.h"
#include "PeBodyOverlapFunctions.h" #include "PeBodyOverlapFunctions.h"
...@@ -36,7 +37,7 @@ namespace pe_coupling{ ...@@ -36,7 +37,7 @@ namespace pe_coupling{
real_t overlapFractionPe( const pe::RigidBody & peRigidBody, const Vector3<real_t> & cellMidpoint, real_t overlapFractionPe( const pe::RigidBody & peRigidBody, const Vector3<real_t> & cellMidpoint,
const Vector3<real_t> & dx, uint_t maxDepth=4 ) const Vector3<real_t> & dx, uint_t maxDepth=4 )
{ {
if( peRigidBody.getTypeID() == pe::Sphere::getStaticTypeID() ) if( peRigidBody.getTypeID() == pe::Sphere::getStaticTypeID() || peRigidBody.getTypeID() == pe::Squirmer::getStaticTypeID() )
{ {
const pe::Sphere & sphere = static_cast< const pe::Sphere & >( peRigidBody ); const pe::Sphere & sphere = static_cast< const pe::Sphere & >( peRigidBody );
return geometry::overlapFraction( sphere, cellMidpoint, dx, maxDepth ); return geometry::overlapFraction( sphere, cellMidpoint, dx, maxDepth );
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "pe/rigidbody/RigidBody.h" #include "pe/rigidbody/RigidBody.h"
#include "pe/rigidbody/Sphere.h" #include "pe/rigidbody/Sphere.h"
#include "pe/rigidbody/Squirmer.h"
namespace walberla { namespace walberla {
namespace pe_coupling { namespace pe_coupling {
...@@ -32,7 +33,7 @@ namespace pe_coupling { ...@@ -32,7 +33,7 @@ namespace pe_coupling {
// calculates sphere-equivalent diameter (diameter of a sphere with same volume as given body) // calculates sphere-equivalent diameter (diameter of a sphere with same volume as given body)
real_t getSphereEquivalentDiameter( pe::RigidBody & body ) real_t getSphereEquivalentDiameter( pe::RigidBody & body )
{ {
if( body.getTypeID() == pe::Sphere::getStaticTypeID() ) if( body.getTypeID() == pe::Sphere::getStaticTypeID() || body.getTypeID() == pe::Squirmer::getStaticTypeID() )
{ {
pe::Sphere & sphere = static_cast<pe::Sphere &>( body ); pe::Sphere & sphere = static_cast<pe::Sphere &>( body );
real_t radius = sphere.getRadius(); real_t radius = sphere.getRadius();
......
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