Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make some protected fields private.
[simgrid.git] / src / smpi / include / smpi_topo.hpp
1 /* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SMPI_TOPO_HPP_INCLUDED
7 #define SMPI_TOPO_HPP_INCLUDED
8
9 #include "smpi_comm.hpp"
10 #include "smpi_status.hpp"
11
12 typedef SMPI_Topology *MPI_Topology;
13
14 namespace simgrid{
15 namespace smpi{
16
17 class Topo {
18   public:
19     virtual ~Topo()=default;
20     MPI_Comm getComm() const { return comm_; }
21     void setComm(MPI_Comm comm) { comm_ = comm; }
22   private:
23     MPI_Comm comm_;
24 };
25
26
27 class Topo_Cart: public Topo {
28   private:
29     int nnodes_ = 0;
30     int ndims_;
31     int *dims_;
32     int *periodic_;
33     int *position_;
34   public:
35     explicit Topo_Cart(int ndims);
36     ~Topo_Cart();
37     Topo_Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart);
38     Topo_Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ;
39     int coords(int rank, int maxdims, int coords[]) ;
40     int get(int maxdims, int* dims, int* periods, int* coords);
41     int rank(int* coords, int* rank);
42     int shift(int direction, int disp, int *rank_source, int *rank_dest) ;
43     int dim_get(int *ndims);
44     static int Dims_create(int nnodes, int ndims, int dims[]);
45 };
46
47
48 class Topo_Graph: public Topo {
49   private:
50     int nnodes_;
51     int nedges_;
52     int *index_;
53     int *edges_;
54   public:
55     Topo_Graph();
56     ~Topo_Graph();
57 };
58
59 class Topo_Dist_Graph: public Topo {
60   private:
61     int indegree_;
62     int *in_;
63     int *in_weights_;
64     int outdegree_;
65     int *out_;
66     int *out_weights_;
67     int is_weighted_;
68   public:
69     Topo_Dist_Graph();
70     ~Topo_Dist_Graph();
71 };
72
73 }
74 }
75
76
77 #endif