Peano 4
Loading...
Searching...
No Matches
tarch::Enumerator Class Reference

Simple rank-global enumerator. More...

#include <Enumerator.h>

Collaboration diagram for tarch::Enumerator:

Public Member Functions

 Enumerator ()
 
void reset ()
 
int getNumber ()
 Returns a unique non-zero number which is not yet used anywhere else on this rank.
 
void releaseNumber (int value)
 Free a number again.
 
int size () const
 Number of numbers handed out so far.
 
std::string toString () const
 

Static Public Attributes

static constexpr int NoNumber = -1
 

Private Attributes

tarch::multicore::BooleanSemaphore _semaphore
 
std::set< int_activeNumbers
 

Detailed Description

Simple rank-global enumerator.

Very simple utility class to build up a global set of numbers on a rank. Is used in various places to create task numbers for example or to enumerate all vertices and cells properly.

Definition at line 22 of file Enumerator.h.

Constructor & Destructor Documentation

◆ Enumerator()

tarch::Enumerator::Enumerator ( )

Definition at line 9 of file Enumerator.cpp.

Member Function Documentation

◆ getNumber()

int tarch::Enumerator::getNumber ( )

Returns a unique non-zero number which is not yet used anywhere else on this rank.

Definition at line 26 of file Enumerator.cpp.

References assertion2.

◆ releaseNumber()

void tarch::Enumerator::releaseNumber ( int value)

Free a number again.

number has to be the result of a previous getNumber() call.

Definition at line 44 of file Enumerator.cpp.

References assertion, and assertionEquals.

◆ reset()

void tarch::Enumerator::reset ( )

Definition at line 15 of file Enumerator.cpp.

Referenced by swift2::TaskEnumerator::reset().

Here is the caller graph for this function:

◆ size()

int tarch::Enumerator::size ( ) const

Number of numbers handed out so far.

Definition at line 21 of file Enumerator.cpp.

Referenced by peano4.visualisation.Patch.Patch::__str__(), and exahype2::EnclaveTask::getNumberOfActiveTasks().

Here is the caller graph for this function:

◆ toString()

std::string tarch::Enumerator::toString ( ) const

Definition at line 52 of file Enumerator.cpp.

Field Documentation

◆ _activeNumbers

std::set<int> tarch::Enumerator::_activeNumbers
private

Definition at line 50 of file Enumerator.h.

◆ _semaphore

tarch::multicore::BooleanSemaphore tarch::Enumerator::_semaphore
private

Definition at line 49 of file Enumerator.h.

◆ NoNumber

constexpr int tarch::Enumerator::NoNumber = -1
staticconstexpr

Definition at line 24 of file Enumerator.h.


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