CLUEstering
High-performance density-based weighted clustering library developed at CERN
Loading...
Searching...
No Matches
clue::AssociationMap< TDev > Class Template Reference

The AssociationMap class is a data structure that maps keys to values. It associates integer keys with integer values in ono-to-many or many-to-many associations. More...

#include <AssociationMap.hpp>

Classes

struct  Extents
 

Public Types

using key_type = int32_t
 
using mapped_type = int32_t
 
using value_type = std::pair<key_type, mapped_type>
 
using size_type = std::size_t
 
using iterator = mapped_type*
 
using const_iterator = const mapped_type*
 

Public Member Functions

 AssociationMap ()=default
 Construct an empty AssociationMap.
 
 AssociationMap (size_type nelements, size_type nbins, const TDev &dev)
 Construct an AssociationMap with a specific number of elements and bins.
 
template<concepts::queue TQueue>
 AssociationMap (size_type nelements, size_type nbins, TQueue &queue)
 Construct an AssociationMap with a specific number of elements and bins.
 
auto size () const
 Return the number of bins in the map.
 
auto extents () const
 Return the extents of the internal buffers.
 
iterator begin ()
 Return iterator to the beginning of the content buffer.
 
const_iterator begin () const
 Return const iterator to the beginning of the content buffer.
 
const_iterator cbegin () const
 Return const iterator to the beginning of the content buffer.
 
iterator end ()
 Return iterator to the end of the content buffer.
 
const_iterator end () const
 Return const iterator to the end of the content buffer.
 
const_iterator cend () const
 Return const iterator to the end of the content buffer.
 
iterator find (key_type key)
 
const_iterator find (key_type key) const
 
size_type count (key_type key) const
 Count the number of elements with the given key.
 
bool contains (key_type key) const
 Check if the map contains elements with a given key.
 
iterator lower_bound (key_type key)
 Get the iterator to the first element with a given key.
 
const_iterator lower_bound (key_type key) const
 Get the const iterator to the first element with a given key.
 
iterator upper_bound (key_type key)
 Get the iterator to the first element with a key greater than the given key.
 
const_iterator upper_bound (key_type key) const
 Get the const iterator to the first element with a key greater than the given key.
 
std::pair< iterator, iterator > equal_range (key_type key)
 Get the range of elements with a given key.
 
std::pair< const_iterator, const_iterator > equal_range (key_type key) const
 Get the const range of elements with a given key.
 

Friends

template<concepts::device _TDev>
class Followers
 
template<uint8_t Ndim, concepts::device _TDev>
class TilesAlpaka
 
template<concepts::queue _TQueue>
auto clue::test::build_map (_TQueue &, std::span< key_type >, int32_t)
 

Detailed Description

template<concepts::device TDev = clue::Device>
class clue::AssociationMap< TDev >

The AssociationMap class is a data structure that maps keys to values. It associates integer keys with integer values in ono-to-many or many-to-many associations.

Template Parameters
TDevThe device type to use for the allocation. Defaults to clue::Device.

Constructor & Destructor Documentation

◆ AssociationMap() [1/2]

template<concepts::device TDev = clue::Device>
clue::AssociationMap< TDev >::AssociationMap ( size_type nelements,
size_type nbins,
const TDev & dev )

Construct an AssociationMap with a specific number of elements and bins.

Parameters
nelementsThe number of elements to allocate
nbinsThe number of bins to allocate
devThe device to use for the allocation

◆ AssociationMap() [2/2]

template<concepts::device TDev = clue::Device>
template<concepts::queue TQueue>
clue::AssociationMap< TDev >::AssociationMap ( size_type nelements,
size_type nbins,
TQueue & queue )

Construct an AssociationMap with a specific number of elements and bins.

Parameters
nelementsThe number of elements to allocate
nbinsThe number of bins to allocate
queueThe queue to use for the allocation

Member Function Documentation

◆ begin() [1/2]

template<concepts::device TDev = clue::Device>
iterator clue::AssociationMap< TDev >::begin ( )

