get_minHa.c 756 B

12345678910111213141516171819202122232425262728
  1. /************************************************************
  2. *
  3. * get_minHa.c (for spread)
  4. * This routine is to get the cell with the SMALLEST min_
  5. * cost. This cell is the root of the (min) heap. After
  6. * removing the root, it calls fixHa routine to restore a
  7. * heap order.
  8. *
  9. ************************************************************/
  10. #include "costHa.h"
  11. #include "local_proto.h"
  12. void get_minHa(struct costHa *heap, struct costHa *pres_cell, long heap_len)
  13. {
  14. /* struct costHa *fixHa(); */
  15. if (heap_len == 0)
  16. return;
  17. pres_cell->min_cost = heap[1].min_cost;
  18. pres_cell->angle = heap[1].angle;
  19. pres_cell->row = heap[1].row;
  20. pres_cell->col = heap[1].col;
  21. fixHa(1, heap, heap_len);
  22. return;
  23. }