~ubuntu-branches/ubuntu/wily/rheolef/wily

« back to all changes in this revision

Viewing changes to skit/plib2/index_set.h

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2013-04-30 11:29:51 UTC
  • mfrom: (1.2.1) (11.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130430112951-g69nuqin77t75dek
Tags: 6.4-1
[ Pierre Saramito ]
* New upstream release 6.4 (major changes):
  - new powerful c++ expressions for FEM specifications
  - configure script improved (portability increased)
  - minor bug fixes
* control:
  - all architectures are considered (armel & armhf are back)
  - no more circular-dependency librheolef-dev <--> rheolef
* rules: add security compiler flags (hardening and -W,-l,relro)
* watch: include an updated version, thanks to B. Martens <bartm@debian.org>
* copyright: various file format fixes

[ Sylvestre Ledru ]
*  Standards-Version updated to 3.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
21
///
22
22
/// =========================================================================
 
23
// wrapper for std::set<size_t>: union as a+b and a += b and others goodies
 
24
//
 
25
// motivation: this class is usefull for array<index_set,M> to send/receive variable-sized
 
26
// lists via MPI correctly
 
27
// array<index_set,M> is used by the geo class to manage connectivity
 
28
// and compute neighbours
 
29
//
 
30
// author: Pierre.Saramito@imag.fr
 
31
//
 
32
// date: 19 mai 2012
 
33
//
23
34
#include "rheolef/distributed.h"
24
35
#include "rheolef/pretty_name.h"
25
 
#include "rheolef/array.h" // for is_container_of_mpi_datatype ; TODO: move
 
36
#include "rheolef/container_traits.h"
26
37
 
27
38
#include <boost/serialization/set.hpp>
28
39
#include <boost/serialization/base_object.hpp>
29
 
#ifdef TO_CLEAN
30
 
#include <boost/serialization/list.hpp>
31
 
#include <boost/serialization/string.hpp>
32
 
#include <boost/serialization/version.hpp>
33
 
#include <boost/serialization/split_free.hpp>
34
 
#include <boost/serialization/split_member.hpp>
35
 
#endif // TO_CLEAN
36
 
 
37
 
 
38
40
namespace rheolef {
39
41
 
40
42
/*Class:index_set
93
95
};
94
96
//>verbatim:
95
97
 
 
98
// operator += for array::assembly
 
99
template <class T>
 
100
struct index_set_add_op : std::binary_function<T,T,T> {
 
101
    T& operator()(T& x, const T&                      y) const { return x += y; }
 
102
    T& operator()(T& x, const typename T::value_type& y) const { return x += y; }
 
103
};
96
104
// for boost mpi and array<index_set>:
97
 
template <>
98
 
struct is_container_of_mpi_datatype<index_set> : boost::mpl::true_ {
99
 
  typedef boost::mpl::true_ type;
100
 
};
101
 
 
102
 
// operator += for array::assembly
103
 
template <class T1, class T2>
104
 
struct index_set_add_op : std::binary_function<T1,T2,T1> {
105
 
    T1& operator()(T1& x, const T2& y) const {
106
 
        x += y;
107
 
        return x;
108
 
    }
109
 
};
 
105
template <> struct default_set_op<index_set> {
 
106
  typedef index_set_add_op<index_set> type;
 
107
};
 
108
template <> struct is_container<index_set> : boost::mpl::true_ {
 
109
  typedef boost::mpl::true_ type;
 
110
};
 
111
#ifdef _RHEOLEF_HAVE_MPI
 
112
template <> struct is_container_of_mpi_datatype<index_set> : boost::mpl::true_ {
 
113
  typedef boost::mpl::true_ type;
 
114
};
 
115
#endif // _RHEOLEF_HAVE_MPI
110
116
// -------------------------------------------------------------------
111
117
// inlined
112
118
// -------------------------------------------------------------------