1 #include "BSprivate.h"
2 
3 /*+ BScolor_2_clique - Figure out the connection between the
4                        coloring and the cliques.
5 
6     Input Parameters:
7 .   color_base - the global base numbers for the colors
8 .   cA - the clique data structure
9 
10     Returns:
11     the indices for where each color starts in the array of cliques
12 
13 +*/
BScolor_2_clique(BSnumbering * color_base,BScl_2_inode * cA)14 BSnumbering *BScolor_2_clique(BSnumbering *color_base, BScl_2_inode *cA)
15 {
16 	int	cl_ind;
17 	int	i;
18 	BSnumbering *map;
19 
20 	/* Figure out where each color starts in the array of cliques */
21 	map = BSalloc_numbering(color_base->length); CHKERRN(0);
22 	cl_ind = 0;
23 	for (i=0;i<color_base->length;i++) {
24 		map->numbers[i] = cl_ind;
25 		if (i == color_base->length-1) break;
26 		while ((cA->g_offset[cl_ind] < color_base->numbers[i+1]) &&
27 			(cl_ind <= cA->num_cols)) cl_ind++;
28 	}
29 	return(map);
30 }
31