IPPL (Independent Parallel Particle Layer)
IPPL
Loading...
Searching...
No Matches
RegionLayout.h
Go to the documentation of this file.
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
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.
56
57 ~RegionLayout() = default;
58
59 const NDRegion_t& getDomain() const { return region_m; }
60
62
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
80
83
86
88 };
89
90 template <typename T, unsigned Dim, class Mesh>
91 std::ostream& operator<<(std::ostream&, const RegionLayout<T, Dim, Mesh>&);
92
93 } // namespace detail
94} // namespace ippl
95
97
98#endif
constexpr unsigned Dim
Definition Archive.h:20
std::ostream & operator<<(std::ostream &, const BCondBase< Field > &)
Definition BcTypes.hpp:28
RegionLayout(const FieldLayout< Dim > &, const Mesh &)
NDRegion_t convertNDIndex(const NDIndex< Dim > &, const Mesh &mesh) const
const view_type getdLocalRegions() const
typename CreateUniformType< base_type, view_type >::type uniform_type
void fillRegions(const FieldLayout< Dim > &, const Mesh &mesh)
const NDRegion_t & getDomain() const
RegionLayout< T, Dim, Mesh, Props... > base_type
void write(std::ostream &=std::cout) const
typename ViewType< NDRegion_t, 1, Properties... >::view_type view_type
const host_mirror_type gethLocalRegions() const
typename view_type::host_mirror_type host_mirror_type
void changeDomain(const FieldLayout< Dim > &, const Mesh &mesh)
typename Forward< Type, view_type >::type type
Definition TypeUtils.h:205