libMesh::ElemHashUtils Struct Reference

A struct providing convenience functions for hashing elements. More...

#include <elem_hash.h>

Public Member Functions

std::size_t operator() (const Elem *elem) const
bool operator() (const Elem *lhs, const Elem *rhs) const

Detailed Description

A struct providing convenience functions for hashing elements.

The ElemHashUtils struct defines functions used for the "Hash" and "Pred" template arguments of the various "unordered" containers, e.g. template <class Key, // unordered_multiset::key_type/value_type class Hash = hash<Key>, // unordered_multiset::hasher class Pred = equal_to<Key>, // unordered_multiset::key_equal class Alloc = allocator<Key> // unordered_multiset::allocator_type > class unordered_multiset;

John W. Peterson

Definition at line 45 of file elem_hash.h.

Member Function Documentation

std::size_t libMesh::ElemHashUtils::operator() ( const Elem elem) const

The "Hash" template argument. A custom hash functor that can be used with the "unordered" container types.

A hash for the element computed by calling elem->key().

Definition at line 55 of file elem_hash.h.

References libMesh::Elem::key().

56  {
57  return cast_int<std::size_t>(elem->key());
58  }
bool libMesh::ElemHashUtils::operator() ( const Elem lhs,
const Elem rhs 
) const

Satisfies the requirements of the "Pred" template parameter of the standard hash containers. We need to specify this in order to use the unordered_multiset, otherwise it just uses std::equal_to to compare two pointers...

true if the two Elem keys are equal, false otherwise.

Definition at line 69 of file elem_hash.h.

References libMesh::Elem::key().

70  {
71  return lhs->key() == rhs->key();
72  }

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