Proto  3.2
Proto_MBBoundaryRegister.H
Go to the documentation of this file.
1 #pragma once
2 #ifndef _PROTO_MB_BOUNDARY_REGISTER_
3 #define _PROTO_MB_BOUNDARY_REGISTER_
4 
5 #include "Proto.H"
7 #include "Proto_MBBoundaryData.H"
8 
9 namespace Proto
10 {
12 
13  template<typename T, unsigned int C, MemType MEM, Centering CTR>
15 
16  /// Copier Operator
17  template<typename T, unsigned int C, MemType MEM, Centering CTR>
19  {
20  public:
22 
23  inline MBBoundaryCopierOp(){};
24 
25  inline MBBoundaryCopierOp(
27 
28  inline uint64_t linearSize(
29  const Box& a_bx,
30  const MBIndex& a_index) const;
31 
32  inline void linearOut(
33  void* a_buffer,
34  const MBMotionItem& a_info) const;
35 
36  inline void linearIn(
37  void* a_buffer,
38  const MBMotionItem& a_info) const;
39 
40  inline void localCopy(
41  const MBMotionItem& a_info) const;
42  };
43 
44  /// Copier
45  template<typename T, unsigned int C, MemType MEM, Centering CTR>
47  : public Copier<MBBoundaryCopierOp<T, C, MEM, CTR>,
48  MBBoxPartition, MBBoxPartition, MEM, MEM>
49  {
50  public:
51  inline MBBoundaryCopier();
52 
53  inline void buildMotionPlans(
55  };
56 
57  /// Boundary Register
58  /** A specialized data holder that contains data in the vicinity of block boundaries
59  */
60  template<typename T, unsigned int C, MemType MEM=MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
61  class MBBoundaryRegister
62  {
63  public:
64  // PatchID, BlockID, Dir
65  typedef std::tuple<Point, unsigned int, Point> boundsKey_t;
66 
67  /// Trivial Constructor
68  inline MBBoundaryRegister(){}
69 
70  /// Constructor
71  /** Creates a register from a layout. Depth is the distance in cells from a boundary that
72  * will be allocated in each MBBoundaryData's base buffer. If depth is negative, the
73  * register's base region is inside the problem domain and vice versa. Each of these
74  * buffers can optionally be enlarged anisotropically using the ghost parameter.
75  * If "bothSides" is true, all registers will allocate space on both sides of the
76  * boundary. In this case, the sign of depth has no effect.
77  */
78  inline MBBoundaryRegister(
79  const MBDisjointBoxLayout& a_layout,
80  int a_depth,
81  Point a_ghost,
82  bool a_bothSides = true);
83 
84  /// Lazy Constructor
85  inline void define(
86  const MBDisjointBoxLayout& a_layout,
87  int a_depth,
88  Point a_ghost,
89  bool a_bothSides = true);
90 
91  // Get Boundary Data
92  inline MBBoundaryData<T,C,MEM>& bound(
93  MBIndex a_index,
94  Point a_dir,
95  unsigned int a_adjBlock);
96 
97  // Get Boundary Data
98  inline MBBoundaryData<T,C,MEM>& bound(
99  MBIndex a_index,
100  unsigned int a_dir,
101  Side::LoHiSide a_side);
102 
103  // Get All Boundary Data
104  inline std::vector<MBBoundaryData<T,C,MEM>> bounds(
105  MBIndex a_index,
106  Point a_dir);
107 
108  // Get All Boundary Data
109  inline std::vector<MBBoundaryData<T,C,MEM>> bounds(
110  MBIndex a_index);
111 
112  // Get Local Data
113  inline BoxData<T,C,MEM>& local(
114  MBIndex a_index,
115  Point a_dir,
116  unsigned int a_adjBlock);
117 
118  // Get Local Data
119  inline BoxData<T,C,MEM>& local(
120  MBIndex a_index,
121  unsigned int a_dir,
122  Side::LoHiSide a_side);
123 
124  // Get Local Data
125  inline BoxData<T,C,MEM>& local(
126  MBIndex a_localIndex,
127  MBIndex a_adjIndex);
128 
129  // Get Adjacent Data
130  inline BoxData<T,C,MEM>& adjacent(
131  MBIndex a_index,
132  unsigned int a_dir,
133  Side::LoHiSide a_side);
134 
135  // Get Adjacent Data
136  inline BoxData<T,C,MEM>& adjacent(
137  MBIndex a_index,
138  Point a_dir,
139  unsigned int a_adjBlock);
140 
141  // Get Adjacent Data
142  inline BoxData<T,C,MEM>& adjacent(
143  MBIndex a_localIndex,
144  MBIndex a_adjIndex);
145 
146  // Get Rotation
147  inline CoordPermutation toLocal(
148  MBIndex a_index,
149  Point a_dir,
150  unsigned int a_adjBlock);
151 
152  // Get Rotation
153  inline CoordPermutation toLocal(
154  MBIndex a_index,
155  unsigned int a_dir,
156  Side::LoHiSide a_side);
157 
158  // Zero All Registers
159  inline void clear();
160 
161  // Zero Local Registers
162  inline void clearLocal();
163 
164  // Zero Adjacent Registers
165  inline void clearAdjacent();
166 
167  // Fill Adjacent Registers
168  inline void exchange();
169 
170  // Get Layout
171  inline const MBDisjointBoxLayout& layout() {return m_layout; }
172 
173  // Get Ghost Size
174  inline Point ghost() {return m_ghost; }
175 
177  private:
178 
181  mutable std::map<boundsKey_t, std::vector<MBBoundaryData<T, C, MEM>>> m_bounds;
183  };
184 #include "implem/Proto_MBBoundaryRegisterImplem.H"
185 } // end namespace Proto
186 #endif // end include guard
MBBoundaryCopierOp()
Definition: Proto_MBBoundaryRegister.H:23
MBBoundaryRegister< T, C, MEM, CTR > * m_data
Definition: Proto_MBBoundaryRegister.H:21
LoHiSide
Side Enum.
Definition: Proto_Face.H:23
std::tuple< Point, unsigned int, Point > boundsKey_t
Definition: Proto_MBBoundaryRegister.H:65
Multidimensional Rectangular Array.
Definition: Proto_BoxData.H:314
MBBoundaryRegister()
Trivial Constructor.
Definition: Proto_MBBoundaryRegister.H:68
MBBoundaryCopier< T, C, MEM, CTR > m_copier
Definition: Proto_MBBoundaryRegister.H:182
Copier Operator.
Definition: Proto_MBBoundaryRegister.H:18
Defines discrete rotations in logically rectangular coordinate systems.
Definition: Proto_CoordPermutation.H:13
uint64_t linearSize(const Box &a_bx, const MBIndex &a_index) const
Definition: Proto_MBBoundaryRegister.H:414
MotionItem< MBBoxPartition, MBBoxPartition > MBMotionItem
Definition: Proto_MBBoundaryRegister.H:11
An interval in DIM dimensional space.
Definition: Proto_Box.H:29
const MBDisjointBoxLayout & layout()
Definition: Proto_MBBoundaryRegister.H:171
void linearOut(void *a_buffer, const MBMotionItem &a_info) const
Definition: Proto_MBBoundaryRegister.H:423
Boundary Register.
Definition: Proto_MBBoundaryRegister.H:14
Definition: Proto_MBBoundaryData.H:11
Point ghost()
Definition: Proto_MBBoundaryRegister.H:174
std::map< boundsKey_t, std::vector< MBBoundaryData< T, C, MEM > > > m_bounds
Definition: Proto_MBBoundaryRegister.H:181
Definition: Proto_Array.H:17
Point m_ghost
Definition: Proto_MBBoundaryRegister.H:179
Integer Valued Vector.
Definition: Proto_Point.H:24
Definition: Proto_MBDisjointBoxLayout.H:14
Copier.
Definition: Proto_MBBoundaryRegister.H:46
void localCopy(const MBMotionItem &a_info) const
Definition: Proto_MBBoundaryRegister.H:455
exchange()
MBDisjointBoxLayout m_layout
Definition: Proto_MBBoundaryRegister.H:180
Abstract Generic Parallel Copier.
Definition: Proto_Copier.H:60
void linearIn(void *a_buffer, const MBMotionItem &a_info) const
Definition: Proto_MBBoundaryRegister.H:439
Definition: Proto_Copier.H:22