chombo-discharge
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ParticleManagement::detail::NNCellKeyHasher Struct Reference

Hash functor for NNCellKey – REQUIRED whenever NNCellKey is used as a hash-map key; NNCellKey must never be used as an ordered (std::map or std::set) key. More...

#include <CD_NearestNeighborParticleMerge.H>

Public Member Functions

std::size_t operator() (const NNCellKey &a_key) const noexcept
 Hash operator.
 

Detailed Description

Hash functor for NNCellKey – REQUIRED whenever NNCellKey is used as a hash-map key; NNCellKey must never be used as an ordered (std::map or std::set) key.

IntVect::operator< (which std::pair<int,IntVect>::operator< calls for the second component) is a component-wise "strictly dominates in every direction" partial order, not a strict weak ordering. Two unrelated cells where neither dominates the other (e.g. (76,104) vs (80,101)) compare as neither-less-than, which std::map/std::set treat as equal keys – pooling unrelated cells' counts into one entry. Hashing depends only on IntVect::operator== (full component-wise equality), which is correct.

Member Function Documentation

◆ operator()()

std::size_t ParticleManagement::detail::NNCellKeyHasher::operator() ( const NNCellKey a_key) const
inlinenoexcept

Hash operator.

Parameters
[in]a_keyCell key to hash.
Returns
Hash value.

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