ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
PartCfg.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
#include "
BoxGeometry.hpp
"
23
#include "
Particle.hpp
"
24
25
#include <vector>
26
27
/**
28
* @brief Particle cache on the head node.
29
*
30
* This class implements cached access to all particles in a
31
* particle range on the head node.
32
* This implementation fetches all particles to the head node on creation.
33
*/
34
class
PartCfg
{
35
/** The particle data */
36
std::vector<Particle> m_parts;
37
BoxGeometry
const
&m_box_geo;
38
39
public
:
40
using
value_type
=
Particle
;
41
explicit
PartCfg
(
BoxGeometry
const
&box_geo) : m_parts{}, m_box_geo{box_geo} {
42
update();
43
}
44
45
/** @brief Iterator pointing to the particle with the lowest id. */
46
auto
begin
() {
return
m_parts.begin(); }
47
48
/** @brief Iterator pointing past the particle with the highest id. */
49
auto
end
() {
return
m_parts.end(); }
50
51
/** @brief Number of particles in the config. */
52
auto
size
() {
return
m_parts.size(); }
53
54
/** @brief Is the config empty? */
55
auto
empty
() {
return
m_parts.empty(); }
56
57
private
:
58
/**
59
* @brief Update particle information.
60
*
61
* This triggers a global update. All nodes
62
* sort their particle by id, and send them
63
* to the head node.
64
*/
65
void
update();
66
};
BoxGeometry.hpp
Particle.hpp
BoxGeometry
Definition
BoxGeometry.hpp:98
PartCfg
Particle cache on the head node.
Definition
PartCfg.hpp:34
PartCfg::begin
auto begin()
Iterator pointing to the particle with the lowest id.
Definition
PartCfg.hpp:46
PartCfg::PartCfg
PartCfg(BoxGeometry const &box_geo)
Definition
PartCfg.hpp:41
PartCfg::size
auto size()
Number of particles in the config.
Definition
PartCfg.hpp:52
PartCfg::empty
auto empty()
Is the config empty?
Definition
PartCfg.hpp:55
PartCfg::end
auto end()
Iterator pointing past the particle with the highest id.
Definition
PartCfg.hpp:49
Particle
Struct holding all information for one particle.
Definition
Particle.hpp:395
src
core
PartCfg.hpp
Generated on Fri Nov 22 2024 02:13:54 for ESPResSo by
1.9.8