ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
BindCoupling.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2010-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
#ifndef CORE_CONSTRAINTS_DETAIL_BIND_COUPLING_HPP
20
#define CORE_CONSTRAINTS_DETAIL_BIND_COUPLING_HPP
21
22
namespace
FieldCoupling
{
23
namespace
detail {
24
/**
25
* @brief Helper class that binds a coupling to a particles
26
and propagates Coupling::is_linear.
27
*/
28
template
<
typename
Coupling,
typename
Particle>
struct
BindCoupling {
29
static
const
constexpr
bool
is_linear = Coupling::is_linear;
30
31
const
Coupling &c;
32
const
Particle
&p;
33
34
BindCoupling(
const
Coupling &c,
const
Particle
&p) : c(c), p(p) {}
35
36
template
<
typename
T>
auto
operator()(
const
T &x)
const
->
decltype
(c(p, x)) {
37
return
c(p, x);
38
}
39
};
40
41
template
<
typename
Coupling,
typename
Particle>
42
BindCoupling<Coupling, Particle> make_bind_coupling(
const
Coupling &c,
43
const
Particle
&p) {
44
return
BindCoupling<Coupling, Particle>{c, p};
45
}
46
}
// namespace detail
47
}
// namespace FieldCoupling
48
49
#endif
FieldCoupling
Definition
Charge.hpp:22
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:395
src
core
field_coupling
detail
BindCoupling.hpp
Generated on Fri Nov 8 2024 02:12:53 for ESPResSo by
1.9.8