Proto  3.2
Proto_MBInterpLayout.H
Go to the documentation of this file.
1 #pragma once
2 #ifndef _PROTO_MB_INTERP_LAYOUT_
3 #define _PROTO_MB_INTERP_LAYOUT_
4 
5 #include <algorithm> //used for std::sort
6 #include "Proto.H"
7 
8 namespace Proto
9 {
10 
12  {
13  public:
14  inline MBInterpLayout(){}
15  inline MBInterpLayout(const MBDisjointBoxLayout& layout, int order = 4);
16  inline void addPointToBaseFootprint(Point a_point) { m_baseFootprint.insert(a_point); }
17 
18  /// @brief Modifies the base footprint so that the designated axis is ignored
19  /// @param dir The axis to be ignored
20  inline void ignoreAxis(int dir);
21 
22  inline bool isIgnoredAxis(int dir) const { return footprintSpan().size(dir) == 1; }
23 
24  /// @brief Allows stencils produced with this layout to be copied along the designated axis (optimization)
25  /// @param a_dir
26  /// @param a_flag
27  inline void setCopy(int a_dir, bool a_flag) { m_copyAxes[a_dir] = a_flag; }
28 
29  inline bool isCopied(int a_dir) const { return m_copyAxes[a_dir]; }
30 
31  /// @brief Returns the set of shifts that would be used in the bulk of a regular grid
32  /// @return
33  inline std::set<Point> baseFootprint() const { return m_baseFootprint; }
34 
35  /// @brief Returns the modified base footprint, adding extra points for dealing with boundaries
36  /// @param point The "center" of the stencil. This is the point being interpolated to
37  /// @param index The index of the patch which contains point (in its ghost region)
38  /// @return
39  template<typename MAP, MemType MEM>
40  inline std::set<Point> footprint(
41  Point point,
42  MBIndex index,
43  const MBLevelMap<MAP, MEM>& map) const;
44 
45  /// @brief Converts a set of shifts (footprint) into a set of MBDataPoint used to access data for interpolation
46  /// @param footprint The set of shifts returned from this->footprint above
47  /// @param map Used to convert local index space points into points in adjacent blocks as needed
48  /// @param center The point being interpolated to
49  /// @param index The index of the patch containing center
50  /// @param minSources The minimum number of sources needed for operator to be fully determined
51  /// @return
52  template<typename MAP, MemType MEM>
53  inline std::vector<MBDataPoint> computeSourcePoints(
54  const MBLevelMap<MAP, MEM>& map,
55  Point center, MBIndex index, int minSources) const;
56 
57  /// @brief Return contains 1 for axes participating in interpolation and 0 for axes not participating
58  /// @return
59  inline Point footprintMask() const;
60 
61  /// @brief Returns the span of the base footprint (for 4th order this should be Box::Kernel(2) if no axes are ignored)
62  /// @return
63  inline Box footprintSpan() const;
64  inline const MBDisjointBoxLayout& layout() const { return m_layout; }
65 
66  private:
67 
68  inline Point applyIgnoredAxes(Point basePoint, Point sourcePoint) const;
69  template<typename MAP, MemType MEM>
70  inline void addRedundantBoundarySources(
71  MBIndex localIndex,
72  std::set<MBDataPoint>& sourcePoints,
73  const MBLevelMap<MAP, MEM>& map) const;
74  inline void addTriplePointFootprint(
75  std::set<Point>& footprint,
76  Point center,
77  Point triplePointBoundary,
78  MBIndex index) const;
79 
80  inline void addBoundaryFootprint(
81  std::set<Point>& footprint,
82  Point center,
83  MBIndex index) const;
84 
85  inline void removeDomainBoundaryPoints(
86  std::set<Point>& footprint,
87  Point center,
88  MBIndex index) const;
89 
90  inline void removeTriplePointPoints(
91  std::set<Point>& footprint,
92  Point center,
93  MBIndex index) const;
94 
95  // Currently unused
96  inline void addInwardPoints(
97  std::set<Point>& footprint,
98  MBIndex index) const;
99 
100  inline void augmentFootprint(
101  Point shift,
102  std::set<Point>& augmentedFootprint,
103  const std::set<Point>& footprint) const;
104 
105  template<typename MAP, MemType MEM>
106  inline bool addSourceFromShiftedPoint(
107  Point shiftedPoint,
108  std::set<MBDataPoint>& sources,
109  const MBLevelMap<MAP, MEM>& map,
110  MBIndex index) const;
111 
112  template<typename MAP, MemType MEM>
113  inline bool addSourcePoint(
114  std::set<MBDataPoint>& sourcePoints,
115  Point localPoint,
116  MBIndex localIndex,
117  Point sourcePoint,
118  MBIndex sourceIndex,
119  const MBLevelMap<MAP,MEM>& map) const;
120 
121  template<typename MAP, MemType MEM>
122  inline void addSourcePointsNear(
123  Point centerPoint,
124  MBIndex centerIndex,
125  MBIndex localIndex,
126  std::set<MBDataPoint>& sourcePoints,
127  const MBLevelMap<MAP,MEM>& map) const;
128 
129  inline void removeSourcePointsNear(
130  Point trueCenterPoint,
131  int numSourcesToKeep,
132  std::set<MBDataPoint>& sourcePoints) const;
133 
135  std::set<Point> m_baseFootprint;
137  };
138  #include "implem/Proto_MBInterpLayoutImplem.H"
139 
140 } //end namespace Proto
141 #endif // end include guard
ACCEL_DECORATION std::size_t size(unsigned int a_dim) const
Edge Size.
bool addSourcePoint(std::set< MBDataPoint > &sourcePoints, Point localPoint, MBIndex localIndex, Point sourcePoint, MBIndex sourceIndex, const MBLevelMap< MAP, MEM > &map) const
Definition: Proto_MBInterpLayout.H:189
void addBoundaryFootprint(std::set< Point > &footprint, Point center, MBIndex index) const
MBDisjointBoxLayout m_layout
Definition: Proto_MBInterpLayout.H:134
Definition: Proto_MBInterpLayout.H:11
Box footprintSpan() const
Returns the span of the base footprint (for 4th order this should be Box::Kernel(2) if no axes are ig...
Definition: Proto_MBInterpLayout.H:306
bool isIgnoredAxis(int dir) const
Definition: Proto_MBInterpLayout.H:22
std::vector< MBDataPoint > computeSourcePoints(const MBLevelMap< MAP, MEM > &map, Point center, MBIndex index, int minSources) const
Converts a set of shifts (footprint) into a set of MBDataPoint used to access data for interpolation...
Definition: Proto_MBInterpLayout.H:47
Single Level Mapped Multiblock Map.
Definition: Proto_MBLevelBoxData.H:19
void ignoreAxis(int dir)
Modifies the base footprint so that the designated axis is ignored.
Definition: Proto_MBInterpLayout.H:35
void removeSourcePointsNear(Point trueCenterPoint, int numSourcesToKeep, std::set< MBDataPoint > &sourcePoints) const
Definition: Proto_MBInterpLayout.H:227
std::set< Point > footprint(Point point, MBIndex index, const MBLevelMap< MAP, MEM > &map) const
Returns the modified base footprint, adding extra points for dealing with boundaries.
An interval in DIM dimensional space.
Definition: Proto_Box.H:29
Point footprintMask() const
Return contains 1 for axes participating in interpolation and 0 for axes not participating.
Definition: Proto_MBInterpLayout.H:295
bool addSourceFromShiftedPoint(Point shiftedPoint, std::set< MBDataPoint > &sources, const MBLevelMap< MAP, MEM > &map, MBIndex index) const
std::set< Point > baseFootprint() const
Returns the set of shifts that would be used in the bulk of a regular grid.
Definition: Proto_MBInterpLayout.H:33
void addSourcePointsNear(Point centerPoint, MBIndex centerIndex, MBIndex localIndex, std::set< MBDataPoint > &sourcePoints, const MBLevelMap< MAP, MEM > &map) const
Definition: Proto_MBInterpLayout.H:103
void addInwardPoints(std::set< Point > &footprint, MBIndex index) const
const MBDisjointBoxLayout & layout() const
Definition: Proto_MBInterpLayout.H:64
Array< bool, DIM > m_copyAxes
Definition: Proto_MBInterpLayout.H:136
void addPointToBaseFootprint(Point a_point)
Definition: Proto_MBInterpLayout.H:16
void setCopy(int a_dir, bool a_flag)
Allows stencils produced with this layout to be copied along the designated axis (optimization) ...
Definition: Proto_MBInterpLayout.H:27
Definition: Proto_Array.H:17
uint64_t index
Definition: Proto_MBBoxPartition.H:15
void removeDomainBoundaryPoints(std::set< Point > &footprint, Point center, MBIndex index) const
Integer Valued Vector.
Definition: Proto_Point.H:24
Definition: Proto_MBDisjointBoxLayout.H:14
void addTriplePointFootprint(std::set< Point > &footprint, Point center, Point triplePointBoundary, MBIndex index) const
bool isCopied(int a_dir) const
Definition: Proto_MBInterpLayout.H:29
std::set< Point > m_baseFootprint
Definition: Proto_MBInterpLayout.H:135
MBInterpLayout()
Definition: Proto_MBInterpLayout.H:14
Point applyIgnoredAxes(Point basePoint, Point sourcePoint) const
Definition: Proto_MBInterpLayout.H:316
Point dir
Definition: Proto_MBBoxPartition.H:16
void removeTriplePointPoints(std::set< Point > &footprint, Point center, MBIndex index) const
void augmentFootprint(Point shift, std::set< Point > &augmentedFootprint, const std::set< Point > &footprint) const
void addRedundantBoundarySources(MBIndex localIndex, std::set< MBDataPoint > &sourcePoints, const MBLevelMap< MAP, MEM > &map) const
Definition: Proto_MBInterpLayout.H:256