Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into actor-priority
[simgrid.git] / src / smpi / include / smpi_group.hpp
1 /* Copyright (c) 2010, 2013-2017. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SMPI_GROUP_HPP_INCLUDED
8 #define SMPI_GROUP_HPP_INCLUDED
9
10 #include "smpi_f2c.hpp"
11 #include <smpi/smpi.h>
12
13 namespace simgrid{
14 namespace smpi{
15
16 class Group : public F2C{
17   private:
18     int size_;
19     int *rank_to_index_map_;
20     std::unordered_map<int, int> index_to_rank_map_;
21     int refcount_;
22   public:
23     explicit Group();
24     explicit Group(int size);
25     explicit Group(Group* origin);
26     ~Group();
27
28     void set_mapping(int index, int rank);
29     int index(int rank);
30     int rank(int index);
31     void ref();
32     static void unref(MPI_Group group);
33     int size();
34     int compare(MPI_Group group2);
35     int incl(int n, int* ranks, MPI_Group* newgroup);
36     int excl(int n, int *ranks, MPI_Group * newgroup);
37     int group_union(MPI_Group group2, MPI_Group* newgroup);
38     int intersection(MPI_Group group2, MPI_Group* newgroup);
39     int difference(MPI_Group group2, MPI_Group* newgroup);
40     int range_incl(int n, int ranges[][3], MPI_Group * newgroup);
41     int range_excl(int n, int ranges[][3], MPI_Group * newgroup);
42
43     static Group* f2c(int id);
44
45 };
46 }
47 }
48
49 #endif