Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename specific topology classes, to ease comprehension.
[simgrid.git] / src / smpi / smpi_topo.hpp
1 /* Copyright (c) 2010-2015. 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_TOPO_HPP_INCLUDED
8 #define SMPI_TOPO_HPP_INCLUDED
9
10 #include "private.h"
11
12
13 namespace simgrid{
14 namespace smpi{
15
16 class Topo {
17   protected:
18   MPI_Comm comm_;
19 };
20
21
22 class Topo_Cart: public Topo {
23   private:
24     int nnodes_;
25     int ndims_;
26     int *dims_;
27     int *periodic_;
28     int *position_;
29   public:
30     Topo_Cart(int ndims);
31     ~Topo_Cart();
32     Topo_Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart);
33     Topo_Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ;
34     int coords(int rank, int maxdims, int coords[]) ;
35     int get(int maxdims, int* dims, int* periods, int* coords);
36     int rank(int* coords, int* rank);
37     int shift(int direction, int disp, int *rank_source, int *rank_dest) ;
38     int dim_get(int *ndims);
39 };
40
41
42 class Topo_Graph: public Topo {
43   private:
44     int nnodes_;
45     int nedges_;
46     int *index_;
47     int *edges_;
48   public:
49     Topo_Graph();
50     ~Topo_Graph();
51 };
52
53 class Topo_Dist_Graph: public Topo {
54   private:
55     int indegree_;
56     int *in_;
57     int *in_weights_;
58     int outdegree_;
59     int *out_;
60     int *out_weights_;
61     int is_weighted_;
62   public:
63     Topo_Dist_Graph();
64     ~Topo_Dist_Graph();
65 };
66
67 /*
68  * This is a utility function, no need to have anything in the lower layer for this at all
69  */
70 extern int Dims_create(int nnodes, int ndims, int dims[]);
71
72 }
73 }
74
75
76 #endif