Chris@16: // Copyright (C) 2005-2006 Alain Miniussi . Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software Chris@16: // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // Message Passing Interface 1.1 -- Section 4. MPI Collectives Chris@16: Chris@16: /** @file inplace.hpp Chris@16: * Chris@16: * This header provides helpers to indicate to MPI collective operation Chris@16: * that a buffer can be use both as an input and output. Chris@16: */ Chris@16: #ifndef BOOST_MPI_INPLACE_HPP Chris@16: #define BOOST_MPI_INPLACE_HPP Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace mpi { Chris@16: Chris@16: /** Chris@16: * @brief Wrapper type to explicitly indicate that a input data Chris@16: * can be overriden with an output value. Chris@16: */ Chris@16: template Chris@16: struct inplace_t { Chris@16: inplace_t(T& inout) : buffer(inout) {} Chris@16: T& buffer; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct inplace_t { Chris@16: inplace_t(T* inout) : buffer(inout) {} Chris@16: T* buffer; Chris@16: }; Chris@16: Chris@16: Chris@16: /** Chris@16: * @brief Wrapp a input data to indicate that it can be overriden Chris@16: * with an ouput value. Chris@16: * @param inout the contributing input value, it will be overriden Chris@16: * with the output value where one is expected. If it is a pointer, Chris@16: * the number of elements will be provided separatly. Chris@16: * @returns The wrapped value or pointer. Chris@16: */ Chris@16: template Chris@16: inplace_t Chris@16: inplace(T& inout) { Chris@16: return inplace_t(inout); Chris@16: } Chris@16: /** Chris@16: * \overload Chris@16: */ Chris@16: template Chris@16: inplace_t Chris@16: inplace(T* inout) { Chris@16: return inplace_t(inout); Chris@16: } Chris@16: } } // end namespace boost::mpi Chris@16: Chris@16: #endif // BOOST_MPI_INPLACE_HPP Chris@16: