]>
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 | ||
7c673cae FG |
16 | template<typename T> |
17 | void | |
18 | broadcast(const communicator& comm, const skeleton_proxy<T>& proxy, int root) | |
19 | { | |
20 | if (comm.rank() == root) { | |
21 | packed_skeleton_oarchive oa(comm); | |
22 | oa << proxy.object; | |
23 | broadcast(comm, oa, root); | |
24 | } else { | |
25 | packed_skeleton_iarchive ia(comm); | |
26 | broadcast(comm, ia, root); | |
27 | ia >> proxy.object; | |
28 | } | |
29 | } | |
30 | ||
92f5a8d4 TL |
31 | template<typename T> |
32 | inline void | |
33 | broadcast(const communicator& comm, skeleton_proxy<T>& proxy, int root) | |
34 | { | |
35 | const skeleton_proxy<T>& const_proxy(proxy); | |
36 | broadcast(comm, const_proxy, root); | |
37 | } | |
38 | ||
39 | ||
7c673cae FG |
40 | } } // end namespace boost::mpi |
41 | ||
42 | #endif // BOOST_MPI_BROADCAST_SC_HPP |