X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/22e6546d2c6f14864cc93c4ed1470d8e8c1e2d95..07eb08dd092e89871ab3ed9fcf41ad0219598e3b:/src/surf/network_interface.cpp diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index 0b5a2bbddd..86202a2562 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -30,6 +30,13 @@ namespace simgrid { { return links->size(); } + void LinkImpl::linksList(std::vector* linkList) + { + for (auto const& kv : *links) { + linkList->push_back(&kv.second->piface_); + } + } + /** @brief Returns a list of all existing links */ LinkImpl** LinkImpl::linksList() { @@ -60,12 +67,7 @@ simgrid::surf::NetworkModel *surf_network_model = nullptr; namespace simgrid { namespace surf { - NetworkModel::~NetworkModel() - { - lmm_system_free(maxminSystem_); - xbt_heap_free(actionHeap_); - delete modifiedSet_; - } + NetworkModel::~NetworkModel() = default; double NetworkModel::latencyFactor(double /*size*/) { return sg_latency_factor; @@ -83,10 +85,10 @@ namespace simgrid { { double minRes = Model::nextOccuringEventFull(now); - for(auto it(getRunningActionSet()->begin()), itend(getRunningActionSet()->end()); it != itend ; it++) { - NetworkAction *action = static_cast(&*it); - if (action->latency_ > 0) - minRes = (minRes < 0) ? action->latency_ : std::min(minRes, action->latency_); + for (Action const& action : *getRunningActionSet()) { + const NetworkAction& net_action = static_cast(action); + if (net_action.latency_ > 0) + minRes = (minRes < 0) ? net_action.latency_ : std::min(minRes, net_action.latency_); } XBT_DEBUG("Min of share resources %f", minRes); @@ -98,7 +100,7 @@ namespace simgrid { * Resource * ************/ - LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, lmm_constraint_t constraint) + LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, kernel::lmm::Constraint* constraint) : Resource(model, name, constraint), piface_(this) { @@ -132,7 +134,7 @@ namespace simgrid { bool LinkImpl::isUsed() { - return lmm_constraint_used(model()->getMaxminSystem(), constraint()); + return model()->getMaxminSystem()->constraint_used(constraint()); } double LinkImpl::latency() @@ -147,7 +149,7 @@ namespace simgrid { int LinkImpl::sharingPolicy() { - return lmm_constraint_sharing_policy(constraint()); + return constraint()->get_sharing_policy(); } void LinkImpl::turnOn() @@ -195,13 +197,13 @@ namespace simgrid { std::list NetworkAction::links() { std::list retlist; - lmm_system_t sys = getModel()->getMaxminSystem(); - int llen = lmm_get_number_of_cnst_from_var(sys, variable_); + int llen = getVariable()->get_number_of_constraint(); for (int i = 0; i < llen; i++) { /* Beware of composite actions: ptasks put links and cpus together */ // extra pb: we cannot dynamic_cast from void*... - Resource* resource = static_cast(lmm_constraint_id(lmm_get_cnst_from_var(sys, getVariable(), i))); + kernel::model::Resource* resource = + static_cast(getVariable()->get_constraint(i)->get_id()); LinkImpl* link = dynamic_cast(resource); if (link != nullptr) retlist.push_back(link);