diff --git a/src/pe/attachable/Attachable.cpp b/src/pe/attachable/Attachable.cpp deleted file mode 100644 index 76056d6866479db8625431b72e49b7c87bcc06f8..0000000000000000000000000000000000000000 --- a/src/pe/attachable/Attachable.cpp +++ /dev/null @@ -1,143 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Attachable.cpp -//! \author Klaus Iglberger -//! \author Sebastian Eibl <sebastian.eibl@fau.de> -//! \brief Source file for the Attachable class -// -//====================================================================================================================== - - -//************************************************************************************************* -// Includes -//************************************************************************************************* - -#include <pe/attachable/Attachable.h> -#include <pe/attachable/AttachableStorage.h> -#include <core/DataTypes.h> - -namespace walberla { -namespace pe { - -//================================================================================================= -// -// CONSTRUCTOR -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Constructor of the Attachable class. - * - * \param type The type of the rigid body. - * \param sid The unique system-specific ID of the attachable. - */ -Attachable::Attachable( AttachableType type, id_t sid ) - : type_(type) - , sid_(sid) - , bodies_() -{} -//************************************************************************************************* - - - - -//================================================================================================= -// -// DESTRUCTOR -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Destructor for the Attachable class. - */ -Attachable::~Attachable() -{ -} -//************************************************************************************************* - - - - -//================================================================================================= -// -// MPI FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\fn bool Attachable::isRemote() const - * \brief Returns whether the attachable is remote or not. - * - * \return \a true in case the attachable is remote, \a false if not. - * - * This function returns whether the attachable is remote or not. In case the attachable is - * attached to at least a single local rigid body the function returns \a false. Otherwise - * it returns \a true. - */ -//************************************************************************************************* - - - - -//================================================================================================= -// -// ATTACHABLE SETUP FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Detaches the given attachable. - * - * \param attachable The detachable to be detached. - */ -WALBERLA_PUBLIC void detach( AttachableID attachable ) -{ - ///TDOD REVIEW -// typedef AttachableStorage AS; - - // WARNING: Using friend relationship to get non-constant reference of attachable storage. -// AS& attachablestorage( theCollisionSystem()->attachablestorage_ ); - - // Removing the attachable from the attachable storage -// const AS::Iterator pos( attachablestorage.find( attachable ) ); -// attachablestorage.remove( pos ); - - delete attachable; -} -//************************************************************************************************* - -//************************************************************************************************* -/*!\brief Global output operator for AttachableType. - * - * \param os Reference to the output stream. - * \param type The AttachableType to be put into the stream. - * \return Reference to the output stream. - */ -std::ostream& operator<<( std::ostream& os, Attachable::AttachableType type ) -{ - switch( type ) - { - case Attachable::gravityType: os << "gravity force generator"; break; - case Attachable::springType: os << "spring force generator"; break; - default: WALBERLA_ASSERT( false, "Unknown attachable type" ); break; - } - - return os; -} -//************************************************************************************************* - -} // namespace pe -} // namespace walberla diff --git a/src/pe/attachable/Attachable.h b/src/pe/attachable/Attachable.h deleted file mode 100644 index 9c7b2b368ad9d0377cd3284be39132122cfeb752..0000000000000000000000000000000000000000 --- a/src/pe/attachable/Attachable.h +++ /dev/null @@ -1,264 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Attachable.h -//! \author Klaus Iglberger -//! \author Sebastian Eibl <sebastian.eibl@fau.de> -//! \brief Header file for the Attachable class -// -//====================================================================================================================== - -#pragma once - - -//************************************************************************************************* -// Includes -//************************************************************************************************* - -#include <core/NonCopyable.h> -#include <pe/Types.h> -#include <core/ptrvector/policies/NoDelete.h> -#include <core/ptrvector/PtrVector.h> -#include <pe/Types.h> - -#include "core/UniqueID.h" - -namespace walberla { -namespace pe { - -//================================================================================================= -// -// CLASS DEFINITION -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Attachable interface class. - * - * The Attachable class is the base class for the Attachable concept of the physics engine. - * Classes deriving from this interface class (which are simply called Attachables) can be - * attached to rigid bodies and are notified in case the rigid body is destroyed. This - * concept is for example used for all force generators (see the ForceGenerator class - * description). - */ -class Attachable : private NonCopyable -{ -public: - //************************************************************************************************* - //! Type codes of the attachables. - enum AttachableType { - gravityType = 1, //!< Code for the Gravity force generator. - springType = 2 //!< Code for the Spring force generator. - }; - //************************************************************************************************* -protected: - //**Type definitions**************************************************************************** - typedef PtrVector<RigidBody,NoDelete> Bodies; //!< Vector for attached rigid bodies. - //********************************************************************************************** - - //**Constructor********************************************************************************* - /*!\name Constructor */ - //@{ - explicit Attachable( AttachableType type, id_t sid ); - //@} - //********************************************************************************************** - - //**Destructor********************************************************************************** - /*!\name Destructor */ - //@{ - virtual ~Attachable(); - //@} - //********************************************************************************************** - -public: - - //**Type definitions**************************************************************************** - typedef Bodies::Iterator Iterator; //!< Iterator over the currently attached bodies. - typedef Bodies::ConstIterator ConstIterator; //!< ConstIterator over the currently attached bodies. - //********************************************************************************************** - - //**MPI functions******************************************************************************* - /*!\name MPI functions */ - //@{ - virtual bool isRemote() const = 0; - //@} - //********************************************************************************************** - - //**Get functions******************************************************************************* - /*!\name Get functions */ - //@{ - inline AttachableType getType() const; - inline id_t getSystemID() const; - //@} - //********************************************************************************************** - - //**Utility functions*************************************************************************** - /*!\name Utility functions */ - //@{ - inline Iterator begin(); - inline ConstIterator begin() const; - inline Iterator end (); - inline ConstIterator end () const; - inline size_t size () const; - //@} - //********************************************************************************************** - -protected: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - const AttachableType type_; //!< The type code of the attachable. - id_t sid_; //!< The unique system-specific attachable ID. - Bodies bodies_; //!< Vector of attached rigid bodies. - //@} - //********************************************************************************************** - -private: - //**Attachable setup functions****************************************************************** - /*! \cond internal */ - friend void detach( AttachableID attachable ); - /*! \endcond */ - //********************************************************************************************** -}; -//************************************************************************************************* - - - - -//================================================================================================= -// -// ATTACHABLE SETUP FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\name Attachable setup functions */ -//@{ -void detach( AttachableID attachable ); -//@} -//************************************************************************************************* - -//================================================================================================= -// -// GET FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Returns the type of the attachable. - * - * \return The type of the attachable. - */ -inline Attachable::AttachableType Attachable::getType() const -{ - return type_; -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns the unique system-specific ID of the attachable. - * - * \return The system-specific ID. - */ -inline id_t Attachable::getSystemID() const -{ - return sid_; -} -//************************************************************************************************* - - - - -//================================================================================================= -// -// UTILITY FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Returns an iterator to the first attached rigid body. - * - * \return Iterator to the first attached rigid body. - */ -inline Attachable::Iterator Attachable::begin() -{ - return bodies_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator to the first attached rigid body. - * - * \return Iterator to the first attached rigid body. - */ -inline Attachable::ConstIterator Attachable::begin() const -{ - return bodies_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator just past the last attached rigid body. - * - * \return Iterator just past the last attached rigid body. - */ -inline Attachable::Iterator Attachable::end() -{ - return bodies_.end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator just past the last attached rigid body. - * - * \return Iterator just past the last attached rigid body. - */ -inline Attachable::ConstIterator Attachable::end() const -{ - return bodies_.end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns the number of attached rigid bodies. - * - * \return The number of attached rigid bodies - */ -inline size_t Attachable::size() const -{ - return bodies_.size(); -} -//************************************************************************************************* - -//================================================================================================= -// -// ATTACHABLE TYPE UTILITY FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\name Attachable type utility functions */ -//@{ -std::ostream& operator<<( std::ostream& os, Attachable::AttachableType type ); -//@} -//************************************************************************************************* - -} // namespace pe -} // namespace walberla diff --git a/src/pe/attachable/AttachableCast.h b/src/pe/attachable/AttachableCast.h deleted file mode 100644 index bace6db7f1aa632f16c9d70de8f8ede1f8ffcd49..0000000000000000000000000000000000000000 --- a/src/pe/attachable/AttachableCast.h +++ /dev/null @@ -1,93 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file AttachableCast.h -//! \author Klaus Iglberger -//! \author Sebastian Eibl <sebastian.eibl@fau.de> -// -//====================================================================================================================== - -#pragma once - -#include <boost/type_traits/is_base_of.hpp> - -namespace walberla { -namespace pe { - -//================================================================================================= -// -// ATTACHABLE CAST OPERATORS -// -//================================================================================================= - -//************************************************************************************************* -/*!\name Attachable cast operators */ -//@{ -template< typename To, typename From > inline To* static_attachable_cast( From* attachable ); -template< typename To, typename From > inline To* dynamic_attachable_cast( From* attachable ); -//@} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Static cast for attachables. - * - * \param attachable The attachable to be cast. - * \return The casted attachable. - * - * The static_attachable_cast function is used exactly as the built-in static_cast operator - * but for attachables. - - \code - SphereID sphere = createSphere ( 1, 0.0, 0.0, 0.0, 1.0, iron ); - AttachableID attachable = attachGravity( sphere, 0.0, 0.0, -9.81 ); - GravityID gravity = static_attachable_cast<Gravity>( attachable ); - \endcode - */ -template< typename To, typename From > -inline To* static_attachable_cast( From* attachable ) -{ - static_assert(boost::is_base_of<Attachable, From>::value, "From has to be derived from Attachable!"); - static_assert(boost::is_base_of<Attachable, To>::value, "To has to be derived from Attachable!"); - return static_cast<To*>( attachable ); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Dynamic cast for attachables. - * - * \param attachable The attachable to be cast. - * \return The casted attachable. - * - * The dynamic_attachable_cast function is used exactly as the built-in dynamic_cast operator - * but for attachables. - - \code - AttachableID attachable; - GravityID gravity = dynamic_attachable_cast<Gravity>( attachable ); - \endcode - */ -template< typename To, typename From > -inline To* dynamic_attachable_cast( From* attachable ) -{ - static_assert(boost::is_base_of<Attachable, From>::value, "From has to be derived from Attachable!"); - static_assert(boost::is_base_of<Attachable, To>::value, "To has to be derived from Attachable!"); - return dynamic_cast<To*>( attachable ); -} -//************************************************************************************************* - -} // namespace pe -} diff --git a/src/pe/attachable/AttachableStorage.h b/src/pe/attachable/AttachableStorage.h deleted file mode 100644 index 009c3b087bef8d6556e071306846d210b548dd90..0000000000000000000000000000000000000000 --- a/src/pe/attachable/AttachableStorage.h +++ /dev/null @@ -1,356 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file AttachableStorage.h -//! \author Klaus Iglberger -//! \author Sebastian Eibl <sebastian.eibl@fau.de> -// -//====================================================================================================================== - -#pragma once - - -//************************************************************************************************* -// Includes -//************************************************************************************************* - -#include <algorithm> -#include <functional> -#include <pe/attachable/Attachable.h> -#include <pe/Types.h> -#include <core/ptrvector/policies/NoDelete.h> -#include <core/ptrvector/PtrVector.h> -#include <core/DataTypes.h> -#include <core/debug/Debug.h> - -namespace walberla { -namespace pe { - -//================================================================================================= -// -// CLASS DEFINITION -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Attachable storage of the rigid body simulation world. - * - * The AttachableStorage class stores all currently existing attachables in the simulation world - * (see class World). - */ -class AttachableStorage -{ -private: - //**Type definitions**************************************************************************** - //! Container for the attachables contained in the simulation world. - typedef PtrVector<Attachable,NoDelete> Attachables; - //********************************************************************************************** - -public: - //**Type definitions**************************************************************************** - typedef Attachables::SizeType SizeType; //!< Size type of the attachable storage. - typedef Attachables::Iterator Iterator; //!< Iterator over non-const attachables. - typedef Attachables::ConstIterator ConstIterator; //!< Iterator over constant attachables. - //********************************************************************************************** - - //**Constructors******************************************************************************** - /*!\name Constructors */ - //@{ - explicit inline AttachableStorage( SizeType initCapacity = 100 ); - //@} - //********************************************************************************************** - - //**Utility functions*************************************************************************** - /*!\name Utility functions */ - //@{ - inline bool isEmpty() const; - inline SizeType size () const; - inline Iterator begin (); - inline ConstIterator begin () const; - inline Iterator end (); - inline ConstIterator end () const; - inline Iterator find ( id_t sid ); - inline ConstIterator find ( id_t sid ) const; - inline Iterator find ( ConstAttachableID attachable ); - inline ConstIterator find ( ConstAttachableID attachable ) const; - //@} - //********************************************************************************************** - - //**Add/Remove functions************************************************************************ - /*!\name Add/Remove functions */ - //@{ - inline void add ( AttachableID attachable ); - inline Iterator remove( Iterator pos ); - //@} - //********************************************************************************************** - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - Attachables attachables_; //!< The currently existing attachables. - //@} - //********************************************************************************************** - - //**Private struct Compare********************************************************************** - /*! \cond internal */ - /*!\brief Helper class for the find() function. */ - struct Compare : public std::binary_function<AttachableID,id_t,bool> - { - //**Binary function call operator************************************************************ - /*!\name Binary function call operator */ - //@{ - inline bool operator()( ConstAttachableID attachable, id_t sid ) const { - return attachable->getSystemID() < sid; - } - inline bool operator()( id_t sid, ConstAttachableID attachable ) const { - return sid < attachable->getSystemID(); - } - inline bool operator()( ConstAttachableID attachable1, ConstAttachableID attachable2 ) const { - return attachable1->getSystemID() < attachable2->getSystemID(); - } - //@} - //******************************************************************************************* - }; - /*! \endcond */ - //********************************************************************************************** - - //**Friend declarations************************************************************************* - /*! \cond internal */ - friend class Attachable; - /*! \endcond */ - //********************************************************************************************** -}; -//************************************************************************************************* - - - - -//================================================================================================= -// -// CONSTRUCTORS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Standard constructor for the AttachableStorage. - * - * \param initCapacity The initial capacity of the attachable storage. - */ -inline AttachableStorage::AttachableStorage( SizeType initCapacity ) - : attachables_( initCapacity ) -{} -//************************************************************************************************* - - - - -//================================================================================================= -// -// UTILITY FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Returns \a true if the attachable storage contains no attachables. - * - * \return \a true if the attachable storage is empty, \a false if it is not. - */ -inline bool AttachableStorage::isEmpty() const -{ - return attachables_.isEmpty(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns the number of attachables contained in the attachable storage. - * - * \return The number of attachables. - */ -inline AttachableStorage::SizeType AttachableStorage::size() const -{ - return attachables_.size(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator to the first contained attachable. - * - * \return Iterator to the first contained attachable. - */ -inline AttachableStorage::Iterator AttachableStorage::begin() -{ - return attachables_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns a constant iterator to the first contained attachable. - * - * \return Constant iterator to the first contained attachable. - */ -inline AttachableStorage::ConstIterator AttachableStorage::begin() const -{ - return attachables_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator just past the last contained attachable. - * - * \return Iterator just past the last contained attachable. - */ -inline AttachableStorage::Iterator AttachableStorage::end() -{ - return attachables_.end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns a constant iterator just past the last contained attachable. - * - * \return Constant iterator just past the last contained attachable. - */ -inline AttachableStorage::ConstIterator AttachableStorage::end() const -{ - return attachables_.end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Finding an attachable with a certain unique system-specific ID. - * - * \param sid The unique system-specific ID for the search. - * \return Iterator to the attachable with system-specific ID \a sid or an iterator just past the end. - * - * This function finds the attachable with the system-specific ID \a sid. In case the attachable - * is found, the function returns an iterator to the attachable. Otherwise, the function returns - * an iterator just past the end of last attachable contained in the attachable storage. - */ -inline AttachableStorage::Iterator AttachableStorage::find( id_t sid ) -{ - Iterator pos = std::lower_bound( begin(), end(), sid, Compare() ); - if( pos != end() && pos->getSystemID() == sid ) - return pos; - else - return end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Finding an attachable with a certain unique system-specific ID. - * - * \param sid The unique system-specific ID for the search. - * \return Constant iterator to the attachable with system-specific ID \a sid or a constant iterator just past the end. - * - * This function finds the attachable with the system-specific ID \a sid. In case the attachable - * is found, the function returns a constant iterator to the attachable. Otherwise, the function - * returns a constant iterator just past the end of last attachable contained in the attachable - * storage. - */ -inline AttachableStorage::ConstIterator AttachableStorage::find( id_t sid ) const -{ - ConstIterator pos = std::lower_bound( begin(), end(), sid, Compare() ); - if( pos != end() && pos->getSystemID() == sid ) - return pos; - else - return end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Finding a specific attachable in the attachable storage. - * - * \param attachable The given attachable for the search. - * \return Iterator to the given attachable or an iterator just past the end. - * - * This function finds the attachable in the attachable storage. In case the attachable is found, - * the function returns an iterator to the attachable. Otherwise, the function returns an iterator - * just past the end of last attachable contained in the attachable storage. - */ -inline AttachableStorage::Iterator AttachableStorage::find( ConstAttachableID attachable ) -{ - return find( attachable->getSystemID() ); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Finding a specific attachable in the attachable storage. - * - * \param attachable The given attachable for the search. - * \return Iterator to the given attachable or an iterator just past the end. - * - * This function finds the attachable in the attachable storage. In case the attachable is found, - * the function returns an iterator to the attachable. Otherwise, the function returns an iterator - * just past the end of last attachable contained in the attachable storage. - */ -inline AttachableStorage::ConstIterator AttachableStorage::find( ConstAttachableID attachable ) const -{ - return find( attachable->getSystemID() ); -} -//************************************************************************************************* - - - - -//================================================================================================= -// -// ADD/REMOVE FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Adding an attachable to the attachable storage. - * - * \param attachable The new attachable to be added to the attachable storage. - * \return void - * - * This function adds an attachable to the attachable storage. - */ -inline void AttachableStorage::add( AttachableID attachable ) -{ - Iterator pos = std::lower_bound( begin(), end(), attachable->getSystemID(), Compare() ); - attachables_.insert( pos, attachable ); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Removing an attachable from the attachable storage. - * - * \param pos The position of the attachable to be removed. - * \return Iterator to the attachable after the erased attachable. - * - * This function removes an attachable from the attachable storage. - */ -inline AttachableStorage::Iterator AttachableStorage::remove( Iterator pos ) -{ - WALBERLA_ASSERT( pos != end(), "Attachable is not contained in the attachable storage" ); - - return attachables_.erase( pos ); -} -//************************************************************************************************* - -} // namespace pe -} // namespace walberla diff --git a/src/pe/rigidbody/BoxFactory.cpp b/src/pe/rigidbody/BoxFactory.cpp index 6473eaa18e60f971b71d31614cdd3cb13b82889e..7ef2109e4aaf2863d49ceec48765d9fdbb8d3bad 100644 --- a/src/pe/rigidbody/BoxFactory.cpp +++ b/src/pe/rigidbody/BoxFactory.cpp @@ -26,6 +26,9 @@ #include "pe/rigidbody/BodyStorage.h" #include "pe/rigidbody/Box.h" +#include <core/logging/Logging.h> +#include <core/UniqueID.h> + namespace walberla { namespace pe { diff --git a/src/pe/rigidbody/CapsuleFactory.cpp b/src/pe/rigidbody/CapsuleFactory.cpp index 44b7839d11d8587d6415f9d0d52d3c885a4e6b23..57805661d14e8556eff96e1d580a701ccc296626 100644 --- a/src/pe/rigidbody/CapsuleFactory.cpp +++ b/src/pe/rigidbody/CapsuleFactory.cpp @@ -26,6 +26,9 @@ #include "pe/rigidbody/BodyStorage.h" #include "pe/rigidbody/Capsule.h" +#include <core/logging/Logging.h> +#include <core/UniqueID.h> + namespace walberla { namespace pe { diff --git a/src/pe/rigidbody/CylindricalBoundaryFactory.cpp b/src/pe/rigidbody/CylindricalBoundaryFactory.cpp index a82ea0c684ad7dbc7f60c2d02b99fb7eb6ded2f2..e43c94ecd53d48b91008d2f489a876966119dca2 100644 --- a/src/pe/rigidbody/CylindricalBoundaryFactory.cpp +++ b/src/pe/rigidbody/CylindricalBoundaryFactory.cpp @@ -24,7 +24,8 @@ #include "pe/rigidbody/BodyStorage.h" #include "pe/rigidbody/CylindricalBoundary.h" -#include "core/logging/Logging.h" +#include <core/logging/Logging.h> +#include <core/UniqueID.h> namespace walberla { namespace pe { diff --git a/src/pe/rigidbody/EllipsoidFactory.cpp b/src/pe/rigidbody/EllipsoidFactory.cpp index e848dd28527d9c763c55bab2b7e02467c82b05a3..47fae3c94e08426ef1f02d417486c2049f34d7d8 100644 --- a/src/pe/rigidbody/EllipsoidFactory.cpp +++ b/src/pe/rigidbody/EllipsoidFactory.cpp @@ -25,6 +25,9 @@ #include "pe/rigidbody/BodyStorage.h" #include "pe/rigidbody/Ellipsoid.h" +#include <core/logging/Logging.h> +#include <core/UniqueID.h> + namespace walberla { namespace pe { diff --git a/src/pe/rigidbody/PlaneFactory.cpp b/src/pe/rigidbody/PlaneFactory.cpp index 2f780a12a1d1377fcf72b283d082e0e3a1320884..bb35cd1e724d1692ce43e906bb208b674103382f 100644 --- a/src/pe/rigidbody/PlaneFactory.cpp +++ b/src/pe/rigidbody/PlaneFactory.cpp @@ -26,7 +26,8 @@ #include "pe/rigidbody/BodyStorage.h" #include "pe/rigidbody/Plane.h" -#include "core/logging/Logging.h" +#include <core/logging/Logging.h> +#include <core/UniqueID.h> namespace walberla { namespace pe { diff --git a/src/pe/rigidbody/RigidBody.h b/src/pe/rigidbody/RigidBody.h index 004423cc12a1e14f3f9de124046895db2c0add15..733ed9f57b8e5130a383633bb3b554ab8dbc3311 100644 --- a/src/pe/rigidbody/RigidBody.h +++ b/src/pe/rigidbody/RigidBody.h @@ -37,7 +37,6 @@ #include "core/debug/Debug.h" #include "core/logging/Logging.h" #include "core/math/AABB.h" -#include "pe/attachable/Attachable.h" #include "pe/rigidbody/MPIRigidBodyTrait.h" namespace walberla{ @@ -61,15 +60,12 @@ private: //**Type definitions**************************************************************************** typedef PtrVector<RigidBody,NoDelete> Bodies; //!< Vector for superordinate bodies containing this rigid body. typedef PtrVector<Contact,NoDelete> Contacts; //!< Vector for attached contacts. - typedef PtrVector<Attachable,NoDelete> Attachables; //!< Vector for attachables. //********************************************************************************************** public: //**Type definitions**************************************************************************** typedef Contacts::Iterator ContactIterator; //!< Iterator over the currently attached contacts. typedef Contacts::ConstIterator ConstContactIterator; //!< ConstIterator over the currently attached contacts. - typedef Attachables::Iterator AttachableIterator; //!< Iterator over the currently attached attachables. - typedef Attachables::ConstIterator ConstAttachableIterator; //!< ConstIterator over the currently attached attachables. typedef Bodies::Iterator AttachedBodyIterator; //!< Iterator over the currently attached rigid bodies. typedef Bodies::ConstIterator ConstAttachedBodyIterator; //!< ConstIterator over the currently attached rigid bodies. //********************************************************************************************** @@ -292,14 +288,6 @@ public: //**Attachable functions************************************************************************ /*!\name Attachable functions */ //@{ - void registerAttachable ( AttachableID attachable ); - void deregisterAttachable( AttachableID attachable ); - inline bool isAttached () const; - inline size_t countAttachables () const; - inline AttachableIterator beginAttachables (); - inline ConstAttachableIterator beginAttachables () const; - inline AttachableIterator endAttachables (); - inline ConstAttachableIterator endAttachables () const; inline AttachedBodyIterator beginAttachedBodies (); inline ConstAttachedBodyIterator beginAttachedBodies () const; inline AttachedBodyIterator endAttachedBodies (); @@ -461,7 +449,6 @@ protected: 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. - Attachables attachables_; //!< Vector for the currently attached attachables. Bodies attachedBodies_; //!< Vector for the currently attached rigid bodies. //@} //********************************************************************************************** @@ -2047,86 +2034,6 @@ inline RigidBody::ConstContactIterator RigidBody::endContacts() const //************************************************************************************************* - - -//================================================================================================= -// -// ATTACHABLE FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Returns whether any attachable is registered with the rigid body. - * - * \return \a true in case at least one attachable is registered with the rigid body, \a false otherwise. - */ -inline bool RigidBody::isAttached() const -{ - return !attachables_.isEmpty(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns the number of currently registered attachables. - * - * \return The number of registered attachables. - */ -inline size_t RigidBody::countAttachables() const -{ - return attachables_.size(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator to the first registered attachable. - * - * \return Iterator to the first registered attachable. - */ -inline RigidBody::AttachableIterator RigidBody::beginAttachables() -{ - return attachables_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator to the first registered attachable. - * - * \return Iterator to the first registered attachable. - */ -inline RigidBody::ConstAttachableIterator RigidBody::beginAttachables() const -{ - return attachables_.begin(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator just past the last registered attachable. - * - * \return Iterator just past the last registered attachable. - */ -inline RigidBody::AttachableIterator RigidBody::endAttachables() -{ - return attachables_.end(); -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Returns an iterator just past the last registered attachable. - * - * \return Iterator just past the last registered attachable. - */ -inline RigidBody::ConstAttachableIterator RigidBody::endAttachables() const -{ - return attachables_.end(); -} -//************************************************************************************************* - - //************************************************************************************************* /*!\brief Returns an iterator to the first attached rigid body. * @@ -3347,73 +3254,6 @@ inline void RigidBody::update( const Quat& dq ) -//================================================================================================= -// -// ATTACHABLE FUNCTIONS -// -//================================================================================================= - -//************************************************************************************************* -/*!\brief Registering a single attachable with the rigid body. - * - * \param attachable The attachable to be registered with the rigid body. - * \return void - * - * This function must NOT be called explicitly, but is reserved for internal use only! - * Attachables are automatically registered during their construction process. - */ -inline void RigidBody::registerAttachable( AttachableID attachable ) -{ - // Registering the attachable - attachables_.pushBack( attachable ); - - // Registering all newly attached rigid bodies - const Attachable::Iterator end( attachable->end() ); - for( Attachable::Iterator body=attachable->begin(); body!=end; ++body ) { - const AttachedBodyIterator bbegin( attachedBodies_.begin() ); - const AttachedBodyIterator bend ( attachedBodies_.end() ); - if( *body != this && std::find( bbegin, bend, *body ) == bend ) - attachedBodies_.pushBack( *body ); - } -} -//************************************************************************************************* - - -//************************************************************************************************* -/*!\brief Deregistering a single attachable from the rigid body. - * - * \param attachable The attachable to be deregistered from the rigid body. - * \return void - * - * This function must NOT be called explicitly, but is reserved for internal use only! - * Attachables are automatically deregistered during their destruction process. - */ -inline void RigidBody::deregisterAttachable( AttachableID attachable ) -{ - // Deregistering the attachable - Attachables::Iterator pos( std::find( attachables_.begin(), attachables_.end(), attachable ) ); - WALBERLA_ASSERT( pos != attachables_.end(), "Attachable is not registered" ); - attachables_.erase( pos ); - - // Deregistering all attached rigid bodies - attachedBodies_.clear(); - - // Recreating the vector of attached rigid bodies - for( Attachables::Iterator it=attachables_.begin(); it!=attachables_.end(); ++it ) { - const Attachable::Iterator end( it->end() ); - for( Attachable::Iterator body=it->begin(); body!=end; ++body ) { - const AttachedBodyIterator bbegin( attachedBodies_.begin() ); - const AttachedBodyIterator bend ( attachedBodies_.end() ); - if( *body != this && std::find( bbegin, bend, *body ) == bend ) - attachedBodies_.pushBack( *body ); - } - } -} -//************************************************************************************************* - - - - //================================================================================================= // // SIMULATION FUNCTIONS diff --git a/src/pe/rigidbody/SphereFactory.cpp b/src/pe/rigidbody/SphereFactory.cpp index c9487031def01e2876e0d2bf6d341c1e9681825b..e323057736148ca3b58dceb4f684e7fadb504a0b 100644 --- a/src/pe/rigidbody/SphereFactory.cpp +++ b/src/pe/rigidbody/SphereFactory.cpp @@ -26,6 +26,9 @@ #include "pe/rigidbody/BodyStorage.h" #include "pe/rigidbody/Sphere.h" +#include <core/logging/Logging.h> +#include <core/UniqueID.h> + namespace walberla { namespace pe { diff --git a/src/pe/rigidbody/SquirmerFactory.cpp b/src/pe/rigidbody/SquirmerFactory.cpp index 41b495b75aa008cf3aae1278b98ad450302b9cd7..7b74f622c9b69f949b4f79de831e184953d05fd8 100644 --- a/src/pe/rigidbody/SquirmerFactory.cpp +++ b/src/pe/rigidbody/SquirmerFactory.cpp @@ -24,6 +24,9 @@ #include "pe/rigidbody/BodyStorage.h" #include "pe/rigidbody/Squirmer.h" +#include <core/logging/Logging.h> +#include <core/UniqueID.h> + namespace walberla { namespace pe { diff --git a/src/pe/rigidbody/UnionFactory.h b/src/pe/rigidbody/UnionFactory.h index e237e0dd31d83642f80663ed48b7c083498cad63..4cb41e9a30ba2e982bb86ff3de33369d7f069702 100644 --- a/src/pe/rigidbody/UnionFactory.h +++ b/src/pe/rigidbody/UnionFactory.h @@ -31,8 +31,10 @@ #include "pe/rigidbody/Union.h" #include "pe/Types.h" -#include "blockforest/BlockForest.h" -#include "core/debug/Debug.h" +#include <blockforest/BlockForest.h> +#include <core/debug/Debug.h> +#include <core/logging/Logging.h> +#include <core/UniqueID.h> namespace walberla { namespace pe {