NeoPZ
Public Member Functions | Protected Attributes | List of all members
TPZPermutation Class Reference

This class generates all permutations of n values. Utility. More...

#include <tpzpermutation.h>

Inheritance diagram for TPZPermutation:
[legend]
Collaboration diagram for TPZPermutation:
[legend]

Public Member Functions

 TPZPermutation (int n)
 Constructor with number of permutations. More...
 
 TPZPermutation (const TPZPermutation &copy)
 Copy constructor. More...
 
 ~TPZPermutation ()
 Default destructor. More...
 
TPZPermutationoperator= (const TPZPermutation &copy)
 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 TPZSavableCreateInstance (const int &classId)
 

Detailed Description

This class generates all permutations of n values. Utility.

Author
Philippe R. B. Devloo

Definition at line 17 of file tpzpermutation.h.

Constructor & Destructor Documentation

◆ TPZPermutation() [1/2]

TPZPermutation::TPZPermutation ( int  n)

Constructor with number of permutations.

Definition at line 10 of file tpzpermutation.cpp.

References fOrder.

◆ TPZPermutation() [2/2]

TPZPermutation::TPZPermutation ( const TPZPermutation copy)

Copy constructor.

Definition at line 16 of file tpzpermutation.cpp.

◆ ~TPZPermutation()

TPZPermutation::~TPZPermutation ( )

Default destructor.

Definition at line 27 of file tpzpermutation.cpp.

Member Function Documentation

◆ ClassId()

int TPZPermutation::ClassId ( ) const
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++().

◆ Counter()

TPZManVector<int> TPZPermutation::Counter ( )
inline

Returns the counter of the permutations.

Definition at line 44 of file tpzpermutation.h.

References fCounter.

Referenced by operator<<().

◆ IsFirst()

bool TPZPermutation::IsFirst ( )

Definition at line 63 of file tpzpermutation.cpp.

References fCounter, and TPZVec< T >::NElements().

Referenced by TPZRefPattern::GeneratePermutations(), and operator++().

◆ operator++() [1/2]

void TPZPermutation::operator++ ( )

Operator increment.

Definition at line 43 of file tpzpermutation.cpp.

References fCounter, TPZVec< T >::Fill(), fOrder, and TPZVec< T >::NElements().

◆ operator++() [2/2]

void TPZPermutation::operator++ ( int  )
inline

Definition at line 36 of file tpzpermutation.h.

References ClassId(), IsFirst(), operator++(), Read(), and Write().

Referenced by operator++().

◆ operator=()

TPZPermutation & TPZPermutation::operator= ( const TPZPermutation copy)

Operator attribution.

Definition at line 20 of file tpzpermutation.cpp.

References fCounter, and fOrder.

◆ Order()

TPZManVector<int> TPZPermutation::Order ( )
inline

Definition at line 49 of file tpzpermutation.h.

References fOrder.

Referenced by operator<<().

◆ Permute() [1/2]

void TPZPermutation::Permute ( const TPZVec< int > &  in,
TPZVec< int > &  out 
) const

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().

◆ Permute() [2/2]

void TPZPermutation::Permute ( const TPZVec< int64_t > &  in,
TPZVec< int64_t > &  out 
) const

Definition at line 37 of file tpzpermutation.cpp.

References fCounter, fOrder, and TPZVec< T >::NElements().

◆ Read()

void TPZPermutation::Read ( TPZStream buf,
void *  context 
)
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++().

◆ Write()

void TPZPermutation::Write ( TPZStream buf,
int  withclassid 
) const
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++().

Member Data Documentation

◆ fCounter

TPZManVector<int> TPZPermutation::fCounter
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().

◆ fOrder

TPZManVector<int> TPZPermutation::fOrder
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().


The documentation for this class was generated from the following files: