*** empty log message ***

This commit is contained in:
cahon 2002-03-29 15:16:11 +00:00
commit d31c5942c4
11 changed files with 711 additions and 0 deletions

View file

@ -0,0 +1,66 @@
// -*- 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

View file

@ -0,0 +1,64 @@
// -*- 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

View file

@ -0,0 +1,72 @@
// -*- 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
#include <string>
#include <strstream.h>
#include <mpi.h>
#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) ;
istrstream f (buff) ;
pop.readFrom (f) ;
}
void operator () () {
loc_listen.push (pop) ;
// cout << "Reception de " << pop.size () << "individus " << endl ;
}
private :
eoPop <EOT> pop ; // New immigrants !
} ;
#endif

View file

@ -0,0 +1,65 @@
// -*- 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 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

View file

@ -0,0 +1,64 @@
// -*- 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

View file

@ -0,0 +1,68 @@
// -*- 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 :
string label ; // String identifier ...
} ;
#endif

View file

@ -0,0 +1,52 @@
// -*- 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

View file

@ -0,0 +1,71 @@
// -*- 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
*/
/**
A message embeding immigrants to send to ...
*/
#ifndef eoEOSendMessTo_h
#define eoEOSendMessTo_h
#include <mpi.h>
#include <strstream.h>
#include <eoPop.h>
#include <paradisEO/comm/messages/eoMessTo.h>
template <class EOT> class eoEOSendMessTo : public eoMessTo <EOT> {
public :
/**
Constructor ...
*/
eoEOSendMessTo (eoPop <EOT> & _pop
) :
pop (_pop),
eoMessTo <EOT> ("eoEOSendMessTo") {
}
/**
To send the given population ...
*/
void operator () (eoLocalListener <EOT> & loc_listen) {
eoMessTo <EOT> :: operator () (loc_listen) ;
ostrstream f ;
pop.printOn (f) ;
comm.Send (f.str (), f.pcount (), MPI :: CHAR, loc_listen.number (), 0) ;
loc_listen.need_immigration () = false ;
}
private :
eoPop <EOT> & pop ; // The set of EO to send.
} ;
#endif

View file

@ -0,0 +1,71 @@
// -*- 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 string {
public :
/**
Constructor.
The string identifiant id given in parameter.
*/
eoHeaderMessTo (string label) :
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

View file

@ -0,0 +1,52 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// "eoKillMessTo.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
*/
/**
To destroy a distant agent ...
*/
#ifndef eoKillMessTo_h
#define eoKillMessTo_h
#include <mpi.h>
#include <paradisEO/comm/messages/eoMessTo.h>
template <class EOT> class eoKillMessTo : public eoMessTo <EOT> {
public :
/**
Constructor ...
*/
eoKillMessTo () : eoMessTo <EOT> ("eoKillMessTo") {
}
// Nothing else ! :-)
} ;
#endif

View file

@ -0,0 +1,66 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// "eoPublishMessTo.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
*/
/**
To let know from distributed algos the string identifier
of the home process ...
*/
#ifndef eoPublishMessTo_h
#define eoPublishMessTo_h
#include <mpi.h>
#include <string.h>
#include <paradisEO/comm/messages/eoMessTo.h>
#include <paradisEO/comm/eoLocalListener.h>
template <class EOT> class eoPublishMessTo : public eoMessTo <EOT> {
public :
/**
Constructor
*/
eoPublishMessTo (string & _label
) :
eoMessTo <EOT> ("eoPublishMessTo"),
label (_label) {
}
void operator () (eoLocalListener <EOT> & loc_listen) {
eoMessTo <EOT> :: operator () (loc_listen) ;
comm.Send (label.c_str (), label.size () + 1, MPI :: CHAR, loc_listen.number (), 0) ;
}
private :
string label ; // String identifier to send ...
} ;
#endif