1 // Copyright (C) 2005-2006 Alain Miniussi <alain.miniussi -at- oca.eu>.
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)
7 // Message Passing Interface 1.1 -- Section 4. MPI Collectives
11 * This header provides helpers to indicate to MPI collective operation
12 * that a buffer can be use both as an input and output.
14 #ifndef BOOST_MPI_INPLACE_HPP
15 #define BOOST_MPI_INPLACE_HPP
17 #include <boost/mpi/communicator.hpp>
20 namespace boost { namespace mpi {
23 * @brief Wrapper type to explicitly indicate that a input data
24 * can be overriden with an output value.
28 inplace_t(T& inout) : buffer(inout) {}
33 struct inplace_t<T*> {
34 inplace_t(T* inout) : buffer(inout) {}
40 * @brief Wrapp a input data to indicate that it can be overriden
41 * with an ouput value.
42 * @param inout the contributing input value, it will be overriden
43 * with the output value where one is expected. If it is a pointer,
44 * the number of elements will be provided separatly.
45 * @returns The wrapped value or pointer.
50 return inplace_t<T>(inout);
58 return inplace_t<T*>(inout);
60 } } // end namespace boost::mpi
62 #endif // BOOST_MPI_INPLACE_HPP