1 /* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved. */
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. */
6 #ifndef JED_SIMGRID_PLATFORM_H_
7 #define JED_SIMGRID_PLATFORM_H_
9 #include <simgrid/forward.h>
13 #include <unordered_map>
18 class XBT_PUBLIC Container {
20 explicit Container(const std::string& name);
21 Container(const Container&) = delete;
22 Container& operator=(const Container&) = delete;
30 std::unordered_map<const char*, unsigned int> name2id;
31 Container *parent = nullptr;
32 std::vector<std::unique_ptr<Container>> children;
33 std::vector<sg_host_t> resource_list;
34 void add_child(Container* child);
35 void add_resources(std::vector<sg_host_t> hosts);
36 void create_hierarchy(sg_netzone_t from_as);
37 std::vector<int> get_hierarchy();
38 std::string get_hierarchy_as_string();
39 void print(FILE *file);
40 void print_resources(FILE* file);
43 class XBT_PUBLIC Subset {
45 Subset(int s, int n, Container* p);
46 int start_idx; // start idx in resource_list of container
47 int nres; // number of resources spanning starting at start_idx
53 typedef simgrid::jedule::Container * jed_container_t;
54 void get_resource_selection_by_hosts(std::vector<simgrid::jedule::Subset>& subset_list,
55 const std::vector<sg_host_t>& host_list);
57 #endif /* JED_SIMGRID_PLATFORM_H_ */