NeoPZ
|
This class generates all permutations of n values. Utility. More...
#include <tpzpermutation.h>
Public Member Functions | |
TPZPermutation (int n) | |
Constructor with number of permutations. More... | |
TPZPermutation (const TPZPermutation ©) | |
Copy constructor. More... | |
~TPZPermutation () | |
Default destructor. More... | |
TPZPermutation & | operator= (const TPZPermutation ©) |
Operator attribution. More... | |
void | Permute (const TPZVec< int > &in, TPZVec< int > &out) const |
Applies the current permutation on the vector in and produces the vector out. More... | |
void | Permute (const TPZVec< int64_t > &in, TPZVec< int64_t > &out) const |
void | operator++ () |
Operator increment. More... | |
void | operator++ (int) |
bool | IsFirst () |
int | ClassId () const override |
Define the class id associated with the class. More... | |
void | Read (TPZStream &buf, void *context) override |
read objects from the stream More... | |
void | Write (TPZStream &buf, int withclassid) const override |
Writes this object to the TPZStream buffer. Include the classid if withclassid = true. More... | |
TPZManVector< int > | Counter () |
Returns the counter of the permutations. More... | |
TPZManVector< int > | Order () |
Public Member Functions inherited from TPZSavable | |
TPZSavable () | |
virtual | ~TPZSavable () |
virtual std::list< std::map< std::string, uint64_t > > | VersionHistory () const |
virtual std::pair< std::string, uint64_t > | Version () const |
virtual bool | Compare (TPZSavable *copy, bool override=false) |
Compares the object for identity with the object pointed to, eventually copy the object. More... | |
virtual bool | Compare (TPZSavable *copy, bool override=false) const |
Compares the object for identity with the object pointed to, eventually copy the object. More... | |
Public Member Functions inherited from TPZRegisterClassId | |
template<typename T > | |
TPZRegisterClassId (int(T::*)() const) | |
TPZRegisterClassId ()=default | |
Protected Attributes | |
TPZManVector< int > | fCounter |
Variable which represents a counter for the permutations. More... | |
TPZManVector< int > | fOrder |
Variable which contains the current permutations. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from TPZSavable | |
static std::set< TPZRestoreClassBase * > & | RestoreClassSet () |
This static function guarantees that the gMap object is available when needed. More... | |
static std::map< int, TPZRestore_t > & | ClassIdMap () |
This static function guarantees that the gMap object is available when needed. More... | |
static std::pair< std::string, uint64_t > | NeoPZVersion () |
static void | Register (TPZRestoreClassBase *restore) |
static void | RegisterClassId (int classid, TPZRestore_t fun) |
static TPZSavable * | CreateInstance (const int &classId) |
This class generates all permutations of n values. Utility.
Definition at line 17 of file tpzpermutation.h.
TPZPermutation::TPZPermutation | ( | int | n | ) |
Constructor with number of permutations.
Definition at line 10 of file tpzpermutation.cpp.
References fOrder.
TPZPermutation::TPZPermutation | ( | const TPZPermutation & | copy | ) |
Copy constructor.
Definition at line 16 of file tpzpermutation.cpp.
TPZPermutation::~TPZPermutation | ( | ) |
Default destructor.
Definition at line 27 of file tpzpermutation.cpp.
|
overridevirtual |
Define the class id associated with the class.
This id has to be unique for all classes A non unique id is flagged at the startup of the program
Implements TPZSavable.
Definition at line 71 of file tpzpermutation.cpp.
References Hash().
Referenced by operator++().
|
inline |
Returns the counter of the permutations.
Definition at line 44 of file tpzpermutation.h.
References fCounter.
Referenced by operator<<().
bool TPZPermutation::IsFirst | ( | ) |
Definition at line 63 of file tpzpermutation.cpp.
References fCounter, and TPZVec< T >::NElements().
Referenced by TPZRefPattern::GeneratePermutations(), and operator++().
void TPZPermutation::operator++ | ( | ) |
Operator increment.
Definition at line 43 of file tpzpermutation.cpp.
References fCounter, TPZVec< T >::Fill(), fOrder, and TPZVec< T >::NElements().
|
inline |
Definition at line 36 of file tpzpermutation.h.
References ClassId(), IsFirst(), operator++(), Read(), and Write().
Referenced by operator++().
TPZPermutation & TPZPermutation::operator= | ( | const TPZPermutation & | copy | ) |
Operator attribution.
Definition at line 20 of file tpzpermutation.cpp.
|
inline |
Applies the current permutation on the vector in and produces the vector out.
Definition at line 32 of file tpzpermutation.cpp.
References fCounter, fOrder, and TPZVec< T >::NElements().
Referenced by TPZRefPattern::GeneratePermutations(), and TPZRefPattern::PermuteMesh().
Definition at line 37 of file tpzpermutation.cpp.
References fCounter, fOrder, and TPZVec< T >::NElements().
|
overridevirtual |
read objects from the stream
Reimplemented from TPZSavable.
Definition at line 75 of file tpzpermutation.cpp.
References fCounter, fOrder, and TPZStream::Read().
Referenced by operator++().
|
overridevirtual |
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Writes this object to the TPZStream buffer. Include the classid if withclassid = true
Reimplemented from TPZSavable.
Definition at line 80 of file tpzpermutation.cpp.
References fCounter, fOrder, and TPZStream::Write().
Referenced by operator++().
|
protected |
Variable which represents a counter for the permutations.
Definition at line 57 of file tpzpermutation.h.
Referenced by Counter(), IsFirst(), operator++(), operator=(), Permute(), Read(), and Write().
|
protected |
Variable which contains the current permutations.
Definition at line 60 of file tpzpermutation.h.
Referenced by operator++(), operator=(), Order(), Permute(), Read(), TPZPermutation(), and Write().