本文整理汇总了C++中Mapping::getGridSuperCells方法的典型用法代码示例。如果您正苦于以下问题:C++ Mapping::getGridSuperCells方法的具体用法?C++ Mapping::getGridSuperCells怎么用?C++ Mapping::getGridSuperCells使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapping
的用法示例。
在下文中一共展示了Mapping::getGridSuperCells方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
DINLINE void operator()(BoxWriteOnly buffWrite,
uint32_t seed,
float fraction,
Mapping mapper) const
{
/* get position in grid in units of SuperCells from blockID */
const Space block(mapper.getSuperCellIndex(Space(blockIdx)));
/* convert position in unit of cells */
const Space blockCell = block * Mapping::SuperCellSize::toRT();
/* convert CUDA dim3 to DataSpace<DIM3> */
const Space threadIndex(threadIdx);
const uint32_t cellIdx = DataSpaceOperations<DIM2>::map(
mapper.getGridSuperCells() * Mapping::SuperCellSize::toRT(),
blockCell + threadIndex);
/* get uniform random number from seed */
auto rng = nvidia::rng::create(
nvidia::rng::methods::Xor(seed, cellIdx),
nvidia::rng::distributions::Uniform_float());
/* write 1(white) if uniform random number 0<rng<1 is smaller than 'fraction' */
buffWrite(blockCell + threadIndex) = (rng() <= fraction);
}