+ this->links_.emplace_back(newLink);
+}
+
+void FatTreeZone::check_topology(unsigned int n_levels, const std::vector<unsigned int>& down_links,
+ const std::vector<unsigned int>& up_links, const std::vector<unsigned int>& link_count)
+
+{
+ /* check number of levels */
+ if (n_levels == 0)
+ throw std::invalid_argument("FatTreeZone: invalid number of levels, must be > 0");
+
+ auto check_vector = [&n_levels](const std::vector<unsigned int>& vector, const std::string& var_name) {
+ if (vector.size() != n_levels)
+ throw std::invalid_argument("FatTreeZone: invalid " + var_name + " parameter, vector has " +
+ std::to_string(vector.size()) + " elements, must have " + std::to_string(n_levels));
+
+ auto check_zero = [](unsigned int i) { return i == 0; };
+ if (std::any_of(vector.begin(), vector.end(), check_zero))
+ throw std::invalid_argument("FatTreeZone: invalid " + var_name + " parameter, all values must be greater than 0");
+ };
+
+ /* check remaining vectors */
+ check_vector(down_links, "down links");
+ check_vector(up_links, "up links");
+ check_vector(link_count, "link count");
+}
+
+void FatTreeZone::set_topology(unsigned int n_levels, const std::vector<unsigned int>& down_links,
+ const std::vector<unsigned int>& up_links, const std::vector<unsigned int>& link_count)
+{
+ levels_ = n_levels;
+ num_children_per_node_ = down_links;
+ num_parents_per_node_ = up_links;
+ num_port_lower_level_ = link_count;