From 3cb80bc73b33c340fa75a13a09154b18ebbc4634 Mon Sep 17 00:00:00 2001 From: kuepper Date: Wed, 22 Sep 2004 12:38:28 +0000 Subject: [PATCH] update build process to include paradiseo tutorial, fix paradiseo headers for sstream --- eo/configure.in | 2 + eo/src/eoPop.h | 3 +- eo/src/paradisEO/comm/eoListener.h | 3 +- eo/src/paradisEO/comm/eoLocalListener.h | 5 +- .../comm/messages/from/eoEOSendMessFrom.h | 65 +++++++++---------- .../comm/messages/to/eoEOSendMessTo.h | 62 ++++++++++-------- eo/tutorial/ParadisEO/Lesson2/.cvsignore | 1 + eo/tutorial/ParadisEO/Lesson2/Makefile.am | 17 +++++ .../ParadisEO/Lesson2/MasterDistEvalBitEA.cpp | 9 ++- .../ParadisEO/Lesson2/SlaveDistEvalBitEA.cpp | 12 +++- eo/tutorial/ParadisEO/Lesson3/.cvsignore | 1 + .../ParadisEO/Lesson3/CellularBitEA.cpp | 10 ++- eo/tutorial/ParadisEO/Lesson3/Makefile.am | 15 +++++ eo/tutorial/ParadisEO/Makefile.am | 2 +- 14 files changed, 139 insertions(+), 68 deletions(-) create mode 100644 eo/tutorial/ParadisEO/Lesson2/.cvsignore create mode 100644 eo/tutorial/ParadisEO/Lesson2/Makefile.am create mode 100644 eo/tutorial/ParadisEO/Lesson3/.cvsignore create mode 100644 eo/tutorial/ParadisEO/Lesson3/Makefile.am diff --git a/eo/configure.in b/eo/configure.in index bd1ca3681..501f4e2b1 100644 --- a/eo/configure.in +++ b/eo/configure.in @@ -69,4 +69,6 @@ AC_OUTPUT(Makefile \ tutorial/Lesson5/Makefile \ tutorial/ParadisEO/Makefile \ tutorial/ParadisEO/Lesson1/Makefile \ + tutorial/ParadisEO/Lesson2/Makefile \ + tutorial/ParadisEO/Lesson3/Makefile \ win/Makefile) diff --git a/eo/src/eoPop.h b/eo/src/eoPop.h index 06babccaf..1829ddc1a 100644 --- a/eo/src/eoPop.h +++ b/eo/src/eoPop.h @@ -25,9 +25,10 @@ #ifndef _EOPOP_H #define _EOPOP_H -#include #include +#include #include // needed for GCC 3.2 +#include // EO includes #include // for eoInit diff --git a/eo/src/paradisEO/comm/eoListener.h b/eo/src/paradisEO/comm/eoListener.h index 6ac32f5bb..1f085e1e9 100644 --- a/eo/src/paradisEO/comm/eoListener.h +++ b/eo/src/paradisEO/comm/eoListener.h @@ -24,11 +24,12 @@ #ifndef eoListener_h #define eoListener_h +#include #include + #include #include #include -#include /** Necessary for any use of a distributed model. diff --git a/eo/src/paradisEO/comm/eoLocalListener.h b/eo/src/paradisEO/comm/eoLocalListener.h index b11e21768..0c2d79168 100644 --- a/eo/src/paradisEO/comm/eoLocalListener.h +++ b/eo/src/paradisEO/comm/eoLocalListener.h @@ -24,16 +24,17 @@ #ifndef eoLocalListener_h #define eoLocalListener_h +#include #include #include +#include + #include #include #include #include #include #include -#include -#include /** A local listener to pack any coming message or, on contrary, to diff --git a/eo/src/paradisEO/comm/messages/from/eoEOSendMessFrom.h b/eo/src/paradisEO/comm/messages/from/eoEOSendMessFrom.h index 01cc5d0f1..442c9bcbc 100644 --- a/eo/src/paradisEO/comm/messages/from/eoEOSendMessFrom.h +++ b/eo/src/paradisEO/comm/messages/from/eoEOSendMessFrom.h @@ -28,6 +28,7 @@ #include #endif +#include #include #include #ifdef HAVE_SSTREAM @@ -35,49 +36,47 @@ #else #include #endif -#include + #include -using namespace std; + /** A message embeding a set of immigrants ... */ - -template class eoEOSendMessFrom : public eoMessFrom { +template class eoEOSendMessFrom : public eoMessFrom +{ +public: -public : + /** + Constructor + */ + eoEOSendMessFrom (eoLocalListener & _loc_listen) + : eoMessFrom (_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); + } + + - /** - Constructor - */ + void operator() () { + loc_listen.push (_pop) ; + // std::cout << "Reception de " << pop.size () << "individus " << std::endl ; + } - eoEOSendMessFrom (eoLocalListener & _loc_listen) : - eoMessFrom (_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) ; - // std::cout << "Reception de " << pop.size () << "individus " << std::endl ; - } +protected: -private : - - eoPop pop ; // New immigrants ! - -} ; + eoPop _pop ; // New immigrants ! +}; #endif - - - diff --git a/eo/src/paradisEO/comm/messages/to/eoEOSendMessTo.h b/eo/src/paradisEO/comm/messages/to/eoEOSendMessTo.h index 127214c73..a5f4dfa71 100644 --- a/eo/src/paradisEO/comm/messages/to/eoEOSendMessTo.h +++ b/eo/src/paradisEO/comm/messages/to/eoEOSendMessTo.h @@ -21,49 +21,59 @@ Contact: cahon@lifl.fr */ -/** - A message embeding immigrants to send to ... -*/ #ifndef eoEOSendMessTo_h #define eoEOSendMessTo_h +#ifdef HAVE_CONFIG_H +#include +#endif + #include +#ifdef HAVE_SSTREAM +#include +#else #include +#endif #include #include + +/** A message embeding immigrants to send to ... */ template class eoEOSendMessTo : public eoMessTo { public : - /** - Constructor ... - */ + /** + Constructor ... + */ - eoEOSendMessTo (eoPop & _pop ) - : eoMessTo ("eoEOSendMessTo"), - pop (_pop) - {} + eoEOSendMessTo (eoPop & _pop ) + : eoMessTo ("eoEOSendMessTo"), + pop (_pop) + {} + + /** + To send the given population ... + */ + void operator () (eoLocalListener & loc_listen) { + eoMessTo :: 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; + } - /** - To send the given population ... - */ - void operator () (eoLocalListener & loc_listen) { - - eoMessTo :: operator () (loc_listen) ; - - std::ostrstream f ; - pop.printOn (f) ; - comm.Send (f.str (), f.pcount (), MPI :: CHAR, loc_listen.number (), 0) ; - loc_listen.need_immigration () = false ; - } - -private : - - eoPop & pop ; // The set of EO to send. +protected: + eoPop & pop ; // The set of EO to send. } ; #endif diff --git a/eo/tutorial/ParadisEO/Lesson2/.cvsignore b/eo/tutorial/ParadisEO/Lesson2/.cvsignore new file mode 100644 index 000000000..70845e08e --- /dev/null +++ b/eo/tutorial/ParadisEO/Lesson2/.cvsignore @@ -0,0 +1 @@ +Makefile.in diff --git a/eo/tutorial/ParadisEO/Lesson2/Makefile.am b/eo/tutorial/ParadisEO/Lesson2/Makefile.am new file mode 100644 index 000000000..8a856631e --- /dev/null +++ b/eo/tutorial/ParadisEO/Lesson2/Makefile.am @@ -0,0 +1,17 @@ +noinst_PROGRAMS = MasterDistEvalBitEA SlaveDistEvalBitEA + +LIBEO = $(top_builddir)/src/libeo.a +LIBEOUTILS = $(top_builddir)/src/utils/libeoutils.a + +CXX = $(MPICXX) +LD = $(MPICXX) +AM_CXXFLAGS = -I$(top_srcdir)/src +DEPS = $(LIBEOUTILS) $(LIBEO) +LIBS = $(LIBEOUTILS) $(LIBEO) + + +noinst_HEADERS = binary_value.h + +MasterDistEvalBitEA_SOURCES = MasterDistEvalBitEA.cpp + +SlaveDistEvalBitEA_SOURCES = SlaveDistEvalBitEA.cpp diff --git a/eo/tutorial/ParadisEO/Lesson2/MasterDistEvalBitEA.cpp b/eo/tutorial/ParadisEO/Lesson2/MasterDistEvalBitEA.cpp index 0d61b5018..e98e3d0d5 100644 --- a/eo/tutorial/ParadisEO/Lesson2/MasterDistEvalBitEA.cpp +++ b/eo/tutorial/ParadisEO/Lesson2/MasterDistEvalBitEA.cpp @@ -1,6 +1,13 @@ -#include +#ifdef HAVE_CONFIG_H +#include +#endif + #include +#ifdef HAVE_SSTREAM +#include +#else #include +#endif #include #include diff --git a/eo/tutorial/ParadisEO/Lesson2/SlaveDistEvalBitEA.cpp b/eo/tutorial/ParadisEO/Lesson2/SlaveDistEvalBitEA.cpp index c6cd8969e..cf7a9420a 100644 --- a/eo/tutorial/ParadisEO/Lesson2/SlaveDistEvalBitEA.cpp +++ b/eo/tutorial/ParadisEO/Lesson2/SlaveDistEvalBitEA.cpp @@ -1,6 +1,14 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include #include // runtime_error -#include // cout -#include // ostrstream, istrstream +#ifdef HAVE_SSTREAM +#include +#else +#include +#endif #include #include diff --git a/eo/tutorial/ParadisEO/Lesson3/.cvsignore b/eo/tutorial/ParadisEO/Lesson3/.cvsignore new file mode 100644 index 000000000..70845e08e --- /dev/null +++ b/eo/tutorial/ParadisEO/Lesson3/.cvsignore @@ -0,0 +1 @@ +Makefile.in diff --git a/eo/tutorial/ParadisEO/Lesson3/CellularBitEA.cpp b/eo/tutorial/ParadisEO/Lesson3/CellularBitEA.cpp index 42cb4a958..f1773cc0e 100644 --- a/eo/tutorial/ParadisEO/Lesson3/CellularBitEA.cpp +++ b/eo/tutorial/ParadisEO/Lesson3/CellularBitEA.cpp @@ -1,6 +1,14 @@ -#include +#ifdef HAVE_CONFIG_H +#include +#endif + #include +#include // runtime_error +#ifdef HAVE_SSTREAM +#include +#else #include +#endif #include #include diff --git a/eo/tutorial/ParadisEO/Lesson3/Makefile.am b/eo/tutorial/ParadisEO/Lesson3/Makefile.am new file mode 100644 index 000000000..13dbcc309 --- /dev/null +++ b/eo/tutorial/ParadisEO/Lesson3/Makefile.am @@ -0,0 +1,15 @@ +noinst_PROGRAMS = CellularBitEA + +LIBEO = $(top_builddir)/src/libeo.a +LIBEOUTILS = $(top_builddir)/src/utils/libeoutils.a + +CXX = $(MPICXX) +LD = $(MPICXX) +AM_CXXFLAGS = -I$(top_srcdir)/src +DEPS = $(LIBEOUTILS) $(LIBEO) +LIBS = $(LIBEOUTILS) $(LIBEO) + + +noinst_HEADERS = binary_value.h + +CellularBitEA_SOURCES = CellularBitEA.cpp diff --git a/eo/tutorial/ParadisEO/Makefile.am b/eo/tutorial/ParadisEO/Makefile.am index 3bdf4ca5b..d1890d249 100644 --- a/eo/tutorial/ParadisEO/Makefile.am +++ b/eo/tutorial/ParadisEO/Makefile.am @@ -1 +1 @@ -SUBDIRS = Lesson1 \ No newline at end of file +SUBDIRS = Lesson1 Lesson2 Lesson3