Return iterator to the beginning of the content buffer.

Returns
An iterator to the beginning of the content buffer

◆ begin() [2/2]

template<concepts::device TDev = clue::Device>
const_iterator clue::AssociationMap< TDev >::begin ( ) const

Return const iterator to the beginning of the content buffer.

Returns
A const iterator to the beginning of the content buffer

◆ cbegin()

template<concepts::device TDev = clue::Device>
const_iterator clue::AssociationMap< TDev >::cbegin ( ) const

Return const iterator to the beginning of the content buffer.

Returns
A const iterator to the beginning of the content buffer

◆ cend()

template<concepts::device TDev = clue::Device>
const_iterator clue::AssociationMap< TDev >::cend ( ) const

Return const iterator to the end of the content buffer.

Returns
A const iterator to the end of the content buffer

◆ contains()

template<concepts::device TDev = clue::Device>
bool clue::AssociationMap< TDev >::contains ( key_type key) const

Check if the map contains elements with a given key.

Parameters
keyThe key to check
Returns
True if the map contains elements with the given key, false otherwise

◆ count()

template<concepts::device TDev = clue::Device>
size_type clue::AssociationMap< TDev >::count ( key_type key) const

Count the number of elements with the given key.

Parameters
keyThe key to count
Returns
The number of elements associated to a given key

◆ end() [1/2]

template<concepts::device TDev = clue::Device>
iterator clue::AssociationMap< TDev >::end ( )

Return iterator to the end of the content buffer.

Returns
An iterator to the end of the content buffer

◆ end() [2/2]

template<concepts::device TDev = clue::Device>
const_iterator clue::AssociationMap< TDev >::end ( ) const

Return const iterator to the end of the content buffer.

Returns
A const iterator to the end of the content buffer

◆ equal_range() [1/2]

template<concepts::device TDev = clue::Device>
std::pair< iterator, iterator > clue::AssociationMap< TDev >::equal_range ( key_type key)

Get the range of elements with a given key.

Parameters
keyThe key to search for
Returns
A pair of iterators representing the range of elements with the given key

◆ equal_range() [2/2]

template<concepts::device TDev = clue::Device>
std::pair< const_iterator, const_iterator > clue::AssociationMap< TDev >::equal_range ( key_type key) const

Get the const range of elements with a given key.

Parameters
keyThe key to search for
Returns
A pair of const iterators representing the range of elements with the given key

◆ extents()

template<concepts::device TDev = clue::Device>
auto clue::AssociationMap< TDev >::extents ( ) const

Return the extents of the internal buffers.

Returns
A struct containing the number of keys and values in the map

◆ lower_bound() [1/2]

template<concepts::device TDev = clue::Device>
iterator clue::AssociationMap< TDev >::lower_bound ( key_type key)

Get the iterator to the first element with a given key.

Parameters
keyThe key to search for
Returns
An iterator to the first element with the given key

◆ lower_bound() [2/2]

template<concepts::device TDev = clue::Device>
const_iterator clue::AssociationMap< TDev >::lower_bound ( key_type key) const

Get the const iterator to the first element with a given key.

Parameters
keyThe key to search for
Returns
A const iterator to the first element with the given key

◆ size()

template<concepts::device TDev = clue::Device>
auto clue::AssociationMap< TDev >::size ( ) const

Return the number of bins in the map.

Returns
The number of bins in the map

◆ upper_bound() [1/2]

template<concepts::device TDev = clue::Device>
iterator clue::AssociationMap< TDev >::upper_bound ( key_type key)

Get the iterator to the first element with a key greater than the given key.

Parameters
keyThe key to search for
Returns
An iterator to the first element with a key greater than the given key

◆ upper_bound() [2/2]

template<concepts::device TDev = clue::Device>
const_iterator clue::AssociationMap< TDev >::upper_bound ( key_type key) const

Get the const iterator to the first element with a key greater than the given key.

Parameters
keyThe key to search for
Returns
A const iterator to the first element with a key greater than the given key

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