Reference documentation for deal.II version 9.6.0
\(\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: 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// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_particles_particle_iterator_h
16#define dealii_particles_particle_iterator_h
17
18#include <deal.II/base/config.h>
19
21
23
24namespace Particles
25{
26 // Forward declaration
27#ifndef DOXYGEN
28 template <int, int>
29 class ParticleHandler;
30#endif
31
37 template <int dim, int spacedim = dim>
39 {
40 public:
46
50 ParticleIterator() = default;
51
58 const typename particle_container::iterator particles_in_cell,
59 const PropertyPool<dim, spacedim> &property_pool,
60 const unsigned int particle_index_within_cell);
61
67 operator*() const;
68
73 operator*();
74
82 operator->() const;
83
88 operator->();
89
93 bool
95
99 bool
101
108 operator++();
109
116 operator++(int);
117
124 operator--();
125
132 operator--(int);
133
138 state() const;
139
145 using iterator_category = std::bidirectional_iterator_tag;
147 using difference_type = std::ptrdiff_t;
150
151 private:
156 };
157
158
159
160 // ------------------------------ inline functions -------------------------
161
162 template <int dim, int spacedim>
164 const typename particle_container::iterator particles_in_cell,
165 const PropertyPool<dim, spacedim> &property_pool,
166 const unsigned int particle_index_within_cell)
167 : accessor(particles_in_cell, property_pool, particle_index_within_cell)
168 {}
169
170
171
172 template <int dim, int spacedim>
175 {
176 return accessor;
177 }
178
179
180
181 template <int dim, int spacedim>
184 {
185 return &(this->operator*());
186 }
187
188
189
190 template <int dim, int spacedim>
193 {
194 return accessor;
195 }
196
197
198
199 template <int dim, int spacedim>
202 {
203 return &(this->operator*());
204 }
205
206
207
208 template <int dim, int spacedim>
209 inline bool
211 const ParticleIterator<dim, spacedim> &other) const
212 {
213 return accessor != other.accessor;
214 }
215
216
217
218 template <int dim, int spacedim>
219 inline bool
221 const ParticleIterator<dim, spacedim> &other) const
222 {
223 return accessor == other.accessor;
224 }
225
226
227
228 template <int dim, int spacedim>
231 {
232 accessor.next();
233 return *this;
234 }
235
236
237
238 template <int dim, int spacedim>
241 {
242 ParticleIterator tmp(*this);
243 operator++();
244
245 return tmp;
246 }
247
248
249
250 template <int dim, int spacedim>
253 {
254 accessor.prev();
255 return *this;
256 }
257
258
259
260 template <int dim, int spacedim>
263 {
264 ParticleIterator tmp(*this);
265 operator--();
266
267 return tmp;
268 }
269
270
271
272 template <int dim, int spacedim>
275 {
276 return accessor.state();
277 }
278
279} // namespace Particles
280
282
283#endif
std::list< ParticlesInCell > particle_container
bool operator==(const ParticleIterator< dim, spacedim > &) const
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
typename ParticleAccessor< dim, spacedim >::particle_container particle_container
const ParticleAccessor< dim, spacedim > & operator*() const
IteratorState::IteratorStates state() const
std::enable_if_t< std::is_floating_point_v< T > &&std::is_floating_point_v< U >, typename ProductType< std::complex< T >, std::complex< U > >::type > operator*(const std::complex< T > &left, const std::complex< U > &right)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:503
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:504
SynchronousIterators< Iterators > operator++(SynchronousIterators< Iterators > &a)