1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-08 18:40:55 +03:00

0031881: Coding Rules - OpenGl_HaltonSampler::initRandom() uses deprecated in C++14 function std::random_shuffle

Unused function has been removed.
This commit is contained in:
kgv 2020-10-27 07:57:36 +03:00 committed by bugmaster
parent 5445eaeed5
commit aa7e9f8d78
2 changed files with 10 additions and 39 deletions

@ -24,7 +24,7 @@
#include <algorithm>
#include <vector>
//! Compute points of the Halton sequence with with digit-permutations for different bases.
//! Compute points of the Halton sequence with digit-permutations for different bases.
class OpenGl_HaltonSampler
{
public:
@ -35,19 +35,13 @@ public:
public:
//! Init the permutation arrays using Faure-permutations.
//! Alternatively, initRandom() can be called before the sampling functionality can be used.
void initFaure();
//! Init the permutation arrays using randomized permutations.
//! Alternatively, initFaure() can be called before the sampling functionality can be used.
//! The client needs to specify a random number generator function object that can be used to generate a random sequence of integers.
//! That is: if f is a random number generator and N is a positive integer,
//! then f(N) will return an integer less than N and greater than or equal to 0.
template <typename Random_number_generator>
void initRandom (Random_number_generator& theRand);
OpenGl_HaltonSampler()
{
initFaure();
}
//! Return the Halton sample for the given dimension (component) and index.
//! The client must have called initRandom or initFaure() at least once before.
//! The client must have called initFaure() at least once before.
//! dimension must be smaller than the value returned by get_num_dimensions().
float sample (unsigned theDimension, unsigned theIndex) const
{
@ -62,6 +56,9 @@ public:
private:
//! Init the permutation arrays using Faure-permutations.
void initFaure();
static unsigned short invert (unsigned short theBase, unsigned short theDigits,
unsigned short theIndex, const std::vector<unsigned short>& thePerm)
{
@ -159,30 +156,4 @@ inline void OpenGl_HaltonSampler::initFaure()
initTables (aPerms);
}
template <typename Random_number_generator>
void OpenGl_HaltonSampler::initRandom (Random_number_generator& theRand)
{
const unsigned THE_MAX_BASE = 5u;
std::vector<std::vector<unsigned short> > aPerms(THE_MAX_BASE + 1);
for (unsigned k = 1; k <= 3; ++k) // Keep identity permutations for base 1, 2, 3.
{
aPerms[k].resize (k);
for (unsigned i = 0; i < k; ++i)
{
aPerms[k][i] = i;
}
}
for (unsigned aBase = 4; aBase <= THE_MAX_BASE; ++aBase)
{
aPerms[aBase].resize (aBase);
for (unsigned i = 0; i < aBase; ++i)
{
aPerms[aBase][i] = i;
}
std::random_shuffle (aPerms[aBase].begin(), aPerms[aBase].end(), theRand);
}
initTables (aPerms);
}
#endif // _OpenGl_HaltonSampler_H

@ -31,7 +31,7 @@ OpenGl_TileSampler::OpenGl_TileSampler()
myTileSize (0),
myViewSize (0, 0)
{
mySampler.initFaure();
//
}
//=======================================================================