IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
RegionLayout.h
1//
2// Class RegionLayout
3// RegionLayout stores a partitioned set of NDRegion objects, to represent
4// the parallel layout of an encompassing NDRegion. It also contains
5// functions to find the subsets of the NDRegion partitions which intersect
6// or touch a given NDRegion. It is similar to FieldLayout, with the
7// following changes:
8// 1. It uses NDRegion instead of NDIndex, so it is templated on the position
9// data type (although it can be constructed with an NDIndex and a Mesh
10// as well);
11// 2. It does not contain any consideration for guard cells;
12// 3. It can store not only the partitioned domain, but periodic copies of
13// the partitioned domain for use by particle periodic boundary conditions
14// 4. It also keeps a list of FieldLayoutUser's, so that it can notify them
15// when the internal FieldLayout here is reparitioned or otherwise changed.
16//
17// If this is constructed with a FieldLayout, it stores a pointer to it
18// so that if we must repartition the copy of the FieldLayout that
19// is stored here, we will end up repartitioning all the registered Fields.
20//
21#ifndef IPPL_REGION_LAYOUT_H
22#define IPPL_REGION_LAYOUT_H
23
24#include <array>
25
26#include "Types/ViewTypes.h"
27
28#include "Utility/TypeUtils.h"
29
30#include "Region/NDRegion.h"
31
32namespace ippl {
33 namespace detail {
34
35 template <typename T, unsigned Dim, class Mesh, class... Properties>
37 template <typename... Props>
38 using base_type = RegionLayout<T, Dim, Mesh, Props...>;
39
40 public:
42 using view_type = typename ViewType<NDRegion_t, 1, Properties...>::view_type;
43 using host_mirror_type = typename view_type::host_mirror_type;
44
45 using uniform_type = typename CreateUniformType<base_type, view_type>::type;
46
47 // Default constructor. To make this class actually work, the user
48 // will have to later call 'changeDomain' to set the proper Domain
49 // and get a new partitioning.
51
52 // Constructor which takes a FieldLayout and a MeshType
53 // This one compares the domain of the FieldLayout and the domain of
54 // the MeshType to determine the centering of the index space.
55 RegionLayout(const FieldLayout<Dim>&, const Mesh&, bool node = false);
56
57 ~RegionLayout() = default;
58
59 const NDRegion_t& getDomain() const { return region_m; }
60
61 const view_type getdLocalRegions() const;
62
63 const host_mirror_type gethLocalRegions() const;
64
65 void write(std::ostream& = std::cout) const;
66
67 void changeDomain(const FieldLayout<Dim>&, const Mesh& mesh); // previously private...
68
69 private:
70 NDRegion_t convertNDIndex(const NDIndex<Dim>&, const Mesh& mesh) const;
71 void fillRegions(const FieldLayout<Dim>&, const Mesh& mesh);
72
74 std::array<int, Dim> indexOffset_m;
75
77 std::array<bool, Dim> centerOffset_m;
78
79 NDRegion_t region_m;
80
82 view_type dLocalRegions_m;
83
85 host_mirror_type hLocalRegions_m;
86
87 view_type subdomains_m;
88
89 bool node_m;
90 };
91
92 template <typename T, unsigned Dim, class Mesh>
93 std::ostream& operator<<(std::ostream&, const RegionLayout<T, Dim, Mesh>&);
94
95 } // namespace detail
96} // namespace ippl
97
98#include "Region/RegionLayout.hpp"
99
100#endif
Definition FieldLayout.h:166
Definition Mesh.h:15
Definition NDIndex.h:21
Definition NDRegion.h:20
Definition RegionLayout.h:36
Definition Archive.h:20
Definition ViewTypes.h:44