13 for(i=0; i<n; i++)
fOrder[i] = i;
35 for(i=0; i<n; i++) out[
fOrder[i]] = in[i];
40 for(i=0; i<n; i++) out[
fOrder[i]] = in[i];
47 while(i >= 0 && ((++
fCounter[i]) %= n-i) == 0) i--;
56 if(
fOrder[index] == -1) count++;
67 for(in=0; in<nel; in++)
if(
fCounter[in] != 0)
return false;
72 return Hash(
"TPZPermutation");
void Permute(const TPZVec< int > &in, TPZVec< int > &out) const
Applies the current permutation on the vector in and produces the vector out.
void Read(TPZStream &buf, void *context) override
read objects from the stream
Contains declaration of the TPZPermutation class which generates all permutations of n values...
TPZManVector< int > fOrder
Variable which contains the current permutations.
TPZPermutation(int n)
Constructor with number of permutations.
virtual void Write(const bool val)
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
int32_t Hash(std::string str)
TPZManVector< int > fCounter
Variable which represents a counter for the permutations.
void operator++()
Operator increment.
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
TPZPermutation & operator=(const TPZPermutation ©)
Operator attribution.
~TPZPermutation()
Default destructor.
Contains declaration of the abstract TPZStream class. TPZStream defines the interface for saving and ...
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
int ClassId() const override
Define the class id associated with the class.
This class generates all permutations of n values. Utility.
virtual void Read(bool &val)