init.cpp

Go to the documentation of this file.
00001 
00003 #include "../stdafx.h"
00004 #include "init.h"
00005 
00010 void InitHandler::Run(LinkGraphJob *job)
00011 {
00012   LinkGraph &lg = job->Graph();
00013   uint size = lg.GetSize();
00014   job->Nodes().Resize(size);
00015   job->Edges().Resize(size, size);
00016   for (uint i = 0; i < size; ++i) {
00017     NodeAnnotation &node = job->GetNode(i);
00018     node.undelivered_supply = lg.GetNode(i).supply;
00019     new (&node.flows) FlowStatMap;
00020     new (&node.paths) PathSet;
00021     for (uint j = 0; j < size; ++j) {
00022       EdgeAnnotation &edge = job->GetEdge(i, j);
00023       edge.demand = 0;
00024       edge.flow = 0;
00025       edge.unsatisfied_demand = 0;
00026     }
00027   }
00028 
00029 }