IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
ParticleLayout.hpp
Go to the documentation of this file.
1
//
2
// Class ParticleLayout
3
// Base class for all particle layout classes.
4
//
5
// This class is used as the generic base class for all classes
6
// which maintain the information on where all the particles are located
7
// on a parallel machine. It is responsible for performing particle
8
// load balancing.
9
//
10
// If more general layout information is needed, such as the global -> local
11
// mapping for each particle, then derived classes must provide this info.
12
//
13
// When particles are created or destroyed, this class is also responsible
14
// for determining where particles are to be created, gathering this
15
// information, and recalculating the global indices of all the particles.
16
// For consistency, creation and destruction requests are cached, and then
17
// performed all in one step when the update routine is called.
18
//
19
// Derived classes must provide the following:
20
// 1) Specific version of update and loadBalance. These are not virtual,
21
// as this class is used as a template parameter (instead of being
22
// assigned to a base class pointer).
23
// 2) Internal storage to maintain their specific layout mechanism
24
// 3) the definition of a class pair_iterator, and a function
25
// void getPairlist(int, pair_iterator&, pair_iterator&) to get a
26
// begin/end iterator pair to access the local neighbor of the Nth
27
// local atom. This is not a virtual function, it is a requirement of
28
// the templated class for use in other parts of the code.
29
//
30
31
namespace
ippl
{
32
namespace
detail
{
33
template
<
typename
T
,
unsigned
Dim
,
typename
... Properties>
34
void
ParticleLayout<T, Dim, Properties...>::applyBC
(
const
particle_position_type
& R,
35
const
NDRegion<T, Dim>
& nr) {
36
/* loop over all faces
37
* 0: lower x-face
38
* 1: upper x-face
39
* 2: lower y-face
40
* 3: upper y-face
41
* etc...
42
*/
43
Kokkos::RangePolicy<typename particle_position_type::execution_space> policy{
44
0, (unsigned)R.getParticleCount()};
45
for
(
unsigned
face = 0; face < 2 *
Dim
; ++face) {
46
// unsigned face = i % Dim;
47
unsigned
d = face / 2;
48
bool
isUpper
= face & 1;
49
switch
(
bcs_m
[face]) {
50
case
BC::PERIODIC
:
51
// Periodic faces come in pairs and the application of
52
// BCs checks both sides, so there is no reason to
53
// apply periodic conditions twice
54
if
(
isUpper
) {
55
break
;
56
}
57
58
Kokkos::parallel_for(
"Periodic BC"
, policy,
59
PeriodicBC
(R.
getView
(), nr, d,
isUpper
));
60
break
;
61
case
BC::REFLECTIVE
:
62
Kokkos::parallel_for(
"Reflective BC"
, policy,
63
ReflectiveBC
(R.
getView
(), nr, d,
isUpper
));
64
break
;
65
case
BC::SINK
:
66
Kokkos::parallel_for(
"Sink BC"
, policy,
67
SinkBC
(R.
getView
(), nr, d,
isUpper
));
68
break
;
69
case
BC::NO
:
70
default
:
71
break
;
72
}
73
}
74
}
75
}
// namespace detail
76
}
// namespace ippl
T
double T
Definition
BumponTailInstability.cpp:23
Dim
constexpr unsigned Dim
Definition
BumponTailInstability.cpp:22
ippl
Definition
Archive.h:20
ippl::REFLECTIVE
@ REFLECTIVE
Definition
ParticleBC.h:13
ippl::NO
@ NO
Definition
ParticleBC.h:15
ippl::SINK
@ SINK
Definition
ParticleBC.h:14
ippl::PERIODIC
@ PERIODIC
Definition
ParticleBC.h:12
ippl::detail
Definition
Archive.h:21
ippl::detail::isUpper
bool isUpper(unsigned int face)
Definition
FieldLayout.cpp:5
ippl::ParticleAttrib::getView
view_type & getView()
Definition
ParticleAttrib.h:97
ippl::detail::PeriodicBC
Definition
ParticleBC.h:60
ippl::detail::ReflectiveBC
Definition
ParticleBC.h:83
ippl::detail::SinkBC
Definition
ParticleBC.h:111
ippl::detail::ParticleLayout::applyBC
void applyBC(const particle_position_type &R, const NDRegion< T, Dim > &nr)
Definition
ParticleLayout.hpp:34
ippl::detail::ParticleLayout::particle_position_type
ParticleAttrib< vector_type, PositionProperties... > particle_position_type
Definition
ParticleLayout.h:50
ippl::detail::ParticleLayout::bcs_m
bc_container_type bcs_m
the list of boundary conditions for this set of particles
Definition
ParticleLayout.h:97
ippl::NDRegion
Definition
NDRegion.h:20