26 inline int64_t
linear(
const vec3i &ID,
const vec3i &dims)
27 {
return ID.x + dims.x*(ID.y + dims.y*(int64_t)ID.z); }
29 template<
typename Lambda>
30 inline void for_each(
const vec3i &dims,
const Lambda &lambda)
32 for (
int iz=0;iz<dims.z;iz++)
33 for (
int iy=0;iy<dims.y;iy++)
34 for (
int ix=0;ix<dims.x;ix++)
35 lambda(vec3i(ix,iy,iz));
38 #if OWL_HAVE_PARALLEL_FOR
39 template<
typename Lambda>
40 inline void parallel_for(
const vec3i &dims,
const Lambda &lambda)
43 lambda(vec3i(index%dims.x,
44 (index/dims.x)%dims.y,
45 index/((size_t)dims.x*dims.y)));
49 template<
typename Lambda>
50 inline void serial_for(
const vec3i &dims,
const Lambda &lambda)
53 lambda(vec3i(index%dims.x,
54 (index/dims.x)%dims.y,
55 index/((size_t)dims.x*dims.y)));