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\}}\)
source
particles
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
16
#include <
deal.II/particles/particle_accessor.h
>
17
18
DEAL_II_NAMESPACE_OPEN
19
20
namespace
Particles
21
{
22
template
<
int
dim,
int
spacedim>
23
ParticleAccessor<dim, spacedim>::ParticleAccessor
()
24
: map(nullptr)
25
, particle()
26
{}
27
28
29
30
template
<
int
dim,
int
spacedim>
31
ParticleAccessor<dim, spacedim>::ParticleAccessor
(
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
44
ParticleAccessor<dim, spacedim>::write_data
(
void
*&data)
const
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
55
ParticleAccessor<dim, spacedim>::set_location
(
const
Point<spacedim>
&new_loc)
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>
&
66
ParticleAccessor<dim, spacedim>::get_location
()
const
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
77
ParticleAccessor<dim, spacedim>::set_reference_location
(
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>
&
89
ParticleAccessor<dim, spacedim>::get_reference_location
()
const
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>
99
types::particle_index
100
ParticleAccessor<dim, spacedim>::get_id
()
const
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
111
ParticleAccessor<dim, spacedim>::set_property_pool
(
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
123
ParticleAccessor<dim, spacedim>::has_properties
()
const
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
134
ParticleAccessor<dim, spacedim>::set_properties
(
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>
146
const
ArrayView<const double>
147
ParticleAccessor<dim, spacedim>::get_properties
()
const
148
{
149
Assert
(particle != map->end(),
ExcInternalError
());
150
151
return
particle->second.get_properties();
152
}
153
154
155
156
template
<
int
dim,
int
spacedim>
157
typename
Triangulation<dim, spacedim>::cell_iterator
158
ParticleAccessor<dim, spacedim>::get_surrounding_cell
(
159
const
Triangulation<dim, spacedim>
&
triangulation
)
const
160
{
161
Assert
(particle != map->end(),
ExcInternalError
());
162
163
const
typename
Triangulation<dim, spacedim>::cell_iterator
cell(
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>
172
ParticleAccessor<dim, spacedim>::get_properties
()
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
183
ParticleAccessor<dim, spacedim>::serialized_size_in_bytes
()
const
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
194
ParticleAccessor<dim, spacedim>::next
()
195
{
196
Assert
(particle != map->end(),
ExcInternalError
());
197
++particle;
198
}
199
200
201
202
template
<
int
dim,
int
spacedim>
203
void
204
ParticleAccessor<dim, spacedim>::prev
()
205
{
206
Assert
(particle != map->begin(),
ExcInternalError
());
207
--particle;
208
}
209
210
211
212
template
<
int
dim,
int
spacedim>
213
bool
214
ParticleAccessor<dim, spacedim>::
215
operator!=
(
const
ParticleAccessor<dim, spacedim>
&other)
const
216
{
217
return
(map != other.
map
) || (particle != other.
particle
);
218
}
219
220
221
222
template
<
int
dim,
int
spacedim>
223
bool
224
ParticleAccessor<dim, spacedim>::
225
operator==
(
const
ParticleAccessor<dim, spacedim>
&other)
const
226
{
227
return
(map == other.
map
) && (particle == other.
particle
);
228
}
229
}
// namespace Particles
230
231
DEAL_II_NAMESPACE_CLOSE
232
233
DEAL_II_NAMESPACE_OPEN
234
235
#include "particle_accessor.inst"
236
237
DEAL_II_NAMESPACE_CLOSE
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
Generated by
1.8.17