Christian recently added get_filtered_actors(), which is a nice name.
e.load_platform(argv[1]);
std::vector<simgrid::kernel::routing::ClusterZone*> clusters =
- e.filter_netzones_by_type<simgrid::kernel::routing::ClusterZone>();
+ e.get_filtered_netzones<simgrid::kernel::routing::ClusterZone>();
for (auto c : clusters) {
XBT_INFO("%s", c->get_cname());
}
std::vector<simgrid::kernel::routing::DragonflyZone*> dragonfly_clusters =
- e.filter_netzones_by_type<simgrid::kernel::routing::DragonflyZone>();
+ e.get_filtered_netzones<simgrid::kernel::routing::DragonflyZone>();
if (not dragonfly_clusters.empty()) {
for (auto d : dragonfly_clusters) {
XBT_INFO("%s' dragonfly topology:", d->get_cname());
- for (int i = 0; i < d->getHostCount(); i++) {
+ for (int i = 0; i < d->get_host_count(); i++) {
unsigned int coords[4];
d->rankId_to_coords(i, coords);
XBT_INFO(" %d: (%u, %u, %u, %u)", i, coords[0], coords[1], coords[2], coords[3]);
simgrid::s4u::NetZone* netzone_by_name_or_null(const char* name);
/** @brief Retrieves all netzones of the type indicated by the template argument */
- template <class T> std::vector<T*> filter_netzones_by_type()
+ template <class T> std::vector<T*> get_filtered_netzones()
{
std::vector<T*> res;
- filter_netzones_by_type_recursive(get_netzone_root(), &res);
+ get_filtered_netzones_recursive(get_netzone_root(), &res);
return res;
}
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::filter_netzones_by_type()") void getNetzoneByType(
std::vector<T*>* whereto)
{
- filter_netzones_by_type_recursive(get_netzone_root(), whereto);
+ get_filtered_netzones_recursive(get_netzone_root(), whereto);
}
XBT_ATTRIB_DEPRECATED_v323("Please use Engine::get_instance()") static s4u::Engine* getInstance()
/** Callback fired when the time cannot jump because of inter-actors deadlock */
extern XBT_PUBLIC xbt::signal<void(void)> on_deadlock;
-template <class T> XBT_PRIVATE void filter_netzones_by_type_recursive(s4u::NetZone* current, std::vector<T*>* whereto)
+template <class T> XBT_PRIVATE void get_filtered_netzones_recursive(s4u::NetZone* current, std::vector<T*>* whereto)
{
- for (auto const& elem : *(current->getChildren())) {
- filter_netzones_by_type_recursive(elem, whereto);
+ for (auto const& elem : *(current->get_children())) {
+ get_filtered_netzones_recursive(elem, whereto);
if (elem == dynamic_cast<T*>(elem))
whereto->push_back(dynamic_cast<T*>(elem));
}
const std::string& get_name() const { return name_; }
/** @brief Retrieves the name of that netzone as a C string */
const char* get_cname() const;
+
NetZone* get_father();
+ std::vector<NetZone*>* get_children(); // Sub netzones
std::vector<Host*> get_all_hosts();
-
- std::vector<NetZone*>* getChildren(); // Sub netzones
- int getHostCount();
+ int get_host_count();
private:
std::unordered_map<std::string, std::string> properties_;
{
return get_vertices();
}
+ XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_host_count()") int getHostCount() { return get_host_count(); }
XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_all_hosts()") void getHosts(
std::vector<s4u::Host*>* whereto); // retrieve my content as a vector of hosts
+ XBT_ATTRIB_DEPRECATED_v323("Please use NetZone::get_children()") std::vector<NetZone*>* getChildren()
+ {
+ return get_children();
+ }
};
}
}; // Namespace simgrid::s4u
if (not cls)
return nullptr;
- jtable = env->NewObjectArray(static_cast<jsize>(self_as->getChildren()->size()), cls, nullptr);
+ jtable = env->NewObjectArray(static_cast<jsize>(self_as->get_children()->size()), cls, nullptr);
if (not jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
return nullptr;
}
- for (auto const& tmp_as : *self_as->getChildren()) {
+ for (auto const& tmp_as : *self_as->get_children()) {
jobject tmp_jas = jnetzone_new_instance(env);
if (not tmp_jas) {
jxbt_throw_jni(env, "java As instantiation failed");
return;
}
XBT_DEBUG("Graph extraction for NetZone = %s", netzone->get_cname());
- if (not netzone->getChildren()->empty()) {
+ if (not netzone->get_children()->empty()) {
// bottom-up recursion
- for (auto const& nz_son : *netzone->getChildren()) {
+ for (auto const& nz_son : *netzone->get_children()) {
container_t child_container = container->children_.at(nz_son->get_cname());
recursiveGraphExtraction(nz_son, child_container, filter);
}
std::map<std::string, xbt_edge_t>* edges, sg_netzone_t netzone,
container_t container)
{
- if (not netzone->getChildren()->empty()) {
+ if (not netzone->get_children()->empty()) {
// bottom-up recursion
- for (auto const& netzone_child : *netzone->getChildren()) {
+ for (auto const& netzone_child : *netzone->get_children()) {
container_t child_container = container->children_.at(netzone_child->get_cname());
recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
}
if (not strcmp(current->get_cname(), name))
return current;
- for (auto const& elem : *(current->getChildren())) {
+ for (auto const& elem : *(current->get_children())) {
simgrid::s4u::NetZone* tmp = netzone_by_name_recursive(elem, name);
if (tmp != nullptr) {
return tmp;
*
* This function returns the internal copy of the children, not a copy. Don't mess with it!
*/
-std::vector<NetZone*>* NetZone::getChildren()
+std::vector<NetZone*>* NetZone::get_children()
{
return children_;
}
}
}
-int NetZone::getHostCount()
+int NetZone::get_host_count()
{
int count = 0;
for (auto const& card : vertices_) {
void sg_zone_get_sons(sg_netzone_t netzone, xbt_dict_t whereto)
{
- for (auto const& elem : *netzone->getChildren()) {
+ for (auto const& elem : *netzone->get_children()) {
xbt_dict_set(whereto, elem->get_cname(), static_cast<void*>(elem), nullptr);
}
}
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive;
/* add to the sons dictionary */
- current_routing->getChildren()->push_back(static_cast<simgrid::s4u::NetZone*>(new_zone));
+ current_routing->get_children()->push_back(static_cast<simgrid::s4u::NetZone*>(new_zone));
}
/* set the new current component of the tree */