Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
5e40d677847f9c3dd7eec86bee156eabe1e63965
[simgrid.git] / include / simgrid / jedule / jedule_platform.hpp
1 /* Copyright (c) 2010-2018. 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 JED_SIMGRID_PLATFORM_H_
7 #define JED_SIMGRID_PLATFORM_H_
8
9 #include <simgrid/forward.h>
10 #include <xbt/dynar.h>
11
12 #include <unordered_map>
13 #include <vector>
14 #include <string>
15
16 namespace simgrid {
17 namespace jedule{
18 class XBT_PUBLIC Container {
19 public:
20   explicit Container(std::string name);
21   virtual ~Container();
22 private:
23   int last_id;
24   int is_lowest = 0;
25 public:
26   std::string name;
27   std::unordered_map<const char*, unsigned int> name2id;
28   Container *parent = nullptr;
29   std::vector<Container*> children;
30   std::vector<sg_host_t> resource_list;
31   void addChild(Container* child);
32   void addResources(std::vector<sg_host_t> hosts);
33   void createHierarchy(sg_netzone_t from_as);
34   std::vector<int> getHierarchy();
35   std::string getHierarchyAsString();
36   void print(FILE *file);
37   void printResources(FILE *file);
38 };
39
40 class XBT_PUBLIC Subset {
41 public:
42   Subset(int s, int n, Container* p);
43   virtual ~Subset()=default;
44   int start_idx; // start idx in resource_list of container
45   int nres;      // number of resources spanning starting at start_idx
46   Container *parent;
47 };
48
49 }
50 }
51 typedef simgrid::jedule::Container * jed_container_t;
52 typedef simgrid::jedule::Subset * jed_subset_t;
53 void get_resource_selection_by_hosts(std::vector<jed_subset_t>* subset_list, std::vector<sg_host_t> *host_list);
54
55 #endif /* JED_SIMGRID_PLATFORM_H_ */