tools/lgf-gen.cc
changeset 2486 0c498f2239a8
parent 2448 ab899ae3505f
child 2491 b63ae56979ef
equal deleted inserted replaced
6:4a252c23b709 7:50c79b6807e6
   279 
   279 
   280   SpikeHeap spikeheap;
   280   SpikeHeap spikeheap;
   281 
   281 
   282   std::set<std::pair<int, int> > edges;
   282   std::set<std::pair<int, int> > edges;
   283 
   283 
   284   beach.insert(std::make_pair(Part(-1, siteheap[0].second, -1), 
   284   int siteindex = 0;
   285 			      spikeheap.end()));
   285   {
   286   int siteindex = 1;
   286     SiteHeap front;
       
   287 
       
   288     while (siteindex < int(siteheap.size()) &&
       
   289 	   siteheap[0].first == siteheap[siteindex].first) {
       
   290       front.push_back(std::make_pair(points[siteheap[siteindex].second].y,
       
   291 				     siteheap[siteindex].second));
       
   292       ++siteindex;
       
   293     }
       
   294     
       
   295     std::sort(front.begin(), front.end());
       
   296 
       
   297     for (int i = 0; i < int(front.size()); ++i) {
       
   298       int prev = (i == 0 ? -1 : front[i - 1].second);
       
   299       int curr = front[i].second;
       
   300       int next = (i + 1 == int(front.size()) ? -1 : front[i + 1].second);
       
   301 
       
   302       beach.insert(std::make_pair(Part(prev, curr, next), 
       
   303 				  spikeheap.end()));      
       
   304     }
       
   305   }
   287 
   306 
   288   while (siteindex < int(points.size()) || !spikeheap.empty()) {
   307   while (siteindex < int(points.size()) || !spikeheap.empty()) {
   289 
   308 
   290     SpikeHeap::iterator spit = spikeheap.begin();
   309     SpikeHeap::iterator spit = spikeheap.begin();
   291 
   310 
   782   for(UEdgeIt e(g);e!=INVALID;++e)
   801   for(UEdgeIt e(g);e!=INVALID;++e)
   783     tlen+=sqrt((coords[g.source(e)]-coords[g.target(e)]).normSquare());
   802     tlen+=sqrt((coords[g.source(e)]-coords[g.target(e)]).normSquare());
   784   std::cout << "Total edge length  : " << tlen << std::endl;
   803   std::cout << "Total edge length  : " << tlen << std::endl;
   785 
   804 
   786   if(ap["eps"])
   805   if(ap["eps"])
   787     graphToEps(g,prefix+".eps").
   806     graphToEps(g,prefix+".eps").scaleToA4().
   788       scale(600).nodeScale(.2).edgeWidthScale(.001).preScale(false).
   807       scale(600).nodeScale(.2).edgeWidthScale(.001).preScale(false).
   789       coords(coords).run();
   808       coords(coords).run();
   790   
   809   
   791   if(ap["dir"])
   810   if(ap["dir"])
   792     GraphWriter<ListUGraph>(prefix+".lgf",g).
   811     GraphWriter<ListUGraph>(prefix+".lgf",g).