Exemplo n.º 1
0
static int
refine_cell(struct saucy *s, struct coloring *c,
	int (*refine)(struct saucy *, struct coloring *, int))
{
	int i, cf, ret = 1;

	/*
	 * The connected list must be consistent.  This is for
	 * detecting mappings across nodes at a given level.  However,
	 * at the root of the tree, we never have to map with another
	 * node, so we lack this consistency constraint in that case.
	 */
	if (s->lev > 1) introsort(s->clist, s->csize);

	/* Now iterate over the marked cells */
	for (i = 0; ret && i < s->csize; ++i) {
		cf = s->clist[i];
		ret = refine(s, c, cf);
	}

	/* Clear the connected marks */
	for (i = 0; i < s->csize; ++i) {
		cf = s->clist[i];
		s->conncnts[cf] = 0;
	}
	s->csize = 0;
	return ret;
}
Exemplo n.º 2
0
Arquivo: main.cpp Projeto: CCJY/coliru
 void introsort(Iter begin, Iter end) {
     introsort(begin, end, std::less<typename std::iterator_traits<Iter>::value_type>());
 }