1 #ifndef _RHEO_MSG_UTIL_H
2 #define _RHEO_MSG_UTIL_H
31 # include "rheolef/distributed.h"
35 #ifndef RHEO_MPI_PRUDENCE
36 #define RHEO_MPI_PRUDENCE 0
40 template <
class T1,
class T2>
41 struct select1st : std::unary_function<std::pair<T1,T2>, T1> {
42 T1
operator() (
const std::pair<T1,T2>& x)
const {
return x.first; }
44 template <
class T1,
class T2>
45 struct select2nd : std::unary_function<std::pair<T1,T2>, T2> {
46 T2
operator() (
const std::pair<T1,T2>& x)
const {
return x.second; }
55 template <
class T1,
class T2>
56 struct set_op : std::binary_function<T1,T2,T1> {
57 T1&
operator()(T1& x,
const T2& y)
const {
return x = y; }
60 template <
class T1,
class T2>
62 T1&
operator()(T1& x,
const T2& y)
const {
return x += y; }
66 template <
class T,
class Distance = std::ptrdiff_t>
67 class dummy_iterator :
public std::iterator<std::input_iterator_tag, T, Distance, const T*, const T&> {
78 template <
class Size,
class Distance = std::ptrdiff_t>
79 class index_iterator :
public std::iterator<std::input_iterator_tag, Size, Distance, const Size*, const Size&> {
88 const Size&
operator[](
const Size& i)
const {
return i; }
92 return !(x.
_i ==
_i); }
101 :
public std::unary_function<Pair,typename Pair::first_type> {
102 typename std::unary_function<Pair,typename Pair::first_type>::result_type
107 template <
class Pair>
109 :
public std::unary_function<Pair, typename Pair::second_type> {
110 typename std::unary_function<Pair,typename Pair::second_type>::result_type
116 template<
class Pair1,
class Pair2>
119 return Pair2(x.first, x.second); }
122 template <
class Iterator,
class Operator>
139 template <
class Iterator,
class Operator>
146 template <
class InputIterator,
class OutputIterator>
149 OutputIterator result) {
150 while (input != last) {
151 (*result).first = (*input).first;
152 (*result++).second = (*input++).second;
bool operator==(apply_iterator< Iterator, Operator > b) const
bool operator!=(apply_iterator< Iterator, Operator > b) const
apply_iterator(Iterator i1, Operator op1)
apply_iterator & operator++()
value_type operator*() const
apply_iterator operator++(int)
Operator::result_type value_type
dummy_iterator< T, Distance > operator++(int)
const T & operator*() const
dummy_iterator< T, Distance > & operator++()
const Size & operator[](const Size &i) const
bool operator!=(const index_iterator< Size, Distance > &x) const
const Size & operator*() const
bool operator==(const index_iterator< Size, Distance > &x) const
index_iterator(Size i0=0)
index_iterator operator++(int)
index_iterator & operator++()
This file is part of Rheolef.
OutputIterator msg_pair_copy(InputIterator input, InputIterator last, OutputIterator result)
apply_iterator< Iterator, Operator > make_apply_iterator(Iterator i, Operator op)
bool operator()(const T &x) const
std::unary_function< Pair, typename Pair::first_type >::result_type operator()(const Pair &x) const
Pair2 operator()(const Pair1 &x) const
std::unary_function< Pair, typename Pair::second_type >::result_type operator()(const Pair &x) const
T1 operator()(const std::pair< T1, T2 > &x) const
T2 operator()(const std::pair< T1, T2 > &x) const
T1 & operator()(T1 &x, const T2 &y) const
T1 & operator()(T1 &x, const T2 &y) const