Removing ParadisEO
This commit is contained in:
parent
c498de10e2
commit
e1cc2dd7f5
37 changed files with 4 additions and 2396 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
if USE_PARADISEO
|
#if USE_PARADISEO
|
||||||
SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 ParadisEO
|
#SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 ParadisEO
|
||||||
else
|
#else
|
||||||
SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5
|
SUBDIRS = Lesson1 Lesson2 Lesson3 Lesson4 Lesson5
|
||||||
endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -139,8 +139,6 @@
|
||||||
#include <other/external_eo>
|
#include <other/external_eo>
|
||||||
#include <eoCounter.h>
|
#include <eoCounter.h>
|
||||||
|
|
||||||
// Cellular parallel evolutionary algorithm
|
|
||||||
#include <eoToricCellularEasyEA.h>
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// to be continued ...
|
// to be continued ...
|
||||||
|
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoToricCellularEasyEA.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoToricCellularEasyEA_h
|
|
||||||
#define eoToricCellularEasyEA_h
|
|
||||||
|
|
||||||
#include <eoCellularEasyEA.h>
|
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
template <class EOT> class eoToricCellularEasyEA : public eoCellularEasyEA <EOT> {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
eoToricCellularEasyEA (eoContinue <EOT> & _cont,
|
|
||||||
eoEvalFunc <EOT> & _eval,
|
|
||||||
eoSelectOne <EOT> & _sel_neigh,
|
|
||||||
eoBinOp <EOT> & _cross,
|
|
||||||
eoMonOp <EOT> & _mut,
|
|
||||||
eoSelectOne <EOT> & _sel_repl
|
|
||||||
) :
|
|
||||||
eoCellularEasyEA <EOT> (_cont,
|
|
||||||
_eval,
|
|
||||||
_sel_neigh,
|
|
||||||
_cross,
|
|
||||||
_mut,
|
|
||||||
_sel_repl) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
eoToricCellularEasyEA (eoContinue <EOT> & _cont,
|
|
||||||
eoEvalFunc <EOT> & _eval,
|
|
||||||
eoSelectOne <EOT> & _sel_neigh,
|
|
||||||
eoQuadOp <EOT> & _cross,
|
|
||||||
eoMonOp <EOT> & _mut,
|
|
||||||
eoSelectOne <EOT> & _sel_child,
|
|
||||||
eoSelectOne <EOT> & _sel_repl
|
|
||||||
) :
|
|
||||||
eoCellularEasyEA <EOT> (_cont,
|
|
||||||
_eval,
|
|
||||||
_sel_neigh,
|
|
||||||
_cross,
|
|
||||||
_mut,
|
|
||||||
_sel_child,
|
|
||||||
_sel_repl) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Take care :-). The size of the population must be a square number ! (9, 16, ...)
|
|
||||||
|
|
||||||
virtual eoPop <EOT> neighbours (const eoPop <EOT> & pop, int rank) {
|
|
||||||
|
|
||||||
int dim2 = pop.size () ;
|
|
||||||
int dim = (int) std::sqrt ( (double) dim2) ;
|
|
||||||
int j = rank ;
|
|
||||||
|
|
||||||
eoPop <EOT> neigh ;
|
|
||||||
neigh.push_back (pop [j < dim ? dim2 - dim + j : j - dim]) ;
|
|
||||||
neigh.push_back (pop [(j + dim) % dim2]) ;
|
|
||||||
neigh.push_back (pop [(j + 1) % dim != 0 ? j + 1 : j + 1 - dim]) ;
|
|
||||||
neigh.push_back (pop [j % dim != 0 ? j - 1 : j + dim - 1]) ;
|
|
||||||
|
|
||||||
return neigh ;
|
|
||||||
}
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
# Copyright (C) 2004 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
|
||||||
|
|
||||||
SUBDIRS = comm eval island
|
|
||||||
|
|
||||||
pkginclude_HEADERS = eoPopAgent.h eoSolAgent.h
|
|
||||||
|
|
||||||
### Makefile.am ends here
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
# Copyright (C) 2004 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
|
||||||
|
|
||||||
SUBDIRS = messages
|
|
||||||
|
|
||||||
pkginclude_HEADERS = eoListener.h eoLocalListener.h
|
|
||||||
|
|
||||||
### Makefile.am ends here
|
|
||||||
|
|
@ -1,148 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoListener.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Cont act: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoListener_h
|
|
||||||
#define eoListener_h
|
|
||||||
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <paradisEO/comm/eoLocalListener.h>
|
|
||||||
#include <paradisEO/comm/messages/to/eoPublishMessTo.h>
|
|
||||||
#include <paradisEO/comm/messages/to/eoKillMessTo.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
Necessary for any use of a distributed model.
|
|
||||||
It makes it possible to have a total state of
|
|
||||||
that one.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// In the near future ... Enabling different kinds of EO to send/receive ..
|
|
||||||
|
|
||||||
template <class EOT> class eoListener : public std::vector <eoLocalListener <EOT> > {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoListener (int argc, char ** argv) : comm (MPI :: COMM_WORLD) {
|
|
||||||
|
|
||||||
// Mpi requires it !
|
|
||||||
MPI :: Init (argc, argv) ;
|
|
||||||
|
|
||||||
// Who and how many ?
|
|
||||||
rank = MPI :: COMM_WORLD.Get_rank () ;
|
|
||||||
len = MPI :: COMM_WORLD.Get_size () ;
|
|
||||||
|
|
||||||
// To build local listeners algorithms
|
|
||||||
for (int i = 0 ; i < len ; i ++) {
|
|
||||||
eoLocalListener <EOT> loc_listen (i) ;
|
|
||||||
push_back (loc_listen) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Destructor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
~ eoListener () {
|
|
||||||
|
|
||||||
MPI :: Finalize () ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
A reference to the current listener
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoLocalListener <EOT> & here () {
|
|
||||||
|
|
||||||
return operator [] (rank) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
To import messages ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
void update () {
|
|
||||||
|
|
||||||
for (int i = 0 ; i < size () ; i ++)
|
|
||||||
operator [] (i).update () ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
To broadcast the std::string identifier of the local process to the
|
|
||||||
whole neighbouring ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
void publish (std::string label) {
|
|
||||||
|
|
||||||
eoPublishMessTo <EOT> mess (label) ;
|
|
||||||
for (int i = 0 ; i < size () ; i ++)
|
|
||||||
if (i != rank)
|
|
||||||
mess (operator [] (i)) ;
|
|
||||||
here ().label () = label ; // Nothing to send !
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Blocking. Waits for at least one 'eoLocalListener' to
|
|
||||||
receive any eoPop ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
void wait () {
|
|
||||||
|
|
||||||
bool b = false ;
|
|
||||||
|
|
||||||
do {
|
|
||||||
comm.Probe (MPI :: ANY_SOURCE, 0) ;
|
|
||||||
update () ;
|
|
||||||
for (int i = 0 ; i < size () ; i ++)
|
|
||||||
if (! operator [] (i).empty ())
|
|
||||||
b = true ;
|
|
||||||
|
|
||||||
} while (! b) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroy (std::string label) {
|
|
||||||
|
|
||||||
eoKillMessTo <EOT> mess ;
|
|
||||||
for (int i = 0 ; i < len ; i ++) {
|
|
||||||
if (operator [] (i).label () == label)
|
|
||||||
mess (operator [] (i)) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private :
|
|
||||||
|
|
||||||
int rank, len ; // Rank of current process, and number of distributed processes
|
|
||||||
|
|
||||||
MPI :: Comm & comm ; // Communicator
|
|
||||||
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoLocalListener.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoLocalListener_h
|
|
||||||
#define eoLocalListener_h
|
|
||||||
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <queue>
|
|
||||||
#include <string>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <paradisEO/comm/messages/from/eoHeaderMessFrom.h>
|
|
||||||
#include <paradisEO/comm/messages/from/eoEOReceiveMessFrom.h>
|
|
||||||
#include <paradisEO/comm/messages/from/eoEOSendMessFrom.h>
|
|
||||||
#include <paradisEO/comm/messages/from/eoPublishMessFrom.h>
|
|
||||||
#include <paradisEO/comm/messages/from/eoKillMessFrom.h>
|
|
||||||
#include <eoPop.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
A local listener to pack any coming message or, on contrary, to
|
|
||||||
send any data to another distributed process.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Well, not very nice, but necessary for multiples header inclusions :-/
|
|
||||||
|
|
||||||
template <class EOT> class eoHeaderMessFrom ;
|
|
||||||
template <class EOT> class eoMessFrom ;
|
|
||||||
template <class EOT> class eoMessTo ;
|
|
||||||
template <class EOT> class eoEOReceiveMessFrom ;
|
|
||||||
template <class EOT> class eoEOSendMessFrom ;
|
|
||||||
template <class EOT> class eoPublishMessFrom ;
|
|
||||||
template <class EOT> class eoKillMessFrom ;
|
|
||||||
|
|
||||||
template <class EOT> class eoLocalListener : public std::queue <eoPop <EOT> > {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoLocalListener (int _num_id) :
|
|
||||||
|
|
||||||
num_id (_num_id),
|
|
||||||
comm (& MPI :: COMM_WORLD), // Shared communicator ...
|
|
||||||
req_EO (false) {
|
|
||||||
|
|
||||||
gethostname (host_name, 255) ; // Host ?
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Any distributed algorithm or agent has its own integer
|
|
||||||
identifiant, which lets us to distinguish them.
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool operator == (eoLocalListener <EOT> & loc_listen) {
|
|
||||||
|
|
||||||
return loc_listen.num_id == num_id ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
To import awaiting messages from other algorithms.
|
|
||||||
For each one, an action may be performed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void update () {
|
|
||||||
|
|
||||||
while (comm -> Iprobe (num_id, 0)) {
|
|
||||||
// While any more messages
|
|
||||||
|
|
||||||
eoHeaderMessFrom <EOT> header (* this) ;
|
|
||||||
eoMessFrom <EOT> * mess ;
|
|
||||||
|
|
||||||
/* The header identifies the kind of messages.
|
|
||||||
Currently, only four are necessary and so defined */
|
|
||||||
|
|
||||||
if (header == "eoEOReceiveMessTo")
|
|
||||||
mess = new eoEOReceiveMessFrom <EOT> (* this) ;
|
|
||||||
else if (header == "eoEOSendMessTo")
|
|
||||||
mess = new eoEOSendMessFrom <EOT> (* this) ;
|
|
||||||
else if (header == "eoPublishMessTo")
|
|
||||||
mess = new eoPublishMessFrom <EOT> (* this) ;
|
|
||||||
else {
|
|
||||||
mess = new eoKillMessFrom <EOT> (* this) ;
|
|
||||||
}
|
|
||||||
// Any side effects ?
|
|
||||||
mess -> operator () () ;
|
|
||||||
delete mess ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wait () {
|
|
||||||
|
|
||||||
bool b = false ;
|
|
||||||
|
|
||||||
do {
|
|
||||||
comm -> Probe (num_id, 0) ;
|
|
||||||
update () ;
|
|
||||||
if (! empty ())
|
|
||||||
b = true ;
|
|
||||||
|
|
||||||
} while (! b) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
String identifier of this algo/agent ?
|
|
||||||
*/
|
|
||||||
|
|
||||||
std::string & label () {
|
|
||||||
|
|
||||||
return name_id ;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool & need_immigration () {
|
|
||||||
|
|
||||||
return req_EO ;
|
|
||||||
}
|
|
||||||
|
|
||||||
int number () {
|
|
||||||
|
|
||||||
return num_id ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroy () {
|
|
||||||
|
|
||||||
std::cout << "Agent [" << name_id << "] stopped ..." << std::endl ;
|
|
||||||
MPI :: Finalize () ;
|
|
||||||
exit (0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
char host_name [255] ; // Host std::string identifier
|
|
||||||
|
|
||||||
private :
|
|
||||||
|
|
||||||
MPI :: Comm * comm ; // MPI Communicator
|
|
||||||
|
|
||||||
std::string name_id ; // String id.
|
|
||||||
int num_id ; // MPI id.
|
|
||||||
bool req_EO ;
|
|
||||||
|
|
||||||
// Friendly classes
|
|
||||||
friend class eoMessFrom <EOT> ;
|
|
||||||
friend class eoMessTo <EOT> ;
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
# Copyright (C) 2004 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
|
||||||
|
|
||||||
SUBDIRS = from to
|
|
||||||
|
|
||||||
pkginclude_HEADERS = eoMessFrom.h eoMessTo.h
|
|
||||||
|
|
||||||
|
|
||||||
### Makefile.am ends here
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoMessFrom.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoMessFrom_h
|
|
||||||
#define eoMessFrom_h
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <mpi.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
An abstract class for any kind of coming message.
|
|
||||||
Common features are declared.
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT> class eoLocalListener ;
|
|
||||||
|
|
||||||
template <class EOT> class eoMessFrom {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoMessFrom (eoLocalListener <EOT> & _loc_listen) :
|
|
||||||
loc_listen (_loc_listen),
|
|
||||||
comm (MPI :: COMM_WORLD) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Well ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
virtual void operator () () = 0 ;
|
|
||||||
|
|
||||||
protected :
|
|
||||||
|
|
||||||
MPI :: Comm & comm ; // Communicator
|
|
||||||
eoLocalListener <EOT> & loc_listen ; // Transmitter
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,75 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoMessTo.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoMessTo_h
|
|
||||||
#define eoMessTo_h
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <paradisEO/comm/messages/to/eoHeaderMessTo.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
An abstract class for any sending message.
|
|
||||||
Common features are declared.
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT> class eoLocalListener ;
|
|
||||||
|
|
||||||
template <class EOT> class eoMessTo {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor. A std::string identifier, being defined in subclasses
|
|
||||||
is given for any kind of messages.
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoMessTo (std::string _label) :
|
|
||||||
|
|
||||||
label (_label),
|
|
||||||
comm (MPI :: COMM_WORLD) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Must be called in sub-classes ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
void operator () (eoLocalListener <EOT> & loc_listen) {
|
|
||||||
|
|
||||||
eoHeaderMessTo <EOT> header (label) ;
|
|
||||||
header (loc_listen) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected :
|
|
||||||
|
|
||||||
MPI :: Comm & comm ; // MPI Communicator
|
|
||||||
|
|
||||||
std::string label ; // String identifier of the message
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
# Copyright (C) 2004 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
|
||||||
|
|
||||||
pkginclude_HEADERS = eoEOReceiveMessFrom.h \
|
|
||||||
eoEOSendMessFrom.h \
|
|
||||||
eoHeaderMessFrom.h \
|
|
||||||
eoKillMessFrom.h \
|
|
||||||
eoPublishMessFrom.h
|
|
||||||
|
|
||||||
### Makefile.am ends here
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoEOReceiveMessFrom.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoEOReceiveMessFrom_h
|
|
||||||
#define eoEOReceiveMessFrom_h
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <paradisEO/comm/messages/eoMessFrom.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
A message expressing the need of immigration of EO ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT> class eoEOReceiveMessFrom : public eoMessFrom <EOT> {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoEOReceiveMessFrom (eoLocalListener <EOT> & _loc_listen) :
|
|
||||||
eoMessFrom <EOT> (_loc_listen) {
|
|
||||||
|
|
||||||
// Nothing else to receive :-)
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator () () {
|
|
||||||
|
|
||||||
loc_listen.need_immigration () = true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoEOSendMessFrom.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoEOSendMessFrom_h
|
|
||||||
#define eoEOSendMessFrom_h
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#ifdef HAVE_SSTREAM
|
|
||||||
#include <sstream>
|
|
||||||
#else
|
|
||||||
#include <strstream.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <paradisEO/comm/messages/eoMessFrom.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
A message embeding a set of immigrants ...
|
|
||||||
*/
|
|
||||||
template <class EOT> class eoEOSendMessFrom : public eoMessFrom <EOT>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor
|
|
||||||
*/
|
|
||||||
eoEOSendMessFrom (eoLocalListener <EOT> & _loc_listen)
|
|
||||||
: eoMessFrom <EOT> (_loc_listen) {
|
|
||||||
MPI :: Status stat ;
|
|
||||||
comm.Probe (loc_listen.number (), 0, stat) ;
|
|
||||||
int len = stat.Get_count (MPI :: CHAR) ;
|
|
||||||
char buff [len] ;
|
|
||||||
comm.Recv(buff, len, MPI::CHAR, loc_listen.number (), 0) ;
|
|
||||||
#ifdef HAVE_SSTREAM
|
|
||||||
std::istringstream f(buff);
|
|
||||||
#else
|
|
||||||
istrstream f(buff);
|
|
||||||
#endif
|
|
||||||
_pop.readFrom(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void operator() () {
|
|
||||||
loc_listen.push (_pop) ;
|
|
||||||
// std::cout << "Reception de " << pop.size () << "individus " << std::endl ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
eoPop <EOT> _pop ; // New immigrants !
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoHeaderMessFrom.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoHeaderMessFrom_h
|
|
||||||
#define eoHeaderMessFrom_h
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <mpi.h>
|
|
||||||
|
|
||||||
template <class EOT> class eoLocalListener ;
|
|
||||||
|
|
||||||
/**
|
|
||||||
A header is an identifier for the kind of
|
|
||||||
message to be then received ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT> class eoHeaderMessFrom : public std::string {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Second constructor. On contrary, the header is
|
|
||||||
waited for and built from the local listener.
|
|
||||||
It comes before a message.
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoHeaderMessFrom (eoLocalListener <EOT> & loc_listen) :
|
|
||||||
comm (MPI :: COMM_WORLD) {
|
|
||||||
|
|
||||||
MPI :: Status stat ;
|
|
||||||
comm.Probe (loc_listen.number (), 0, stat) ; // Blocking
|
|
||||||
int len = stat.Get_count (MPI :: CHAR) ;
|
|
||||||
char buff [len] ; // Temp. buffer
|
|
||||||
comm.Recv (buff, len, MPI :: CHAR, loc_listen.number (), 0) ;
|
|
||||||
assign (buff) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private :
|
|
||||||
|
|
||||||
MPI :: Comm & comm ; // Communicator
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoKillMessFrom.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoKillMessFrom_h
|
|
||||||
#define eoKillMessFrom_h
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <paradisEO/comm/messages/eoMessFrom.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
To destroy current process ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT> class eoKillMessFrom : public eoMessFrom <EOT> {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoKillMessFrom (eoLocalListener <EOT> & _loc_listen) :
|
|
||||||
eoMessFrom <EOT> (_loc_listen) {
|
|
||||||
|
|
||||||
// Nothing else to receive :-)
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator () () {
|
|
||||||
|
|
||||||
loc_listen.destroy () ;
|
|
||||||
}
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoPublishMessFrom.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoPublishMessFrom_h
|
|
||||||
#define eoPublishMessFrom_h
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <paradisEO/comm/messages/eoMessFrom.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
To be notified of the lauch of a new kind of process somewhere ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT> class eoPublishMessFrom : public eoMessFrom <EOT> {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoPublishMessFrom (eoLocalListener <EOT> & _loc_listen) :
|
|
||||||
eoMessFrom <EOT> (_loc_listen) {
|
|
||||||
|
|
||||||
MPI :: Status stat ;
|
|
||||||
comm.Probe (loc_listen.number (), 0, stat) ;
|
|
||||||
int len = stat.Get_count (MPI :: CHAR) ;
|
|
||||||
char buff [len] ;
|
|
||||||
comm.Recv (buff, len, MPI :: CHAR, loc_listen.number (), 0) ;
|
|
||||||
label.assign (buff) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator () () {
|
|
||||||
|
|
||||||
loc_listen.label () = label ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private :
|
|
||||||
|
|
||||||
std::string label ; // String identifier ...
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
# Copyright (C) 2004 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
|
||||||
|
|
||||||
pkginclude_HEADERS = eoEOReceiveMessTo.h \
|
|
||||||
eoEOSendMessTo.h \
|
|
||||||
eoHeaderMessTo.h \
|
|
||||||
eoKillMessTo.h \
|
|
||||||
eoPublishMessTo.h
|
|
||||||
|
|
||||||
### Makefile.am ends here
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoEOReceiveMessTo.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
A message expressing an immigration need.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoEOReceiveMessTo_h
|
|
||||||
#define eoEOReceiveMessTo_h
|
|
||||||
|
|
||||||
#include <mpi.h>
|
|
||||||
#include <paradisEO/comm/messages/eoMessTo.h>
|
|
||||||
|
|
||||||
template <class EOT> class eoEOReceiveMessTo : public eoMessTo <EOT> {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoEOReceiveMessTo () : eoMessTo <EOT> ("eoEOReceiveMessTo") {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nothing else ! :-)
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoEOSendMessTo.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef eoEOSendMessTo_h
|
|
||||||
#define eoEOSendMessTo_h
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <mpi.h>
|
|
||||||
#ifdef HAVE_SSTREAM
|
|
||||||
#include <sstream>
|
|
||||||
#else
|
|
||||||
#include <strstream.h>
|
|
||||||
#endif
|
|
||||||
#include <eoPop.h>
|
|
||||||
#include <paradisEO/comm/messages/eoMessTo.h>
|
|
||||||
|
|
||||||
|
|
||||||
/** A message embeding immigrants to send to ... */
|
|
||||||
template <class EOT> class eoEOSendMessTo : public eoMessTo <EOT> {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoEOSendMessTo (eoPop <EOT> & _pop )
|
|
||||||
: eoMessTo <EOT> ("eoEOSendMessTo"),
|
|
||||||
pop (_pop)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/**
|
|
||||||
To send the given population ...
|
|
||||||
*/
|
|
||||||
void operator () (eoLocalListener <EOT> & loc_listen) {
|
|
||||||
eoMessTo <EOT> :: operator () (loc_listen) ;
|
|
||||||
#ifdef HAVE_SSTREAM
|
|
||||||
std::ostringstream f;
|
|
||||||
pop.printOn(f);
|
|
||||||
comm.Send(f.str().c_str(), f.str().size(), MPI::CHAR, loc_listen.number(), 0);
|
|
||||||
#else
|
|
||||||
std::ostrstream f;
|
|
||||||
pop.printOn (f);
|
|
||||||
comm.Send (f.str(), f.pcount(), MPI::CHAR, loc_listen.number(), 0);
|
|
||||||
#endif
|
|
||||||
loc_listen.need_immigration () = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
eoPop <EOT> & pop ; // The set of EO to send.
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
|
||||||
|
|
||||||
// "eoHeaderMessTo.h"
|
|
||||||
|
|
||||||
// (c) OPAC Team, LIFL, 2002
|
|
||||||
|
|
||||||
/* This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library 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
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
Contact: cahon@lifl.fr
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef eoHeaderMessTo_h
|
|
||||||
#define eoHeaderMessTo_h
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <mpi.h>
|
|
||||||
|
|
||||||
template <class EOT> class eoLocalListener ;
|
|
||||||
|
|
||||||
/**
|
|
||||||
A header is an identifier for the kind of
|
|
||||||
message to be then sent ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <class EOT> class eoHeaderMessTo : public std::string {
|
|
||||||
|
|
||||||
public :
|
|
||||||
|
|
||||||
/**
|
|
||||||
Constructor.
|
|
||||||
The std::string identifiant id given in parameter.
|
|
||||||
*/
|
|
||||||
|
|
||||||
eoHeaderMessTo (std::string label) :
|
|
||||||
|
|
||||||
std::string (label),
|
|
||||||
comm (MPI :: COMM_WORLD) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Emission of the header to the next process. The body message
|
|
||||||
should then follow ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
void operator () (eoLocalListener <EOT> & loc_listen) {
|
|
||||||
|
|
||||||
comm.Send (c_str (), size () + 1, MPI :: CHAR, loc_listen.number (), 0) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
private :
|
|
||||||
|
|
||||||
MPI :: Comm & comm ; // Communicator
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Reference in a new issue