From dc01a9e71f40bfc235819b5ecf52ebaf0468b0a4 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Mon, 11 Jun 2018 15:05:51 +0200 Subject: [PATCH] [API] removed contacts from RigidBody --- src/pe/contact/Contact.cpp | 9 --- src/pe/cr/DEM.impl.h | 9 +-- src/pe/cr/HCSITS.impl.h | 4 - src/pe/cr/PlainIntegrator.impl.h | 4 - src/pe/rigidbody/RigidBody.cpp | 1 - src/pe/rigidbody/RigidBody.h | 130 ------------------------------- tests/pe/RigidBody.cpp | 4 - 7 files changed, 2 insertions(+), 159 deletions(-) diff --git a/src/pe/contact/Contact.cpp b/src/pe/contact/Contact.cpp index ed9e68e28..7bc7dc041 100644 --- a/src/pe/contact/Contact.cpp +++ b/src/pe/contact/Contact.cpp @@ -62,17 +62,8 @@ Contact::Contact( GeomID g1, GeomID g2, const Vec3& gpos, const Vec3& normal, re WALBERLA_ASSERT_FLOAT_EQUAL( normal.sqrLength(), real_c(1), "Invalid contact normal\n" << g1 << "\n" << g2 ); WALBERLA_ASSERT( !( b1_->hasInfiniteMass() && b2_->hasInfiniteMass() ), "Invalid contact between two rigid bodies with infinite masses" ); - // Registering the contact with both attached rigid bodies -// if( !b1_->hasInfiniteMass() ) b1_->registerContact( this ); -// if( !b2_->hasInfiniteMass() ) b2_->registerContact( this ); - - // Merging the contact graph -// if( !b1_->hasInfiniteMass() && !b2_->hasInfiniteMass() ) -// mergeNodes( b1_, b2_ ); - // Debugging output WALBERLA_LOG_DETAIL( " => contact-id = " << id_ ); - } //************************************************************************************************* diff --git a/src/pe/cr/DEM.impl.h b/src/pe/cr/DEM.impl.h index afb7debf6..a3560e50f 100644 --- a/src/pe/cr/DEM.impl.h +++ b/src/pe/cr/DEM.impl.h @@ -120,10 +120,6 @@ void DEMSolver<Integrator,ContactResolver>::timestep( real_t dt ) { WALBERLA_LOG_DETAIL( "Time integration of body with system id " << bodyIt->getSystemID());// << "\n" << *bodyIt ); - // Resetting the contact node and removing all attached contacts - // bodyIt->resetNode(); - bodyIt->clearContacts(); - // Checking the state of the body WALBERLA_ASSERT( bodyIt->checkInvariants(), "Invalid body state detected" ); WALBERLA_ASSERT( !bodyIt->hasSuperBody(), "Invalid superordinate body detected" ); @@ -147,9 +143,8 @@ void DEMSolver<Integrator,ContactResolver>::timestep( real_t dt ) if (tt_ != NULL) tt_->stop("Integration"); // Reset forces of shadow copies - for( auto bodyIt = shadowStorage.begin(); bodyIt != shadowStorage.end(); ++bodyIt ) { - bodyIt->clearContacts(); - bodyIt->resetForceAndTorque(); + for( auto& body : shadowStorage ) { + body.resetForceAndTorque(); } } diff --git a/src/pe/cr/HCSITS.impl.h b/src/pe/cr/HCSITS.impl.h index 7046d8a8e..a6d6258b5 100644 --- a/src/pe/cr/HCSITS.impl.h +++ b/src/pe/cr/HCSITS.impl.h @@ -1795,10 +1795,6 @@ inline void HardContactSemiImplicitTimesteppingSolvers::integratePositions( Body if ( body->isFixed() ) return; - // Resetting the contact node and removing all attached contacts - body->resetNode(); - body->clearContacts(); - if( body->isAwake() ) { if ( isSpeedLimiterActive() ) diff --git a/src/pe/cr/PlainIntegrator.impl.h b/src/pe/cr/PlainIntegrator.impl.h index 79c401060..e2a45b2f8 100644 --- a/src/pe/cr/PlainIntegrator.impl.h +++ b/src/pe/cr/PlainIntegrator.impl.h @@ -68,10 +68,6 @@ void PlainIntegratorSolver<Integrator>::timestep( const real_t dt ) WALBERLA_ASSERT( bd->checkInvariants(), "Invalid body state detected" ); WALBERLA_ASSERT( !bd->hasSuperBody(), "Invalid superordinate body detected" ); - // Resetting the contact node and removing all attached contacts - // bd->resetNode(); - bd->clearContacts(); - // Moving the body according to the acting forces (don't move a sleeping body) if( bd->isAwake() && !bd->hasInfiniteMass() ) { integrate_( bd.getBodyID(), dt, *this ); diff --git a/src/pe/rigidbody/RigidBody.cpp b/src/pe/rigidbody/RigidBody.cpp index 45d40109e..eb57563de 100644 --- a/src/pe/rigidbody/RigidBody.cpp +++ b/src/pe/rigidbody/RigidBody.cpp @@ -57,7 +57,6 @@ RigidBody::RigidBody( id_t const typeID, id_t sid, id_t uid ) , toBeDeleted_(false) // deletion flag , sid_ (sid) // System-specific body index , uid_ (uid) // User-specific body ID - , contacts_() // Vector of the currently attached contacts , typeID_(typeID) // geometry type { sb_ = this; // The superordinate rigid body diff --git a/src/pe/rigidbody/RigidBody.h b/src/pe/rigidbody/RigidBody.h index aa2dcc324..69033ffe9 100644 --- a/src/pe/rigidbody/RigidBody.h +++ b/src/pe/rigidbody/RigidBody.h @@ -57,15 +57,6 @@ private: template <typename BodyTypeTuple> friend class Union; - //**Type definitions**************************************************************************** - typedef PtrVector<Contact,NoDelete> Contacts; //!< Vector for attached contacts. - //********************************************************************************************** - -public: - //**Type definitions**************************************************************************** - typedef Contacts::Iterator ContactIterator; //!< Iterator over the currently attached contacts. - typedef Contacts::ConstIterator ConstContactIterator; //!< ConstIterator over the currently attached contacts. - //********************************************************************************************** protected: //**Constructor********************************************************************************* /*!\name Constructor */ @@ -268,20 +259,6 @@ public: //@} //********************************************************************************************** - //**Contact functions*************************************************************************** - /*!\name Contact functions */ - //@{ - inline void registerContact( ContactID contact ); - inline bool hasContacts () const; - inline void clearContacts(); - inline size_t countContacts() const; - inline ContactIterator beginContacts(); - inline ConstContactIterator beginContacts() const; - inline ContactIterator endContacts (); - inline ConstContactIterator endContacts () const; - //@} - //********************************************************************************************** - //**MPI functions******************************************************************************* /*!\name MPI functions */ //@{ @@ -435,7 +412,6 @@ protected: bool toBeDeleted_; //!< This flag marks the body for deletion during the next synchronization (only works on local bodies) id_t sid_; //!< The unique system-specific body ID. id_t uid_; //!< The user-specific body ID. - Contacts contacts_; //!< Vector for the currently attached contacts. //@} //********************************************************************************************** @@ -1916,112 +1892,6 @@ inline void RigidBody::signalFixation() -//================================================================================================= -// -// CONTACT FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Registering a single attached contact with the rigid body. - * - * \param contact The contact to be registered with the rigid body. - * \return void - */ -inline void RigidBody::registerContact( ContactID contact ) -{ - WALBERLA_ASSERT( !hasSuperBody(), "Invalid contact on subordinate body detected" ); - contacts_.pushBack( contact ); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Clears all contacts registered with the rigid body. - * - * \return void - */ -inline void RigidBody::clearContacts() -{ - contacts_.clear(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns whether any contacts are registered with the rigid body. - * - * \return \a true if at least one contact is registered with the rigid body, \a false if not. - */ -inline bool RigidBody::hasContacts() const -{ - return !contacts_.isEmpty(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns the number of currently registered contacts. - * - * \return The number of registered contacts. - */ -inline size_t RigidBody::countContacts() const -{ - return contacts_.size(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator to the first attached contact. - * - * \return Iterator to the first attached contact. - */ -inline RigidBody::ContactIterator RigidBody::beginContacts() -{ - return contacts_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator to the first attached contact. - * - * \return Iterator to the first attached contact. - */ -inline RigidBody::ConstContactIterator RigidBody::beginContacts() const -{ - return contacts_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator just past the last attached contact. - * - * \return Iterator just past the last attached contact. - */ -inline RigidBody::ContactIterator RigidBody::endContacts() -{ - return contacts_.end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator just past the last attached contact. - * - * \return Iterator just past the last attached contact. - */ -inline RigidBody::ConstContactIterator RigidBody::endContacts() const -{ - return contacts_.end(); -} -//************************************************************************************************* - - - - //================================================================================================= // // MPI FUNCTIONS diff --git a/tests/pe/RigidBody.cpp b/tests/pe/RigidBody.cpp index 58926892d..f73aa02ef 100644 --- a/tests/pe/RigidBody.cpp +++ b/tests/pe/RigidBody.cpp @@ -39,10 +39,6 @@ void move( BodyStorage& storage, real_t dt ) WALBERLA_ASSERT( it->checkInvariants(), "Invalid capsule state detected" ); WALBERLA_ASSERT( !it->hasSuperBody(), "Invalid superordinate body detected" ); - // Resetting the contact node and removing all attached contacts -// it->resetNode(); - it->clearContacts(); - // Moving the capsule according to the acting forces (don't move a sleeping body) if( it->isAwake() ) { if( !it->hasInfiniteMass() ) { -- GitLab