Update of /cvsroot/boost/boost/libs/mpi/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21369/libs/mpi/src

Modified Files:
        communicator.cpp 
Log Message:
Support building communicators from groups and comparing communicators

Index: communicator.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/mpi/src/communicator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- communicator.cpp    17 Jan 2007 02:48:50 -0000      1.1
+++ communicator.cpp    31 May 2007 16:02:07 -0000      1.2
@@ -4,6 +4,7 @@
 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 #include <boost/mpi/communicator.hpp>
+#include <boost/mpi/group.hpp>
 #include <boost/mpi/skeleton_and_content.hpp>
 #include <boost/mpi/detail/point_to_point.hpp>
 
@@ -52,7 +53,15 @@
     comm_ptr.reset(new MPI_Comm(comm));
     break;
   }
- }
+}
+
+communicator::communicator(const communicator& comm, const group& subgroup)
+{
+  MPI_Comm newcomm;
+  BOOST_MPI_CHECK_RESULT(MPI_Comm_create, 
+                         ((MPI_Comm)comm, (MPI_Group)subgroup, &newcomm));
+  comm_ptr.reset(new MPI_Comm(newcomm), comm_free());
+}
 
 int communicator::size() const
 {
@@ -264,4 +273,12 @@
   return req;
 }
 
+bool operator==(const communicator& comm1, const communicator& comm2)
+{
+  int result;
+  BOOST_MPI_CHECK_RESULT(MPI_Comm_compare,
+                         ((MPI_Comm)comm1, (MPI_Comm)comm2, &result));
+  return result == MPI_IDENT;
+}
+
 } } // end namespace boost::mpi


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to