Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:57

0001 // Copyright (C) 2005, 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
0002 
0003 // Use, modification and distribution is subject to the Boost Software
0004 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // Allows broadcast of skeletons via proxy.
0008 
0009 // This header may only be included after both the broadcast.hpp and
0010 // and skeleton_and_content.hpp headers have been included.
0011 #ifndef BOOST_MPI_BROADCAST_SC_HPP
0012 #define BOOST_MPI_BROADCAST_SC_HPP
0013 
0014 namespace boost { namespace mpi {
0015 
0016 template<typename T>
0017 void
0018 broadcast(const communicator& comm, const skeleton_proxy<T>& proxy, int root)
0019 {
0020   if (comm.rank() == root) {
0021     packed_skeleton_oarchive oa(comm);
0022     oa << proxy.object;
0023     broadcast(comm, oa, root);
0024   } else {
0025     packed_skeleton_iarchive ia(comm);
0026     broadcast(comm, ia, root);
0027     ia >> proxy.object;
0028   }
0029 }
0030 
0031 template<typename T>
0032 inline void
0033 broadcast(const communicator& comm, skeleton_proxy<T>& proxy, int root)
0034 {
0035   const skeleton_proxy<T>& const_proxy(proxy);
0036   broadcast(comm, const_proxy, root);
0037 }
0038 
0039 
0040 } } // end namespace boost::mpi
0041 
0042 #endif // BOOST_MPI_BROADCAST_SC_HPP