Reference documentation for deal.II version 9.5.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// Copyright (C) 2017 - 2021 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_particles_particle_iterator_h
17#define dealii_particles_particle_iterator_h
18
19#include <deal.II/base/config.h>
20
22
24
25namespace Particles
26{
27 // Forward declaration
28#ifndef DOXYGEN
29 template <int, int>
30 class ParticleHandler;
31#endif
32
38 template <int dim, int spacedim = dim>
40 {
41 public:
47
51 ParticleIterator() = default;
52
59 const typename particle_container::iterator particles_in_cell,
60 const PropertyPool<dim, spacedim> & property_pool,
61 const unsigned int particle_index_within_cell);
62
68 operator*() const;
69
74 operator*();
75
83 operator->() const;
84
89 operator->();
90
94 bool
96
100 bool
102
109 operator++();
110
117 operator++(int);
118
125 operator--();
126
133 operator--(int);
134
139 state() const;
140
146 using iterator_category = std::bidirectional_iterator_tag;
148 using difference_type = std::ptrdiff_t;
151
152 private:
157 };
158
159
160
161 // ------------------------------ inline functions -------------------------
162
163 template <int dim, int spacedim>
165 const typename particle_container::iterator particles_in_cell,
166 const PropertyPool<dim, spacedim> & property_pool,
167 const unsigned int particle_index_within_cell)
168 : accessor(particles_in_cell, property_pool, particle_index_within_cell)
169 {}
170
171
172
173 template <int dim, int spacedim>
176 {
177 return accessor;
178 }
179
180
181
182 template <int dim, int spacedim>
185 {
186 return &(this->operator*());
187 }
188
189
190
191 template <int dim, int spacedim>
194 {
195 return accessor;
196 }
197
198
199
200 template <int dim, int spacedim>
203 {
204 return &(this->operator*());
205 }
206
207
208
209 template <int dim, int spacedim>
210 inline bool
212 const ParticleIterator<dim, spacedim> &other) const
213 {
214 return accessor != other.accessor;
215 }
216
217
218
219 template <int dim, int spacedim>
220 inline bool
222 const ParticleIterator<dim, spacedim> &other) const
223 {
224 return accessor == other.accessor;
225 }
226
227
228
229 template <int dim, int spacedim>
232 {
233 accessor.next();
234 return *this;
235 }
236
237
238
239 template <int dim, int spacedim>
242 {
243 ParticleIterator tmp(*this);
244 operator++();
245
246 return tmp;
247 }
248
249
250
251 template <int dim, int spacedim>
254 {
255 accessor.prev();
256 return *this;
257 }
258
259
260
261 template <int dim, int spacedim>
264 {
265 ParticleIterator tmp(*this);
266 operator--();
267
268 return tmp;
269 }
270
271
272
273 template <int dim, int spacedim>
276 {
277 return accessor.state();
278 }
279
280} // namespace Particles
281
283
284#endif
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
std::enable_if_t< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, 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:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
SynchronousIterators< Iterators > operator++(SynchronousIterators< Iterators > &a)