Reference documentation for deal.II version 9.2.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\}}\)
particle_accessor.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2017 - 2018 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 
17 
19 
20 namespace Particles
21 {
22  template <int dim, int spacedim>
24  : map(nullptr)
25  , particle()
26  {}
27 
28 
29 
30  template <int dim, int spacedim>
32  const std::multimap<internal::LevelInd, Particle<dim, spacedim>> &map,
33  const typename std::multimap<internal::LevelInd,
34  Particle<dim, spacedim>>::iterator & particle)
35  : map(const_cast<
36  std::multimap<internal::LevelInd, Particle<dim, spacedim>> *>(&map))
37  , particle(particle)
38  {}
39 
40 
41 
42  template <int dim, int spacedim>
43  void
45  {
46  Assert(particle != map->end(), ExcInternalError());
47 
48  particle->second.write_data(data);
49  }
50 
51 
52 
53  template <int dim, int spacedim>
54  void
56  {
57  Assert(particle != map->end(), ExcInternalError());
58 
59  particle->second.set_location(new_loc);
60  }
61 
62 
63 
64  template <int dim, int spacedim>
65  const Point<spacedim> &
67  {
68  Assert(particle != map->end(), ExcInternalError());
69 
70  return particle->second.get_location();
71  }
72 
73 
74 
75  template <int dim, int spacedim>
76  void
78  const Point<dim> &new_loc)
79  {
80  Assert(particle != map->end(), ExcInternalError());
81 
82  particle->second.set_reference_location(new_loc);
83  }
84 
85 
86 
87  template <int dim, int spacedim>
88  const Point<dim> &
90  {
91  Assert(particle != map->end(), ExcInternalError());
92 
93  return particle->second.get_reference_location();
94  }
95 
96 
97 
98  template <int dim, int spacedim>
101  {
102  Assert(particle != map->end(), ExcInternalError());
103 
104  return particle->second.get_id();
105  }
106 
107 
108 
109  template <int dim, int spacedim>
110  void
112  PropertyPool &new_property_pool)
113  {
114  Assert(particle != map->end(), ExcInternalError());
115 
116  particle->second.set_property_pool(new_property_pool);
117  }
118 
119 
120 
121  template <int dim, int spacedim>
122  bool
124  {
125  Assert(particle != map->end(), ExcInternalError());
126 
127  return particle->second.has_properties();
128  }
129 
130 
131 
132  template <int dim, int spacedim>
133  void
135  const std::vector<double> &new_properties)
136  {
137  Assert(particle != map->end(), ExcInternalError());
138 
139  particle->second.set_properties(new_properties);
140  return;
141  }
142 
143 
144 
145  template <int dim, int spacedim>
148  {
149  Assert(particle != map->end(), ExcInternalError());
150 
151  return particle->second.get_properties();
152  }
153 
154 
155 
156  template <int dim, int spacedim>
160  {
161  Assert(particle != map->end(), ExcInternalError());
162 
164  &triangulation, particle->first.first, particle->first.second);
165  return cell;
166  }
167 
168 
169 
170  template <int dim, int spacedim>
171  const ArrayView<double>
173  {
174  Assert(particle != map->end(), ExcInternalError());
175 
176  return particle->second.get_properties();
177  }
178 
179 
180 
181  template <int dim, int spacedim>
182  std::size_t
184  {
185  Assert(particle != map->end(), ExcInternalError());
186 
187  return particle->second.serialized_size_in_bytes();
188  }
189 
190 
191 
192  template <int dim, int spacedim>
193  void
195  {
196  Assert(particle != map->end(), ExcInternalError());
197  ++particle;
198  }
199 
200 
201 
202  template <int dim, int spacedim>
203  void
205  {
206  Assert(particle != map->begin(), ExcInternalError());
207  --particle;
208  }
209 
210 
211 
212  template <int dim, int spacedim>
213  bool
216  {
217  return (map != other.map) || (particle != other.particle);
218  }
219 
220 
221 
222  template <int dim, int spacedim>
223  bool
226  {
227  return (map == other.map) && (particle == other.particle);
228  }
229 } // namespace Particles
230 
232 
234 
235 #include "particle_accessor.inst"
236 
operator!=
bool operator!=(const AlignedVector< T > &lhs, const AlignedVector< T > &rhs)
Definition: aligned_vector.h:1192
Particles::ParticleAccessor
Definition: particle_accessor.h:43
operator==
bool operator==(const AlignedVector< T > &lhs, const AlignedVector< T > &rhs)
Definition: aligned_vector.h:1170
Triangulation
Definition: tria.h:1109
DataOutBase::write_data
void write_data(const std::vector< Patch< dim, spacedim >> &patches, unsigned int n_data_sets, const bool double_precision, StreamType &out)
Definition: data_out_base.cc:2485
ArrayView
Definition: array_view.h:77
Particles::PropertyPool
Definition: property_pool.h:43
Particles
Definition: data_out.h:27
Particles::Particle
Definition: particle.h:146
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Particles::ParticleAccessor::ParticleAccessor
ParticleAccessor()
Definition: particle_accessor.cc:23
particle_accessor.h
unsigned int
StandardExceptions::ExcInternalError
static ::ExceptionBase & ExcInternalError()
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
Particles::internal::LevelInd
std::pair< int, int > LevelInd
Definition: particle.h:92
Particles::ParticleAccessor::map
std::multimap< internal::LevelInd, Particle< dim, spacedim > > * map
Definition: particle_accessor.h:213
Point< spacedim >
triangulation
const typename ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
Definition: p4est_wrappers.cc:69
internal
Definition: aligned_vector.h:369
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Particles::ParticleAccessor::particle
std::multimap< internal::LevelInd, Particle< dim, spacedim > >::iterator particle
Definition: particle_accessor.h:220
TriaIterator
Definition: tria_iterator.h:578