Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ok, I stop trying to please sonar.
[simgrid.git] / src / surf / network_ib.hpp
1 /* Copyright (c) 2014-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 SURF_NETWORK_IB_HPP_
8 #define SURF_NETWORK_IB_HPP_
9
10 #include "src/surf/network_smpi.hpp"
11 #include "xbt/base.h"
12
13 #include <map>
14
15 namespace simgrid {
16   namespace surf {
17
18     class XBT_PRIVATE IBNode;
19
20     class XBT_PRIVATE ActiveComm{
21     public :
22       //IBNode* origin;
23       IBNode* destination;
24       NetworkAction *action;
25       double init_rate;
26       ActiveComm() : destination(nullptr),action(nullptr),init_rate(-1){};
27       ~ActiveComm(){};
28     };
29
30     class IBNode{
31     public :
32       int id;
33       //store related links, to ease computation of the penalties
34       std::vector<ActiveComm*> ActiveCommsUp;
35       //store the number of comms received from each node
36       std::map<IBNode*, int> ActiveCommsDown;
37       //number of comms the node is receiving
38       int nbActiveCommsDown;
39       explicit IBNode(int id) : id(id),nbActiveCommsDown(0){};
40       ~IBNode(){};
41     };
42
43     class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
44     private:
45       void updateIBfactors_rec(IBNode *root, bool* updatedlist);
46       void computeIBfactors(IBNode *root);
47     public:
48       NetworkIBModel();
49       explicit NetworkIBModel(const char *name);
50       ~NetworkIBModel() override;
51       void updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove);
52
53       xbt_dict_t active_nodes;
54       std::map<NetworkAction *, std::pair<IBNode*,IBNode*> > active_comms;
55
56       double Bs;
57       double Be;
58       double ys;
59
60     };
61
62   }
63 }
64
65 #endif