deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
particle_iterator.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2017 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_particles_particle_iterator_h
14#define dealii_particles_particle_iterator_h
15
16#include <deal.II/base/config.h>
17
19
21
22namespace Particles
23{
24 // Forward declaration
25#ifndef DOXYGEN
26 template <int, int>
27 class ParticleHandler;
28#endif
29
35 template <int dim, int spacedim = dim>
37 {
38 public:
44
48 ParticleIterator() = default;
49
56 const typename particle_container::iterator particles_in_cell,
57 const PropertyPool<dim, spacedim> &property_pool,
58 const unsigned int particle_index_within_cell);
59
65 operator*() const;
66
71 operator*();
72
80 operator->() const;
81
86 operator->();
87
91 bool
93
97 bool
99
106 operator++();
107
114 operator++(int);
115
122 operator--();
123
130 operator--(int);
131
136 state() const;
137
143 using iterator_category = std::bidirectional_iterator_tag;
145 using difference_type = std::ptrdiff_t;
148
149 private:
154 };
155
156
157
158 // ------------------------------ inline functions -------------------------
159
160 template <int dim, int spacedim>
162 const typename particle_container::iterator particles_in_cell,
163 const PropertyPool<dim, spacedim> &property_pool,
164 const unsigned int particle_index_within_cell)
165 : accessor(particles_in_cell, property_pool, particle_index_within_cell)
166 {}
167
168
169
170 template <int dim, int spacedim>
173 {
174 return accessor;
175 }
176
177
178
179 template <int dim, int spacedim>
182 {
183 return &(this->operator*());
184 }
185
186
187
188 template <int dim, int spacedim>
191 {
192 return accessor;
193 }
194
195
196
197 template <int dim, int spacedim>
200 {
201 return &(this->operator*());
202 }
203
204
205
206 template <int dim, int spacedim>
207 inline bool
209 const ParticleIterator<dim, spacedim> &other) const
210 {
211 return accessor != other.accessor;
212 }
213
214
215
216 template <int dim, int spacedim>
217 inline bool
219 const ParticleIterator<dim, spacedim> &other) const
220 {
221 return accessor == other.accessor;
222 }
223
224
225
226 template <int dim, int spacedim>
229 {
230 accessor.next();
231 return *this;
232 }
233
234
235
236 template <int dim, int spacedim>
239 {
240 ParticleIterator tmp(*this);
241 operator++();
242
243 return tmp;
244 }
245
246
247
248 template <int dim, int spacedim>
251 {
252 accessor.prev();
253 return *this;
254 }
255
256
257
258 template <int dim, int spacedim>
261 {
262 ParticleIterator tmp(*this);
263 operator--();
264
265 return tmp;
266 }
267
268
269
270 template <int dim, int spacedim>
273 {
274 return accessor.state();
275 }
276
277} // namespace Particles
278
280
281#endif
*  *  reference operator*() const
*  *  iterator & operator++()
std::list< ParticlesInCell > particle_container
bool operator==(const ParticleIterator< dim, spacedim > &) const
typename ParticleAccessor< dim, spacedim >::particle_container particle_container
const ParticleAccessor< dim, spacedim > * operator->() const
ParticleIterator & operator++()
std::bidirectional_iterator_tag iterator_category
bool operator!=(const ParticleIterator< dim, spacedim > &) const
ParticleIterator & operator--()
ParticleAccessor< dim, spacedim > accessor
const ParticleAccessor< dim, spacedim > & operator*() const
IteratorState::IteratorStates state() const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
SynchronousIterators< Iterators > & operator--(SynchronousIterators< Iterators > &a)