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
20
#pragma once
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 = 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
}
// namespace detail
38
39
template
<
class
Particle>
40
using
default_traits
=
traits<typename detail::decay<Particle>::type
>;
41
42
struct
Identity
{
43
template
<
class
Particle,
class
Traits = default_traits<Particle>>
44
decltype
(
auto
)
operator
()(
Particle
const
&p,
45
Traits particle_traits = {})
const
{
46
return
particle_traits.id(p);
47
}
48
};
49
50
struct
Force
{
51
template
<
class
Particle,
class
Traits = default_traits<Particle>>
52
decltype
(
auto
)
operator
()(
Particle
const
&p,
53
Traits particle_traits = {})
const
{
54
return
particle_traits.force(p);
55
}
56
};
57
58
struct
Position
{
59
template
<
class
Particle,
class
Traits = default_traits<Particle>>
60
decltype
(
auto
)
operator
()(
Particle
const
&p,
61
Traits particle_traits = {})
const
{
62
return
particle_traits.position(p);
63
}
64
};
65
66
struct
Velocity
{
67
template
<
class
Particle,
class
Traits = default_traits<Particle>>
68
decltype
(
auto
)
operator
()(
Particle
const
&p,
69
Traits particle_traits = {})
const
{
70
return
particle_traits.velocity(p);
71
}
72
};
73
74
struct
Director
{
75
template
<
class
Particle,
class
Traits = default_traits<Particle>>
76
decltype
(
auto
)
operator
()(
Particle
const
&p,
77
Traits particle_traits = {})
const
{
78
return
particle_traits.director(p);
79
}
80
};
81
82
struct
BodyVelocity
{
83
template
<
class
Particle,
class
Traits = default_traits<Particle>>
84
decltype
(
auto
)
operator
()(
Particle
const
&p,
85
Traits particle_traits = {})
const
{
86
return
particle_traits.velocity_body(p);
87
}
88
};
89
90
struct
AngularVelocity
{
91
template
<
class
Particle,
class
Traits = default_traits<Particle>>
92
decltype
(
auto
)
operator
()(
Particle
const
&p,
93
Traits particle_traits = {})
const
{
94
return
particle_traits.angular_velocity(p);
95
}
96
};
97
98
struct
BodyAngularVelocity
{
99
template
<
class
Particle,
class
Traits = default_traits<Particle>>
100
decltype
(
auto
)
operator
()(
Particle
const
&p,
101
Traits particle_traits = {})
const
{
102
return
particle_traits.angular_velocity_body(p);
103
}
104
};
105
106
struct
Mass
{
107
template
<
class
Particle,
class
Traits = default_traits<Particle>>
108
decltype
(
auto
)
operator
()(
Particle
const
&p,
109
Traits particle_traits = {})
const
{
110
return
particle_traits.mass(p);
111
}
112
};
113
114
struct
Charge
{
115
template
<
class
Particle,
class
Traits = default_traits<Particle>>
116
decltype
(
auto
)
operator
()(
Particle
const
&p,
117
Traits particle_traits = {})
const
{
118
return
particle_traits.charge(p);
119
}
120
};
121
122
struct
DipoleMoment
{
123
template
<
class
Particle,
class
Traits = default_traits<Particle>>
124
decltype
(
auto
)
operator
()(
Particle
const
&p,
125
Traits particle_traits = {})
const
{
126
return
particle_traits.dipole_moment(p);
127
}
128
};
129
130
struct
DipoleField
{
131
template
<
class
Particle,
class
Traits = default_traits<Particle>>
132
decltype
(
auto
)
operator
()(
Particle
const
&p,
133
Traits particle_traits = {})
const
{
134
return
particle_traits.dipole_field(p);
135
}
136
};
137
}
// namespace ParticleObservables
ParticleObservables
Definition
ParticleTraits.hpp:28
std
STL namespace.
traits
Definition
traits.hpp:24
ParticleObservables::AngularVelocity
Definition
properties.hpp:90
ParticleObservables::BodyAngularVelocity
Definition
properties.hpp:98
ParticleObservables::BodyVelocity
Definition
properties.hpp:82
ParticleObservables::Charge
Definition
properties.hpp:114
ParticleObservables::DipoleField
Definition
properties.hpp:130
ParticleObservables::DipoleMoment
Definition
properties.hpp:122
ParticleObservables::Director
Definition
properties.hpp:74
ParticleObservables::Force
Definition
properties.hpp:50
ParticleObservables::Identity
Definition
properties.hpp:42
ParticleObservables::Mass
Definition
properties.hpp:106
ParticleObservables::Position
Definition
properties.hpp:58
ParticleObservables::Velocity
Definition
properties.hpp:66
ParticleObservables::traits
Definition
properties.hpp:27
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:450
src
particle_observables
include
particle_observables
properties.hpp
Generated on Sun Dec 7 2025 02:31:13 for ESPResSo by
1.9.8