Beispiel #1
0
void ProximityGroup::add_groups(int *p_cell, String p_base, int p_depth) {

	p_base = p_base + "|";
	if (grid_radius[p_depth] == 0) {

		if (p_depth == 2) {
			_new_group(p_base);
		} else {
			add_groups(p_cell, p_base, p_depth + 1);
		};
	};

	int start = p_cell[p_depth] - grid_radius[p_depth];
	int end = p_cell[p_depth] + grid_radius[p_depth];

	for (int i = start; i <= end; i++) {

		String gname = p_base + itos(i);
		if (p_depth == 2) {
			_new_group(gname);
		} else {
			add_groups(p_cell, gname, p_depth + 1);
		};
	};
};
Beispiel #2
0
static void
set_class(iks *model, int class_no)
{
    struct acl_class *ac;
    int nr_groups = 0;

    nr_groups += count_groups(iks_find(model, "admin"), class_no);
    nr_groups += count_groups(iks_find(model, "user"), class_no);
    nr_groups += count_groups(iks_find(model, "guest"), class_no);

    ac = calloc(1, sizeof(struct acl_class) + (nr_groups * sizeof(struct acl_group)));
    if (!ac) return;
    ac->nr_groups = nr_groups;

    add_groups(iks_find(model, "admin"), class_no, ACL_ADMIN, ac);
    add_groups(iks_find(model, "user"), class_no, ACL_USER, ac);
    add_groups(iks_find(model, "guest"), class_no, ACL_GUEST, ac);

    model_acl_set(class_no, ac);
}
Beispiel #3
0
void ProximityGroup::update_groups() {

	if (grid_radius == Vector3(0, 0, 0))
		return;

	++group_version;

	Vector3 pos = get_global_transform().get_origin();
	Vector3 vcell = pos / cell_size;
	int cell[3] = { Math::fast_ftoi(vcell.x), Math::fast_ftoi(vcell.y), Math::fast_ftoi(vcell.z) };

	add_groups(cell, group_name, 0);

	clear_groups();
};
Beispiel #4
0
/* Look for any pairs of consecutive leaves among the "n" children of "node"
 * starting at "first" that should be merged together.
 * Store the results in "grouping".
 *
 * First make sure the intersection of validity and proximity
 * schedule constraints is available and extract the required
 * information from the "n" leaves.
 * Then try and merge consecutive leaves based on the validity
 * and proximity constraints.
 * If any pairs were successfully merged, then add groups
 * corresponding to the merged leaves to "grouping".
 */
static isl_stat group_subsequence(__isl_keep isl_schedule_node *node,
	int first, int n, struct ppcg_grouping *grouping)
{
	int n_merge;
	struct ppcg_grouping_leaf *leaves;

	if (ppcg_grouping_compute_dep(grouping) < 0)
		return isl_stat_error;

	leaves = extract_leaves(node, first, n);
	if (!leaves)
		return isl_stat_error;

	n_merge = merge_leaves(n, leaves, grouping->dep);
	if (n_merge >= 0 && n_merge < n &&
	    add_groups(grouping, n_merge, leaves) < 0)
		return isl_stat_error;

	ppcg_grouping_leaf_free(n, leaves);

	return isl_stat_ok;
}