Reference documentation for deal.II version 9.3.2
\(\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\}}\)
particle_iterator.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 - 2020 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 
25 namespace 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:
45  ParticleIterator() = default;
46 
52  const std::multimap<internal::LevelInd, Particle<dim, spacedim>> &map,
53  const typename std::multimap<internal::LevelInd,
54  Particle<dim, spacedim>>::iterator
55  &particle);
56 
62 
67 
75 
80 
84  bool
86 
90  bool
92 
99  operator++();
100 
107  operator++(int);
108 
115  operator--();
116 
123  operator--(int);
124 
130  using iterator_category = std::bidirectional_iterator_tag;
132  using difference_type = std::ptrdiff_t;
135 
136  private:
141  };
142 
143 
144 
145  // ------------------------------ inline functions -------------------------
146 
147  template <int dim, int spacedim>
149  const std::multimap<internal::LevelInd, Particle<dim, spacedim>> &map,
150  const typename std::multimap<internal::LevelInd,
151  Particle<dim, spacedim>>::iterator & particle)
152  : accessor(map, particle)
153  {}
154 
155 
156 
157  template <int dim, int spacedim>
159  operator*()
160  {
161  return accessor;
162  }
163 
164 
165 
166  template <int dim, int spacedim>
168  operator->()
169  {
170  return &(this->operator*());
171  }
172 
173 
174 
175  template <int dim, int spacedim>
176  inline const ParticleAccessor<dim, spacedim> &
178  {
179  return accessor;
180  }
181 
182 
183 
184  template <int dim, int spacedim>
185  inline const ParticleAccessor<dim, spacedim> *
187  {
188  return &(this->operator*());
189  }
190 
191 
192 
193  template <int dim, int spacedim>
194  inline bool
197  {
198  return accessor != other.accessor;
199  }
200 
201 
202 
203  template <int dim, int spacedim>
204  inline bool
207  {
208  return accessor == other.accessor;
209  }
210 
211 
212 
213  template <int dim, int spacedim>
216  {
217  accessor.next();
218  return *this;
219  }
220 
221 
222 
223  template <int dim, int spacedim>
226  {
227  ParticleIterator tmp(*this);
228  operator++();
229 
230  return tmp;
231  }
232 
233 
234 
235  template <int dim, int spacedim>
238  {
239  accessor.prev();
240  return *this;
241  }
242 
243 
244 
245  template <int dim, int spacedim>
248  {
249  ParticleIterator tmp(*this);
250  operator--();
251 
252  return tmp;
253  }
254 
255 
256 } // namespace Particles
257 
259 
260 #endif
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
const ParticleAccessor< dim, spacedim > & operator*() const
std::enable_if< std::is_floating_point< T >::value &&std::is_floating_point< U >::value, typename ProductType< std::complex< T >, std::complex< U > >::type >::type operator*(const std::complex< T > &left, const std::complex< U > &right)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:396
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:397
std::pair< int, int > LevelInd
Definition: particle.h:42
SynchronousIterators< Iterators > operator++(SynchronousIterators< Iterators > &a)