libMesh
Loading...
Searching...
No Matches
elem_hash.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18#ifndef LIBMESH_ELEM_HASH_H
19#define LIBMESH_ELEM_HASH_H
20
21#include "elem.h"
22
23// C++ includes
24#include <unordered_set>
25
26// This header defines some typedefs that are useful for working with
27// "unordered" containers of Elem * that use Elem::key() as a hash
28// function.
29namespace libMesh
30{
31
47{
48public:
55 inline
56 std::size_t operator()(const Elem * elem) const
57 {
58 return cast_int<std::size_t>(elem->key());
59 }
60
69 inline
70 bool operator()(const Elem * lhs, const Elem * rhs) const
71 {
72 return lhs->key() == rhs->key();
73 }
74};
75
76// A convenient type for working with unordered_multiset<Elem *>
77typedef std::unordered_multiset<Elem *, ElemHashUtils, ElemHashUtils> unordered_multiset_elem;
78
79}
80
81#endif
This is the base class from which all geometric element types are derived.
Definition elem.h:96
virtual dof_id_type key(const unsigned int s) const =0
The libMesh namespace provides an interface to certain functionality in the library.
std::unordered_multiset< Elem *, ElemHashUtils, ElemHashUtils > unordered_multiset_elem
Definition elem_hash.h:77
The ElemHashUtils struct defines functions used for the "Hash" and "Pred" template arguments of the v...
Definition elem_hash.h:47
std::size_t operator()(const Elem *elem) const
The "Hash" template argument.
Definition elem_hash.h:56
bool operator()(const Elem *lhs, const Elem *rhs) const
Satisfies the requirements of the "Pred" template parameter of the standard hash containers.
Definition elem_hash.h:70