Tpetra parallel linear algebra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
Tpetra_HashTable_decl.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Tpetra: Templated Linear Algebra Services Package
4
//
5
// Copyright 2008 NTESS and the Tpetra contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TPETRA_HASHTABLE_DECL_HPP
11
#define TPETRA_HASHTABLE_DECL_HPP
12
13
#include <Teuchos_Describable.hpp>
14
#include "Tpetra_ConfigDefs.hpp"
15
16
namespace
Tpetra
{
17
namespace
Details
{
18
31
template
<
typename
KeyType,
typename
ValueType>
32
class
HashTable
:
public
Teuchos::Describable {
34
struct
Node {
35
KeyType Key;
36
ValueType Value;
37
Node* Ptr;
38
39
Node(
const
KeyType key = 0,
const
ValueType value = 0, Node* ptr = NULL)
40
: Key(key)
41
, Value(value)
42
, Ptr(ptr) {}
43
44
private
:
45
Node(
const
Node& src)
46
: Key(src.Key)
47
, Value(src.Value)
48
, Ptr(src.Ptr) {}
49
50
Node& operator=(
const
Node& src) {
51
// We may safely omit the usual check for this == &src.
52
Key = src.Key;
53
Value = src.Value;
54
Ptr = src.Ptr;
55
return
*
this
;
56
}
57
};
58
59
Node** Container_;
60
KeyType Size_;
61
unsigned
int
Seed_;
62
#ifdef HAVE_TPETRA_DEBUG
63
int
maxc_;
// Max size of the list among all entries w/ collisions. debug only.
64
int
nc_;
// Number of entries with collisions; use only in debug mode.
65
#endif
// HAVE_TPETRA_DEBUG
66
69
int
hashFunc(
const
KeyType key);
70
71
int
getRecommendedSize(
const
int
size);
72
73
public
:
80
HashTable
(
const
int
size,
const
unsigned
int
seed = (2654435761U));
81
82
HashTable
(
const
HashTable
& obj);
83
~HashTable
();
84
86
void
add
(
const
KeyType key,
const
ValueType value);
87
89
ValueType
get
(
const
KeyType key);
90
92
93
94
std::string
description
()
const
;
95
97
void
98
describe
(Teuchos::FancyOStream& out,
99
const
Teuchos::EVerbosityLevel verbLevel =
100
Teuchos::Describable::verbLevel_default)
const
;
102
103
private
:
105
HashTable<KeyType, ValueType>
&
106
operator=(
const
HashTable<KeyType, ValueType>
& source);
107
};
108
109
}
// namespace Details
110
111
}
// namespace Tpetra
112
113
#endif
Tpetra::Details::HashTable::HashTable
HashTable(const int size, const unsigned int seed=(2654435761U))
Definition
Tpetra_HashTable_def.hpp:70
Tpetra::Details::HashTable::get
ValueType get(const KeyType key)
Get the value corresponding to the given key.
Definition
Tpetra_HashTable_def.hpp:133
Tpetra::Details::HashTable::description
std::string description() const
Implementation of Teuchos::Describable.
Definition
Tpetra_HashTable_def.hpp:158
Tpetra::Details::HashTable::describe
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print this object with the given verbosity to the output stream.
Definition
Tpetra_HashTable_def.hpp:168
Tpetra::Details::HashTable::add
void add(const KeyType key, const ValueType value)
Add a key and its value to the hash table.
Definition
Tpetra_HashTable_def.hpp:124
Tpetra::Details
Nonmember function that computes a residual Computes R = B - A * X.
Definition
Tpetra_KokkosRefactor_Details_MultiVectorLocalDeepCopy.hpp:17
Tpetra
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Generated by
1.17.0