OPALX (Object Oriented Parallel Accelerator Library for Exascale) MINIorX
OPALX
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.
55 RegionLayout(const FieldLayout<Dim>&, const Mesh&);
56
57 ~RegionLayout() = default;
58
59 const NDRegion_t& getDomain() const { return region_m; }
60
61 const view_type getdLocalRegions() const;
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
typename ippl::detail::ViewType< ippl::Vector< double, Dim >, 1 >::view_type view_type
This file defines multi-dimensional arrays to store mesh and particle attributes.
Implementations for FFT constructor/destructor and transforms.
Definition: Archive.h:20
typename Forward< Type, view_type >::type type
Definition: TypeUtils.h:205
std::ostream & operator<<(std::ostream &, const BCondBase< Field > &)
Definition: BcTypes.hpp:28
NDRegion_t convertNDIndex(const NDIndex< Dim > &, const Mesh &mesh) const
view_type dLocalRegions_m
local regions (device view)
Definition: RegionLayout.h:82
host_mirror_type hLocalRegions_m
local regions (host mirror view)
Definition: RegionLayout.h:85
const view_type getdLocalRegions() const
typename CreateUniformType< base_type, view_type >::type uniform_type
Definition: RegionLayout.h:45
void fillRegions(const FieldLayout< Dim > &, const Mesh &mesh)
const NDRegion_t & getDomain() const
Definition: RegionLayout.h:59
void write(std::ostream &=std::cout) const
typename ViewType< NDRegion_t, 1, Properties... >::view_type view_type
Definition: RegionLayout.h:42
std::array< int, Dim > indexOffset_m
Offset from 'normal' Index space to 'Mesh' Index space.
Definition: RegionLayout.h:74
std::array< bool, Dim > centerOffset_m
Offset needed between centering of Index space and Mesh points.
Definition: RegionLayout.h:77
NDRegion< T, Dim > NDRegion_t
Definition: RegionLayout.h:41
const host_mirror_type gethLocalRegions() const
typename view_type::host_mirror_type host_mirror_type
Definition: RegionLayout.h:43
void changeDomain(const FieldLayout< Dim > &, const Mesh &mesh)
constexpr unsigned Dim