OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
AmrParticleLevelCounter< Key, T, Compare, Allocator > Class Template Reference

#include <AmrParticleLevelCounter.h>

Inheritance diagram for AmrParticleLevelCounter< Key, T, Compare, Allocator >:
Collaboration diagram for AmrParticleLevelCounter< Key, T, Compare, Allocator >:

Public Types

typedef std::map< Key, T >::value_type value_type
typedef std::map< Key, T >::size_type size_type
typedef std::map< Key, T >::iterator iterator
typedef std::map< Key, T >::const_iterator const_iterator

Public Member Functions

 AmrParticleLevelCounter ()
void increment (const Key &level, T nTimes=T(1))
void decrement (const Key &level, T nTimes=T(1))
T & operator[] (T level)
const T & operator[] (T level) const
size_type size () const
bool empty () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
begin (T level) const
end (T level) const
void remove (T num, T begin)
getLocalNumAllLevel ()
getLocalNumUpToLevel (T level) const
getLocalNumAtLevel (T level) const

Private Member Functions

which (T idx)

Private Attributes

std::map< Key, T > count_m

Detailed Description

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
class AmrParticleLevelCounter< Key, T, Compare, Allocator >

Definition at line 39 of file AmrParticleLevelCounter.h.

Member Typedef Documentation

◆ const_iterator

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
typedef std::map<Key,T>::const_iterator AmrParticleLevelCounter< Key, T, Compare, Allocator >::const_iterator

Definition at line 46 of file AmrParticleLevelCounter.h.

◆ iterator

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
typedef std::map<Key,T>::iterator AmrParticleLevelCounter< Key, T, Compare, Allocator >::iterator

Definition at line 45 of file AmrParticleLevelCounter.h.

◆ size_type

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
typedef std::map<Key,T>::size_type AmrParticleLevelCounter< Key, T, Compare, Allocator >::size_type

Definition at line 44 of file AmrParticleLevelCounter.h.

◆ value_type

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
typedef std::map<Key,T>::value_type AmrParticleLevelCounter< Key, T, Compare, Allocator >::value_type

Definition at line 43 of file AmrParticleLevelCounter.h.

Constructor & Destructor Documentation

◆ AmrParticleLevelCounter()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
AmrParticleLevelCounter< Key, T, Compare, Allocator >::AmrParticleLevelCounter ( )
inline

Definition at line 50 of file AmrParticleLevelCounter.h.

Member Function Documentation

◆ begin() [1/3]

◆ begin() [2/3]

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
const_iterator AmrParticleLevelCounter< Key, T, Compare, Allocator >::begin ( ) const
inline

Definition at line 75 of file AmrParticleLevelCounter.h.

◆ begin() [3/3]

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
T AmrParticleLevelCounter< Key, T, Compare, Allocator >::begin ( T level) const
inline

Obtain the start of a level

Parameters
level
Returns
the local starting index

Definition at line 86 of file AmrParticleLevelCounter.h.

◆ decrement()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
void AmrParticleLevelCounter< Key, T, Compare, Allocator >::decrement ( const Key & level,
T nTimes = T(1) )
inline

Add more "particles" to that level

Parameters
levelwhere to add
nTimesto decrement

Definition at line 64 of file AmrParticleLevelCounter.h.

◆ empty()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
bool AmrParticleLevelCounter< Key, T, Compare, Allocator >::empty ( ) const
inline

Definition at line 72 of file AmrParticleLevelCounter.h.

◆ end() [1/3]

◆ end() [2/3]

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
const_iterator AmrParticleLevelCounter< Key, T, Compare, Allocator >::end ( ) const
inline

Definition at line 78 of file AmrParticleLevelCounter.h.

◆ end() [3/3]

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
T AmrParticleLevelCounter< Key, T, Compare, Allocator >::end ( T level) const
inline

Obtain the end of a level

Parameters
level
Returns
the index of the local end of that level

Definition at line 105 of file AmrParticleLevelCounter.h.

◆ getLocalNumAllLevel()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
T AmrParticleLevelCounter< Key, T, Compare, Allocator >::getLocalNumAllLevel ( )
inline
Returns
the total particle count (should be the same as AmrParticleBase::LocalNum)

Definition at line 127 of file AmrParticleLevelCounter.h.

◆ getLocalNumAtLevel()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
T AmrParticleLevelCounter< Key, T, Compare, Allocator >::getLocalNumAtLevel ( T level) const
inline
Returns
the total particle count at the given level

Definition at line 148 of file AmrParticleLevelCounter.h.

◆ getLocalNumUpToLevel()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
T AmrParticleLevelCounter< Key, T, Compare, Allocator >::getLocalNumUpToLevel ( T level) const
inline
Returns
the total particle count up to the given level

Definition at line 135 of file AmrParticleLevelCounter.h.

◆ increment()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
void AmrParticleLevelCounter< Key, T, Compare, Allocator >::increment ( const Key & level,
T nTimes = T(1) )
inline

Add more "particles" to that level

Parameters
levelwhere to add
nTimesto increment

Definition at line 57 of file AmrParticleLevelCounter.h.

Referenced by AmrParticleLevelCounter< size_t, size_t >::decrement().

◆ operator[]() [1/2]

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
T & AmrParticleLevelCounter< Key, T, Compare, Allocator >::operator[] ( T level)
inline

Definition at line 66 of file AmrParticleLevelCounter.h.

◆ operator[]() [2/2]

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
const T & AmrParticleLevelCounter< Key, T, Compare, Allocator >::operator[] ( T level) const
inline

Definition at line 68 of file AmrParticleLevelCounter.h.

◆ remove()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
void AmrParticleLevelCounter< Key, T, Compare, Allocator >::remove ( T num,
T begin )
inline

Remove particle indices from the container

Parameters
numof particles that will be removed
beginof index

Definition at line 113 of file AmrParticleLevelCounter.h.

◆ size()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
size_type AmrParticleLevelCounter< Key, T, Compare, Allocator >::size ( ) const
inline

◆ which()

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
T AmrParticleLevelCounter< Key, T, Compare, Allocator >::which ( T idx)
inlineprivate

Find the level the particle belongs to

Parameters
idxis the local index of the particle
Returns
the level

Definition at line 159 of file AmrParticleLevelCounter.h.

Referenced by AmrParticleLevelCounter< size_t, size_t >::remove().

Member Data Documentation

◆ count_m

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
std::map<Key, T> AmrParticleLevelCounter< Key, T, Compare, Allocator >::count_m
private

Key represents level T represents number of particles

Definition at line 174 of file AmrParticleLevelCounter.h.


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