]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (C) 2005, 2006 Douglas Gregor <doug.gregor -at- gmail.com>. |
2 | ||
3 | // Use, modification and distribution is subject to the Boost Software | |
4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | // Allows broadcast of skeletons via proxy. | |
8 | ||
9 | // This header may only be included after both the broadcast.hpp and | |
10 | // and skeleton_and_content.hpp headers have been included. | |
11 | #ifndef BOOST_MPI_BROADCAST_SC_HPP | |
12 | #define BOOST_MPI_BROADCAST_SC_HPP | |
13 | ||
14 | namespace boost { namespace mpi { | |
15 | ||
16 | template<typename T> | |
17 | inline void | |
18 | broadcast(const communicator& comm, skeleton_proxy<T>& proxy, int root) | |
19 | { | |
20 | const skeleton_proxy<T>& const_proxy(proxy); | |
21 | broadcast(comm, const_proxy, root); | |
22 | } | |
23 | ||
24 | template<typename T> | |
25 | void | |
26 | broadcast(const communicator& comm, const skeleton_proxy<T>& proxy, int root) | |
27 | { | |
28 | if (comm.rank() == root) { | |
29 | packed_skeleton_oarchive oa(comm); | |
30 | oa << proxy.object; | |
31 | broadcast(comm, oa, root); | |
32 | } else { | |
33 | packed_skeleton_iarchive ia(comm); | |
34 | broadcast(comm, ia, root); | |
35 | ia >> proxy.object; | |
36 | } | |
37 | } | |
38 | ||
39 | } } // end namespace boost::mpi | |
40 | ||
41 | #endif // BOOST_MPI_BROADCAST_SC_HPP |