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 */
26namespace ParticleObservables {
27template <class DoF> struct traits;
28
29namespace detail {
30template <class T> struct decay {
31 using type = typename std::decay_t<T>;
32};
33
34template <class U> struct decay<std::reference_wrapper<U>> {
35 using type = std::decay_t<U>;
36};
37
38template <class T> using decay_t = typename decay<T>::type;
39} // namespace detail
40
41template <class Particle>
43
44struct 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
52struct 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
60struct 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
68struct 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
76struct 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
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
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
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
108struct 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
116struct 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
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
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
Struct holding all information for one particle.
Definition Particle.hpp:395