11 #ifndef __GT_VOLUMEUTIL_H_INCLUDED__
12 #define __GT_VOLUMEUTIL_H_INCLUDED__
29 int xres,
int yres,
int zres,
33 const fpreal max_lod = 4.0;
36 const exint min_dim = 64;
37 const fpreal min_voxels = min_dim * min_dim * min_dim *
lod;
38 const fpreal num_voxels =
exint(xres) * yres * zres;
41 if (num_voxels > 0 && num_voxels < min_voxels)
43 scale_factor = SYScbrt(num_voxels / min_voxels);
69 myArray->
resize(num_items);
77 template <
typename DstArrayT,
typename SrcArrayT>
82 const SrcArrayT &
src,
exint num_elems)
84 , myDstStart(dst_start)
86 , myNumElems(num_elems)
93 ::memcpy(&(*myDst)(myDstStart), &(*mySrc)(0), bytes);
99 const SrcArrayT * mySrc;
104 template <
typename DstArrayT,
typename SrcArrayT>
118 template <
typename DstArrayT,
typename SrcArrayT>
120 GTrunCopyTask(DstArrayT &dst,
exint dst_start, SrcArrayT &src,
exint num_elems)
123 ::memcpy(&
dst(dst_start), &
src(0), bytes);
127 template <
typename DstArrayT,
typename ThreadChunksT>
129 GTmergeThreadChunks(DstArrayT &dst,
const ThreadChunksT &chunks)
132 using ChunksIterT =
typename ThreadChunksT::const_iterator;
137 ChunksIterT
end = chunks.end();
138 for (ChunksIterT it = chunks.begin(); it !=
end; ++it)
140 const ChunkPtrT &chunk = it.get();
144 exint src_items = chunk->size();
145 if (src_items > max_items)
146 max_items = src_items;
152 if (max_items > 20000)
156 for (ChunksIterT it = chunks.begin(); it !=
end; ++it)
158 const ChunkPtrT &chunk = it.get();
161 chunk->spawnCopyTask(copy_tasks, dst, size);
162 size += chunk->size();
169 for (ChunksIterT it = chunks.begin(); it !=
end; ++it)
171 const ChunkPtrT &chunk = it.get();
174 chunk->runCopyTask(dst, size);
175 size += chunk->size();
180 #endif // __GT_VOLUMEUTIL_H_INCLUDED__
T * getData(GT_Offset offset)
Raw pointer access to a tuple.
GT_Vec3ArrayProxy(GT_Real32Array &arr)
UT_Vector3F & operator()(exint i)
GT_CopyTask(DstArrayT &dst, exint dst_start, const SrcArrayT &src, exint num_elems)
tbb::task_group_status wait()
void resize(GT_Size size, GT_Size capacity=-1)
void entries(exint num_items)
An array of numeric values (int32, int64, fpreal16, fpreal32, fpreal64)