git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@894 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
canape 2008-01-17 15:37:05 +00:00
commit 9a0e58779c

View file

@ -190,21 +190,13 @@ template< class EOT, class TYPE > class peoAsyncIslandMig : public Cooperative,
private: private:
continuator & cont; // continuator continuator & cont; // continuator
eoSelect< EOT >& select; // the selection strategy eoSelect< EOT >& select; // the selection strategy
eoReplacement< EOT >& replace; // the replacement strategy eoReplacement< EOT >& replace; // the replacement strategy
Topology& topology; // the neighboring topology Topology& topology; // the neighboring topology
// source and destination populations
peoData & source; peoData & source;
peoData & destination; peoData & destination;
std :: queue< TYPE > imm;
// immigrants & emigrants in the queue std :: queue< TYPE > em;
std :: queue< peoData* > imm;
std :: queue< peoData* > em;
std :: vector< TYPE > vect;
std :: queue< Cooperative* > coop_em; std :: queue< Cooperative* > coop_em;
}; };
@ -227,35 +219,21 @@ template< class EOT , class TYPE> peoAsyncIslandMig< EOT, TYPE > :: peoAsyncIsla
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT, TYPE > :: pack() template< class EOT , class TYPE> void peoAsyncIslandMig< EOT, TYPE > :: pack()
{ {
std::cout << "[peoAsyncIslandMig] [pack] [begin]" << std::endl ;
lock (); lock ();
::pack( coop_em.front()->getKey() ); ::pack( coop_em.front()->getKey() );
//::pack(em.front()); em.front().pack();
//coop_em.front()->getKey().pack();
//std::cout << em.front() << std::endl ;
em.front()->pack();
coop_em.pop(); coop_em.pop();
em.pop(); em.pop();
unlock(); unlock();
std::cout << "[peoAsyncIslandMig] [pack] [end]" << std::endl ;
} }
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: unpack() template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: unpack()
{ {
lock (); lock ();
TYPE mig;
peoData mig;
//::unpack( mig );
mig.unpack(); mig.unpack();
imm.push( &mig ); imm.push( mig );
unlock(); unlock();
} }
@ -264,7 +242,6 @@ template< class EOT , class TYPE> void peoAsyncIslandMig< EOT, TYPE > :: packSyn
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: emigrate() template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: emigrate()
{ {
std::cout << "[peoAsyncIslandMig] [emigrate] [begin]" << std::endl ;
std :: vector< Cooperative* >in, out; std :: vector< Cooperative* >in, out;
topology.setNeighbors( this, in, out ); topology.setNeighbors( this, in, out );
@ -272,23 +249,18 @@ template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: emigrat
{ {
TYPE mig; TYPE mig;
vect.push_back(mig);
//select( source, mig ); //select( source, mig );
//em.push( &mig ); em.push( mig );
em.push(&(vect[vect.size()-1]));
coop_em.push( out[i] ); coop_em.push( out[i] );
send( out[i] ); send( out[i] );
printDebugMessage( "sending some emigrants." ); printDebugMessage( "sending some emigrants." );
} }
std::cout << "[peoAsyncIslandMig] [emigrate] [end]" << std::endl ;
} }
template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: immigrate() template< class EOT , class TYPE> void peoAsyncIslandMig< EOT , TYPE> :: immigrate()
{ {
lock (); lock ();
{ {