------------------------------------------------------------ revno: 1785 committer: Václav Šmilauer <vac...@flux> branch nick: trunk timestamp: Sat 2009-11-14 13:37:19 +0100 message: 1. Remove InteractionHashMap removed: core/containers/InteractionHashMap.cpp core/containers/InteractionHashMap.hpp modified: core/SConscript pkg/dem/PreProcessor/ModifiedTriaxialTest.cpp pkg/dem/PreProcessor/TriaxialTestWater.cpp pkg/snow/PreProcessor/SnowCreepTest.cpp pkg/snow/PreProcessor/SnowVoxelsLoader.cpp
-- lp:yade https://code.launchpad.net/~yade-dev/yade/trunk Your team Yade developers is subscribed to branch lp:yade. To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription.
=== modified file 'core/SConscript' --- core/SConscript 2009-11-14 12:32:32 +0000 +++ core/SConscript 2009-11-14 12:37:19 +0000 @@ -26,7 +26,6 @@ 'yade.cpp', 'containers/BodyRedirectionVector.cpp', 'containers/BodyVector.cpp', - 'containers/InteractionHashMap.cpp', 'containers/InteractionVecMap.cpp', ]), LIBS=env['LIBS']+[ === removed file 'core/containers/InteractionHashMap.cpp' --- core/containers/InteractionHashMap.cpp 2009-08-03 10:02:11 +0000 +++ core/containers/InteractionHashMap.cpp 1970-01-01 00:00:00 +0000 @@ -1,170 +0,0 @@ -/************************************************************************* -* Copyright (C) 2004 by Olivier Galizzi * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#include "InteractionHashMap.hpp" - -InteractionHashMapIterator::InteractionHashMapIterator() : InteractionContainerIterator() -{ - -} - - -InteractionHashMapIterator::~InteractionHashMapIterator() -{ - -} - - -bool InteractionHashMapIterator::isDifferent(const InteractionContainerIterator& i) -{ - return (hmii != static_cast<const InteractionHashMapIterator&>(i).hmii ); -} - - -void InteractionHashMapIterator::increment() -{ - ++hmii; -} - - -void InteractionHashMapIterator::affect(const InteractionContainerIterator& i) -{ - hmii = static_cast<const InteractionHashMapIterator&>(i).hmii; -} - - -shared_ptr<Interaction> InteractionHashMapIterator::getValue() -{ - return (*hmii).second; -} - - -shared_ptr<InteractionContainerIterator> InteractionHashMapIterator::createPtr() -{ - return shared_ptr<InteractionContainerIterator>(new InteractionHashMapIterator()); -} - - -/***********************************************************************/ -/***********************************************************************/ -/***********************************************************************/ -/***********************************************************************/ - -InteractionHashMap::InteractionHashMap() -{ - clear(); -} - - -InteractionHashMap::~InteractionHashMap() -{ -} - - -bool InteractionHashMap::insert(shared_ptr<Interaction>& i) -{ - boost::mutex::scoped_lock lock(drawloopmutex); - - body_id_t id1 = i->getId1(); - body_id_t id2 = i->getId2(); - if (id1>id2) - swap(id1,id2); - - return interactions.insert( IHashMap::value_type( pair<body_id_t,body_id_t>(id1,id2) , i )).second; -} - - -bool InteractionHashMap::insert(body_id_t id1,body_id_t id2) -{ - shared_ptr<Interaction> i(new Interaction(id1,id2) ); - return insert(i); -} - - -void InteractionHashMap::clear() -{ - boost::mutex::scoped_lock lock(drawloopmutex); - - interactions.clear(); - pendingErase.clear(); -} - - -bool InteractionHashMap::erase(body_id_t id1,body_id_t id2) -{ - boost::mutex::scoped_lock lock(drawloopmutex); - - if (id1>id2) - swap(id1,id2); - - unsigned int oldSize = interactions.size(); - pair<body_id_t,body_id_t> p(id1,id2); - unsigned int size = interactions.erase(p); - - return size!=oldSize; - -} - - -const shared_ptr<Interaction>& InteractionHashMap::find(body_id_t id1,body_id_t id2) -{ - if (id1>id2) - swap(id1,id2); - - IHashMap::iterator hmii = interactions.find(pair<body_id_t,body_id_t>(id1,id2)); - if (hmii!=interactions.end()) - return (*hmii).second; - else - { - empty = shared_ptr<Interaction>(); - return empty; - } -} - - -InteractionContainer::iterator InteractionHashMap::begin() -{ - shared_ptr<InteractionHashMapIterator> it(new InteractionHashMapIterator()); - it->hmii = interactions.begin(); - - return InteractionContainer::iterator(it); -} - - -InteractionContainer::iterator InteractionHashMap::end() -{ - shared_ptr<InteractionHashMapIterator> it(new InteractionHashMapIterator()); - it->hmii = interactions.end(); - - return InteractionContainer::iterator(it); -} - - -// void InteractionHashMap::eraseCurrentAndGotoNextPotential() -// { -// if (notAtEnd()) -// { -// IHashMap::iterator tmpHmii=hmii; -// ++hmii; -// interactions.erase(tmpHmii); -// } -// } -// -// void InteractionHashMap::eraseCurrentAndGotoNext() -// { -// IHashMap::iterator tmpHmii=hmii; -// while (notAtEnd() && !((*hmii).second->isReal)) -// ++hmii; -// interactions.erase(tmpHmii); -// } - -unsigned int InteractionHashMap::size() -{ - return interactions.size(); -} -YADE_PLUGIN((InteractionHashMap)); \ No newline at end of file === removed file 'core/containers/InteractionHashMap.hpp' --- core/containers/InteractionHashMap.hpp 2009-07-31 09:07:59 +0000 +++ core/containers/InteractionHashMap.hpp 1970-01-01 00:00:00 +0000 @@ -1,95 +0,0 @@ -/************************************************************************* -* Copyright (C) 2004 by Olivier Galizzi * -* [email protected] * -* * -* This program is free software; it is licensed under the terms of the * -* GNU General Public License v2 or later. See file LICENSE for details. * -*************************************************************************/ - -#pragma once - -#include<yade/core/InteractionContainer.hpp> -#include<yade/core/Interaction.hpp> - - -#if __GNUC__<4 || (__GNUC__==4 && __GNUC_MINOR__<=2) - // use this in gcc<=4.2 - // see also the corresponding IHashMap typedef below - #include<ext/hash_map> -#else - #include<tr1/unordered_map> -#endif - -#include<vector> - -using namespace std; -using namespace __gnu_cxx; - - - - -struct eqPair -{ - bool operator()(const pair<body_id_t,body_id_t>& p1, const pair<body_id_t,body_id_t>& p2) const - { - return (p1.first==p2.first && p1.second==p2.second); - } -}; - -struct hashPair -{ - unsigned int operator()(const pair<body_id_t,body_id_t>& p) const - { - return ((unsigned int)p.first+(unsigned int)p.second)%182501621; - } -}; - -#if __GNUC__<4 || (__GNUC__==4 && __GNUC_MINOR__<=2) - typedef hash_map<pair<body_id_t,body_id_t>, shared_ptr<Interaction>, hashPair, eqPair > IHashMap; -#else - typedef tr1::unordered_map<pair<body_id_t,body_id_t>, shared_ptr<Interaction>, hashPair, eqPair > IHashMap; -#endif - -class InteractionHashMap : public InteractionContainer -{ - private : - IHashMap interactions; - shared_ptr<Interaction> empty; - - public : - InteractionHashMap(); - virtual ~InteractionHashMap(); - - virtual bool insert(body_id_t id1,body_id_t id2); - virtual bool insert(shared_ptr<Interaction>& i); - virtual void clear(); - virtual bool erase(body_id_t id1,body_id_t id2); - virtual const shared_ptr<Interaction>& find(body_id_t id1,body_id_t id2); - - virtual InteractionContainer::iterator begin(); - virtual InteractionContainer::iterator end(); - - virtual unsigned int size(); - - REGISTER_CLASS_NAME(InteractionHashMap); - REGISTER_BASE_CLASS_NAME(InteractionContainer); -}; - -class InteractionHashMapIterator : public InteractionContainerIterator -{ - public : - IHashMap::iterator hmii; - - InteractionHashMapIterator(); - ~InteractionHashMapIterator(); - - virtual bool isDifferent(const InteractionContainerIterator& i); - virtual void affect(const InteractionContainerIterator& i); - virtual void increment(); - virtual shared_ptr<Interaction> getValue(); - virtual shared_ptr<InteractionContainerIterator> createPtr(); - -}; - -REGISTER_SERIALIZABLE(InteractionHashMap); - === modified file 'pkg/dem/PreProcessor/ModifiedTriaxialTest.cpp' --- pkg/dem/PreProcessor/ModifiedTriaxialTest.cpp 2009-08-05 07:32:18 +0000 +++ pkg/dem/PreProcessor/ModifiedTriaxialTest.cpp 2009-11-14 12:37:19 +0000 @@ -181,8 +181,6 @@ rootBody = shared_ptr<MetaBody>(new MetaBody); createActors(rootBody); positionRootBody(rootBody); - rootBody->transientInteractions = shared_ptr<InteractionContainer>(new InteractionHashMap); - rootBody->bodies = shared_ptr<BodyContainer>(new BodyRedirectionVector); shared_ptr<Body> body; === modified file 'pkg/dem/PreProcessor/TriaxialTestWater.cpp' --- pkg/dem/PreProcessor/TriaxialTestWater.cpp 2009-11-06 17:00:44 +0000 +++ pkg/dem/PreProcessor/TriaxialTestWater.cpp 2009-11-14 12:37:19 +0000 @@ -185,7 +185,6 @@ createActors(rootBody); positionRootBody(rootBody); - //rootBody->transientInteractions = shared_ptr<InteractionContainer>(new InteractionHashMap); shared_ptr<Body> body; === modified file 'pkg/snow/PreProcessor/SnowCreepTest.cpp' --- pkg/snow/PreProcessor/SnowCreepTest.cpp 2009-08-05 07:32:18 +0000 +++ pkg/snow/PreProcessor/SnowCreepTest.cpp 2009-11-14 12:37:19 +0000 @@ -57,7 +57,6 @@ #include<yade/pkg-common/PhysicalParametersMetaEngine.hpp> #include<yade/core/BodyRedirectionVector.hpp> -#include<yade/core/InteractionHashMap.hpp> #include<yade/pkg-dem/Shop.hpp> === modified file 'pkg/snow/PreProcessor/SnowVoxelsLoader.cpp' --- pkg/snow/PreProcessor/SnowVoxelsLoader.cpp 2009-09-14 12:46:08 +0000 +++ pkg/snow/PreProcessor/SnowVoxelsLoader.cpp 2009-11-14 12:37:19 +0000 @@ -50,7 +50,6 @@ #include<yade/pkg-common/PhysicalParametersMetaEngine.hpp> #include<yade/core/BodyRedirectionVector.hpp> -#include<yade/core/InteractionHashMap.hpp> #include<yade/pkg-snow/ElawSnowLayersDeformation.hpp> #include<yade/pkg-dem/Shop.hpp>
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp

