Ejemplo n.º 1
0
size_t crystalised_octree::child_containing(const location& loc, size_t node_idx, const extent& node_ext,
		extent& r_child_ext) const
{
	assert(is_branch(node_idx));

	// sanity check size
	assert(node_ext.size > 1);

	// sanity check location
	assert(node_ext.contains(loc));

	// which child _should_ contain the point?
	size_t which_child = index_of_child_containing(loc, node_ext);

	// move to that child
	size_t child_idx = node_idx + 1;
	for(size_t child=0; child != which_child; ++child)
	{
		assert(child_idx < data_->size());

		// advance to next child
		if(is_branch(child_idx))
		{
			child_idx += 1 + (data_->at(child_idx) & 0x7fffffffu);
		}
		else
		{
			child_idx += 1;
		}
	}

	// set the child extent and return the child index
	r_child_ext = extent(location_of_child(which_child, node_ext), node_ext.size >> 1);
	return child_idx;
}
Ejemplo n.º 2
0
runall_result test() restrict(cpu,amp)
{
    // Note: The actual result of call has minor significance here, the point is to be able to compile.

    {
        const extent<1> ext(1);
        const index<1> idx(0);
        if(!ext.contains(idx))
            return runall_fail;
    }
    {
        extent<1> ext(1);
        const index<1> idx(0);
        if(!ext.contains(idx))
            return runall_fail;
    }

    return runall_pass;
}