OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
AmrParticleLevelCounter< Key, T, Compare, Allocator > Class Template Reference

#include <AmrParticleLevelCounter.h>

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))
 
Toperator[] (T level)
 
const Toperator[] (T level) const
 
size_type size () const
 
bool empty () const
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
T begin (T level) const
 
T end (T level) const
 
void remove (T num, T begin)
 
T getLocalNumAllLevel ()
 
T getLocalNumUpToLevel (T level) const
 
T getLocalNumAtLevel (T level) const
 

Private Member Functions

T which (T idx)
 

Private Attributes

std::map< Key, Tcount_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 >

Helper class in order to keep track of particles per level. It allows to iterate faster through particles at a certain level. The class is built on the STL map container where the key represents the level and the value is the the number of particles at that level.

Definition at line 22 of file AmrParticleLevelCounter.h.

Member Typedef Documentation

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 29 of file AmrParticleLevelCounter.h.

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 28 of file AmrParticleLevelCounter.h.

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 27 of file AmrParticleLevelCounter.h.

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 26 of file AmrParticleLevelCounter.h.

Constructor & Destructor Documentation

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 33 of file AmrParticleLevelCounter.h.

Member Function Documentation

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
iterator AmrParticleLevelCounter< Key, T, Compare, Allocator >::begin ( )
inline
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 58 of file AmrParticleLevelCounter.h.

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 69 of file AmrParticleLevelCounter.h.

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 47 of file AmrParticleLevelCounter.h.

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 55 of file AmrParticleLevelCounter.h.

template<class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator<std::pair<const Key, T> >>
iterator AmrParticleLevelCounter< Key, T, Compare, Allocator >::end ( )
inline
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 61 of file AmrParticleLevelCounter.h.

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 88 of file AmrParticleLevelCounter.h.

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 110 of file AmrParticleLevelCounter.h.

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 131 of file AmrParticleLevelCounter.h.

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 118 of file AmrParticleLevelCounter.h.

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 40 of file AmrParticleLevelCounter.h.

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

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 49 of file AmrParticleLevelCounter.h.

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 51 of file AmrParticleLevelCounter.h.

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 96 of file AmrParticleLevelCounter.h.

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
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 142 of file AmrParticleLevelCounter.h.

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

Member Data Documentation

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

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