7#include <Common/assertion.h>
29 std::size_t strideSize,
30 std::size_t offsetInStride);
37 void setSample(std::size_t index,
const real* sample);
39 template<std::
size_t N>
40 void setSample(std::size_t index,
const std::array<real, N>& sample);
53 std::size_t m_numDims;
54 std::size_t m_numSamples;
55 std::size_t m_strideSize;
56 std::size_t m_offsetInStride;
71 const std::size_t numDims,
72 const std::size_t numSamples) :
84 const std::size_t numDims,
85 const std::size_t numSamples,
86 const std::size_t strideSize,
87 const std::size_t offsetInStride) :
91 m_numSamples (numSamples),
92 m_strideSize (strideSize),
93 m_offsetInStride(offsetInStride)
96 PH_ASSERT_LT(offsetInStride, strideSize);
97 PH_ASSERT_IN_RANGE_INCLUSIVE(
numDims, 1, strideSize - offsetInStride);
105 [
this](
const std::size_t indexA,
const std::size_t indexB)
107 for(std::size_t di = 0; di < m_numDims; ++di)
109 std::swap((*
this)[indexA][di],
110 (*
this)[indexB][di]);
117 PH_ASSERT_MSG(dimIndex < m_numDims,
118 "dimension index must be smaller than number of dimensions");
122 [
this, dimIndex](
const std::size_t indexA,
const std::size_t indexB)
124 std::swap((*
this)[indexA][dimIndex],
125 (*
this)[indexB][dimIndex]);
131 PH_ASSERT_MSG(dimIndexBegin < dimIndexEnd,
132 "invalid dimension index range");
134 for(std::size_t dimIndex = dimIndexBegin; dimIndex < dimIndexEnd; ++dimIndex)
149 for(std::size_t di = 0; di < m_numDims; ++di)
151 (*this)[index][di] = sample[di];
155template<std::
size_t N>
158 PH_ASSERT_EQ(N, m_numDims);
180 return m_numSamples * m_numDims;
185 return m_buffer !=
nullptr;
192 return &(m_buffer[index * m_strideSize + m_offsetInStride]);
Definition SamplesND.h:16
void setSample(std::size_t index, const real *sample)
Definition SamplesND.h:145
bool isValid() const
Definition SamplesND.h:183
std::size_t numDims() const
Definition SamplesND.h:168
real * operator[](std::size_t index)
Definition SamplesND.h:188
std::size_t numElements() const
Definition SamplesND.h:178
void shuffleDimensions(std::size_t dimIndexBegin, std::size_t dimIndexEnd)
Definition SamplesND.h:129
real * buffer()
Definition SamplesND.h:163
void shuffleDimension(std::size_t dimIndex)
Definition SamplesND.h:115
void shuffleAllDimensions()
Definition SamplesND.h:140
std::size_t numSamples() const
Definition SamplesND.h:173
void shuffle()
Definition SamplesND.h:101
SamplesND()
Definition SamplesND.h:61
void shuffle_durstenfeld_index_pairs(const std::size_t beginIndex, const std::size_t endIndex, IndexPairConsumer consumer)
Definition shuffle.h:33
The root for all renderer implementations.
Definition EEngineProject.h:6