IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
HaloCells.h
Go to the documentation of this file.
1//
2// Class HaloCells
3// The guard / ghost cells of BareField.
4//
5#ifndef IPPL_HALO_CELLS_H
6#define IPPL_HALO_CELLS_H
7
8#include <array>
9
10#include "Types/IpplTypes.h"
11#include "Types/ViewTypes.h"
12
13#include "Communicate/Archive.h"
15#include "Index/NDIndex.h"
16
17namespace ippl {
18 namespace detail {
22 template <typename T, class... ViewArgs>
24 using view_type = typename detail::ViewType<T, 1, ViewArgs...>::view_type;
26
27 void serialize(archive_type& ar, size_type nsends) { ar.serialize(buffer, nsends); }
28
29 void deserialize(archive_type& ar, size_type nrecvs) { ar.deserialize(buffer, nrecvs); }
30
32 };
33
38 template <typename T, unsigned Dim, class... ViewArgs>
39 class HaloCells {
40 public:
41 using view_type = typename detail::ViewType<T, Dim, ViewArgs...>::view_type;
44 using databuffer_type = FieldBufferData<T, ViewArgs...>;
45
51
53
60 void accumulateHalo(view_type& view, Layout_t* layout);
61
70 void accumulateHalo_noghost(view_type& view, Layout_t* layout, int nghost);
71
78 void fillHalo(view_type&, Layout_t* layout);
79
86 void pack(const bound_type& range, const view_type& view, databuffer_type& fd,
87 size_type& nsends);
88
96 template <typename Op>
97 void unpack(const bound_type& range, const view_type& view, databuffer_type& fd);
98
103 struct assign {
104 KOKKOS_INLINE_FUNCTION void operator()(T& lhs, const T& rhs) const { lhs = rhs; }
105 };
106
112 KOKKOS_INLINE_FUNCTION void operator()(T& lhs, const T& rhs) const { lhs += rhs; }
113 };
114
120 KOKKOS_INLINE_FUNCTION void operator()(const T& lhs, T& rhs) const { rhs += lhs; }
121 };
122
129 template <typename Op>
130 void applyPeriodicSerialDim(view_type& view, const Layout_t* layout, const int nghost);
131
132 private:
141 template <class Op>
142 void exchangeBoundaries(view_type& view, Layout_t* layout, SendOrder order, int nghost = 1);
143
150 auto makeSubview(const view_type& view, const bound_type& intersect);
151
153 };
154 } // namespace detail
155} // namespace ippl
156
157#include "Field/HaloCells.hpp"
158
159#endif
constexpr unsigned Dim
Definition Archive.h:20
std::size_t size_type
Definition IpplTypes.h:13
void serialize(const Kokkos::View< T *, ViewArgs... > &view, size_type nsends)
Definition Archive.hpp:20
void deserialize(Kokkos::View< T *, ViewArgs... > &view, size_type nrecvs)
Definition Archive.hpp:63
typename detail::ViewType< T, 1, ViewArgs... >::view_type view_type
Definition HaloCells.h:24
Archive< typename view_type::memory_space > archive_type
Definition HaloCells.h:25
void deserialize(archive_type &ar, size_type nrecvs)
Definition HaloCells.h:29
void serialize(archive_type &ar, size_type nsends)
Definition HaloCells.h:27
auto makeSubview(const view_type &view, const bound_type &intersect)
void accumulateHalo_noghost(view_type &view, Layout_t *layout, int nghost)
Definition HaloCells.hpp:24
typename detail::ViewType< T, Dim, ViewArgs... >::view_type view_type
Definition HaloCells.h:41
void applyPeriodicSerialDim(view_type &view, const Layout_t *layout, const int nghost)
void pack(const bound_type &range, const view_type &view, databuffer_type &fd, size_type &nsends)
void exchangeBoundaries(view_type &view, Layout_t *layout, SendOrder order, int nghost=1)
Definition HaloCells.hpp:34
FieldBufferData< T, ViewArgs... > databuffer_type
Definition HaloCells.h:44
void unpack(const bound_type &range, const view_type &view, databuffer_type &fd)
typename Layout_t::bound_type bound_type
Definition HaloCells.h:43
void accumulateHalo(view_type &view, Layout_t *layout)
Definition HaloCells.hpp:19
void fillHalo(view_type &, Layout_t *layout)
Definition HaloCells.hpp:28
KOKKOS_INLINE_FUNCTION void operator()(T &lhs, const T &rhs) const
Definition HaloCells.h:104
KOKKOS_INLINE_FUNCTION void operator()(T &lhs, const T &rhs) const
Definition HaloCells.h:112
KOKKOS_INLINE_FUNCTION void operator()(const T &lhs, T &rhs) const
Definition HaloCells.h:120