ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
properties.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 OBSERVABLES_PROPERTIES_HPP
20
#define OBSERVABLES_PROPERTIES_HPP
21
22
/** @file properties.hpp
23
* This file contains interface functionality for extracting particle properties
24
* via a particle traits class.
25
*/
26
namespace
ParticleObservables
{
27
template
<
class
DoF>
struct
traits
;
28
29
namespace
detail {
30
template
<
class
T>
struct
decay {
31
using
type =
typename
std::decay_t<T>;
32
};
33
34
template
<
class
U>
struct
decay<std::reference_wrapper<U>> {
35
using
type = std::decay_t<U>;
36
};
37
38
template
<
class
T>
using
decay_t =
typename
decay<T>::type;
39
}
// namespace detail
40
41
template
<
class
Particle>
42
using
default_traits
=
traits<detail::decay_t<Particle>
>;
43
44
struct
Identity
{
45
template
<
class
Particle,
class
Traits = default_traits<Particle>>
46
decltype
(
auto
)
operator
()(
Particle
const
&p,
47
Traits particle_traits = {})
const
{
48
return
particle_traits.id(p);
49
}
50
};
51
52
struct
Force
{
53
template
<
class
Particle,
class
Traits = default_traits<Particle>>
54
decltype
(
auto
)
operator
()(
Particle
const
&p,
55
Traits particle_traits = {})
const
{
56
return
particle_traits.force(p);
57
}
58
};
59
60
struct
Position
{
61
template
<
class
Particle,
class
Traits = default_traits<Particle>>
62
decltype
(
auto
)
operator
()(
Particle
const
&p,
63
Traits particle_traits = {})
const
{
64
return
particle_traits.position(p);
65
}
66
};
67
68
struct
Velocity
{
69
template
<
class
Particle,
class
Traits = default_traits<Particle>>
70
decltype
(
auto
)
operator
()(
Particle
const
&p,
71
Traits particle_traits = {})
const
{
72
return
particle_traits.velocity(p);
73
}
74
};
75
76
struct
Director
{
77
template
<
class
Particle,
class
Traits = default_traits<Particle>>
78
decltype
(
auto
)
operator
()(
Particle
const
&p,
79
Traits particle_traits = {})
const
{
80
return
particle_traits.director(p);
81
}
82
};
83
84
struct
BodyVelocity
{
85
template
<
class
Particle,
class
Traits = default_traits<Particle>>
86
decltype
(
auto
)
operator
()(
Particle
const
&p,
87
Traits particle_traits = {})
const
{
88
return
particle_traits.velocity_body(p);
89
}
90
};
91
92
struct
AngularVelocity
{
93
template
<
class
Particle,
class
Traits = default_traits<Particle>>
94
decltype
(
auto
)
operator
()(
Particle
const
&p,
95
Traits particle_traits = {})
const
{
96
return
particle_traits.angular_velocity(p);
97
}
98
};
99
100
struct
BodyAngularVelocity
{
101
template
<
class
Particle,
class
Traits = default_traits<Particle>>
102
decltype
(
auto
)
operator
()(
Particle
const
&p,
103
Traits particle_traits = {})
const
{
104
return
particle_traits.angular_velocity_body(p);
105
}
106
};
107
108
struct
Mass
{
109
template
<
class
Particle,
class
Traits = default_traits<Particle>>
110
decltype
(
auto
)
operator
()(
Particle
const
&p,
111
Traits particle_traits = {})
const
{
112
return
particle_traits.mass(p);
113
}
114
};
115
116
struct
Charge
{
117
template
<
class
Particle,
class
Traits = default_traits<Particle>>
118
decltype
(
auto
)
operator
()(
Particle
const
&p,
119
Traits particle_traits = {})
const
{
120
return
particle_traits.charge(p);
121
}
122
};
123
124
struct
DipoleMoment
{
125
template
<
class
Particle,
class
Traits = default_traits<Particle>>
126
decltype
(
auto
)
operator
()(
Particle
const
&p,
127
Traits particle_traits = {})
const
{
128
return
particle_traits.dipole_moment(p);
129
}
130
};
131
132
struct
DipoleField
{
133
template
<
class
Particle,
class
Traits = default_traits<Particle>>
134
decltype
(
auto
)
operator
()(
Particle
const
&p,
135
Traits particle_traits = {})
const
{
136
return
particle_traits.dipole_field(p);
137
}
138
};
139
}
// namespace ParticleObservables
140
141
#endif
// OBSERVABLES_PROPERTIES_HPP
ParticleObservables
Definition
ParticleTraits.hpp:28
traits
Definition
traits.hpp:24
ParticleObservables::AngularVelocity
Definition
properties.hpp:92
ParticleObservables::BodyAngularVelocity
Definition
properties.hpp:100
ParticleObservables::BodyVelocity
Definition
properties.hpp:84
ParticleObservables::Charge
Definition
properties.hpp:116
ParticleObservables::DipoleField
Definition
properties.hpp:132
ParticleObservables::DipoleMoment
Definition
properties.hpp:124
ParticleObservables::Director
Definition
properties.hpp:76
ParticleObservables::Force
Definition
properties.hpp:52
ParticleObservables::Identity
Definition
properties.hpp:44
ParticleObservables::Mass
Definition
properties.hpp:108
ParticleObservables::Position
Definition
properties.hpp:60
ParticleObservables::Velocity
Definition
properties.hpp:68
ParticleObservables::traits
Definition
properties.hpp:27
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:395
src
particle_observables
include
particle_observables
properties.hpp
Generated on Fri Nov 22 2024 02:13:54 for ESPResSo by
1.9.8