ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
actions.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <boost/functional/hash.hpp>
23
24#include <array>
25#include <cstddef>
26
27namespace BondBreakage {
28
29// Delete Actions
30struct DeleteBond {
34 std::size_t hash_value() const {
35 std::size_t seed = 3875;
36 boost::hash_combine(seed, particle_id);
37 boost::hash_combine(seed, bond_partner_id);
38 boost::hash_combine(seed, bond_type);
39 return seed;
40 }
41 bool operator==(DeleteBond const &) const = default;
42 bool operator!=(DeleteBond const &) const = default;
43};
44
47 std::array<int, 2> bond_partner_id;
49 std::size_t hash_value() const {
50 std::size_t seed = 3876;
51 boost::hash_combine(seed, particle_id);
52 boost::hash_combine(seed, bond_partner_id);
53 boost::hash_combine(seed, bond_type);
54 return seed;
55 }
56 bool operator==(DeleteAngleBond const &) const = default;
57 bool operator!=(DeleteAngleBond const &) const = default;
58};
59
63 std::size_t hash_value() const {
64 std::size_t seed = 75;
65 boost::hash_combine(seed, particle_id_1);
66 boost::hash_combine(seed, particle_id_2);
67 return seed;
68 }
69 bool operator==(DeleteAllBonds const &) const = default;
70 bool operator!=(DeleteAllBonds const &) const = default;
71};
72
73} // namespace BondBreakage
74
75// Hash support for std::unordered_set
76namespace std {
77template <> struct hash<BondBreakage::DeleteBond> {
78 std::size_t operator()(BondBreakage::DeleteBond const &t) const noexcept {
79 return t.hash_value();
80 }
81};
82template <> struct hash<BondBreakage::DeleteAngleBond> {
83 std::size_t
84 operator()(BondBreakage::DeleteAngleBond const &t) const noexcept {
85 return t.hash_value();
86 }
87};
88template <> struct hash<BondBreakage::DeleteAllBonds> {
89 std::size_t operator()(BondBreakage::DeleteAllBonds const &t) const noexcept {
90 return t.hash_value();
91 }
92};
93} // namespace std
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
STL namespace.
std::size_t hash_value() const
Definition actions.hpp:63
bool operator!=(DeleteAllBonds const &) const =default
bool operator==(DeleteAllBonds const &) const =default
bool operator==(DeleteAngleBond const &) const =default
std::size_t hash_value() const
Definition actions.hpp:49
std::array< int, 2 > bond_partner_id
Definition actions.hpp:47
bool operator!=(DeleteAngleBond const &) const =default
bool operator!=(DeleteBond const &) const =default
std::size_t hash_value() const
Definition actions.hpp:34
bool operator==(DeleteBond const &) const =default
std::size_t operator()(BondBreakage::DeleteAllBonds const &t) const noexcept
Definition actions.hpp:89
std::size_t operator()(BondBreakage::DeleteAngleBond const &t) const noexcept
Definition actions.hpp:84
std::size_t operator()(BondBreakage::DeleteBond const &t) const noexcept
Definition actions.hpp:78