an efficient C++ finite element environment
|
|
Go to the documentation of this file. 1 #ifndef _RHEOLEF_PAIR_SET_H
2 #define _RHEOLEF_PAIR_SET_H
36 #include "rheolef/distributed.h"
37 #include "rheolef/pretty_name.h"
38 #include "rheolef/container_traits.h"
39 #ifdef _RHEOLEF_HAVE_MPI
40 #include "rheolef/mpi_pair_datatype.h"
41 #endif // _RHEOLEF_HAVE_MPI
43 #include <boost/serialization/map.hpp>
44 #include <boost/serialization/base_object.hpp>
66 template<
class T,
class A = std::allocator<std::pair<std::
size_t,T> > >
67 class pair_set:
public std::map<std::size_t, T, std::less<std::size_t> > {
77 typedef std::map<size_type, T, std::less<size_type> >
101 template <
class Archive>
105 template <
class T,
class A>
107 template <
class T,
class A>
115 T&
operator()(
T& x,
const typename T::pair_type& y)
const {
return x += y; }
116 T&
operator()(
T& x,
const typename T::const_pair_type& y)
const {
return x += y; }
119 template <
class T,
class A>
123 template <
class T,
class A>
127 #ifdef _RHEOLEF_HAVE_MPI
129 template <
class T,
class A>
132 boost::mpi::is_mpi_datatype<T>::value
138 typename std::conditional<
139 boost::mpi::is_mpi_datatype<T>::value
145 #endif // _RHEOLEF_HAVE_MPI
149 template <
class T,
class A>
155 template <
class T,
class A>
162 template <
class T,
class A>
168 if (
p == base::end()) {
173 (*p).second += x.second;
177 template <
class T,
class A>
178 template <
class Archive>
182 ar & boost::serialization::base_object<base>(*
this);
187 template <
class T,
class A>
191 for (
const_iterator iter =
a.base::begin(), last =
a.base::end(); iter != last; iter++) {
192 base::insert (*iter);
195 template <
class T,
class A>
200 for (
const_iterator iter =
a.base::begin(), last =
a.base::end(); iter != last; iter++) {
201 base::insert (*iter);
205 template <
class T,
class A>
215 template <
class T,
class A>
226 is >> xi.first >> xi.second;
231 template <
class T,
class A>
237 os <<
a.size() <<
"\t";
238 for (
const_iterator iter =
a.begin(), last =
a.end(); iter != last; iter++) {
239 os <<
" " << (*iter).first <<
" " << (*iter).second;
245 #endif // _RHEOLEF_PAIR_SET_H
T & operator()(T &x, const T &y) const
std::enable_if< details::is_rheolef_arithmetic< U >::value,ad3_basic< T > & >::type operator+=(ad3_basic< T > &a, const U &b)
std::pair< size_type, T > pair_type
std::map< size_type, T, std::less< size_type > > base
base::allocator_type allocator_type
pair_set(const A &alloc=A())
T & operator()(T &x, const typename T::const_pair_type &y) const
pair_set_add_op< pair_set< T, A > > type
std::conditional< boost::mpi::is_mpi_datatype< T >::value,std::true_type,std::false_type >::type type
std::pair< const size_type, T > const_pair_type
std::istream & operator>>(std::istream &is, const catchmark &m)
This file is part of Rheolef.
base::const_iterator const_iterator
T & operator()(T &x, const typename T::pair_type &y) const
field::size_type size_type
pair_set< T, A > & operator=(const pair_set< T, A > &x)
pair_set< T, A > & operator+=(const pair_type &x)
void serialize(Archive &ar, const unsigned int version)
std::ostream & operator<<(std::ostream &os, const catchmark &m)
pair_set(const pair_set< T, A > &x, const A &alloc=A())