Proto  3.2
Proto_MBPointInterpOp.H
Go to the documentation of this file.
1 #pragma once
2 #ifndef _PROTO_MB_POINT_INTERP_OP_
3 #define _PROTO_MB_POINT_INTERP_OP_
4 #include "Proto.H"
5 
6 namespace Proto
7 {
8  /// Mapped Multiblock Block Boundary Interpolation Operator
9  /** MBPointInterpOp interpolates to exactly one point in a
10  * MBLevelBoxData. This object is used by MBInterpOp which executes the
11  * interpolation across the entire MBLevelBoxData */
13  {
14  public:
15 
16  /// Constructor
17  /** Creates a PointInterpOp to the destination point dst which
18  * Which defines a specific block boundary location in an
19  * MBLevelBoxData defined on the specified map with the specified
20  * number of ghost cells. The operator itself is generated using
21  * a list of relative Points which correspond to a traditional
22  * Stencil operation on a Cartesion coordinate system. The order
23  * specifies the intended order of accuracy of the interpolation.
24  *
25  * TODO: order can probably be inferred from the footprint or vice versa
26  */
27  template<typename MAP, MemType MEM>
28  inline MBPointInterpOp(
29  MBDataPoint a_dst,
30  Point a_ghost,
31  const MBLevelMap<MAP, MEM>& a_map,
32  const MBInterpLayout& a_interpLayout,
33  unsigned int a_order);
34 
35  inline MBPointInterpOp(
36  MBDataPoint a_dst,
37  std::vector<MBDataPoint> a_srcs,
38  std::vector<double> a_coefs);
39 
40  /// Apply
41  /** computes the interpolation */
42  template<typename T, unsigned int C, MemType MEM>
43  inline void apply(
46 
47  /// Size
48  /** Returns the number of coeffcients used in the interpolation */
49  inline unsigned int size() const;
50 
51  /// Coefficients
52  /** Returns the coefficients of the interpolating polynomial for a
53  * specified component in a specified data set.
54  *
55  * Mostly used for debugging. */
56  //template<typename T, unsigned int C, MemType MEM>
57  //inline Matrix<double> coefs(
58  // MBLevelBoxData<T, C, MEM>& a_src,
59  // int a_srcComponent = 0);
60 
61  /// Target
62  /** Returns the MBDataPoint corresponding to the point of interpolation */
63  inline const MBDataPoint& target() const {return m_dst;}
64 
65  /// Sources
66  /** Returns the list of locations used for input data to the interpolation
67  * as a list of MBDataPoint objects. The order of the returnd points corresponds
68  * to the order of the coefficients in the operator matrix (outpout of SMatrix) */
69  inline const std::vector<MBDataPoint>& sources() const {return m_srcs;}
70  inline const std::vector<double>& coefs() const {return m_coefs; }
71  inline Box span() const;
72  inline void print() const;
73  template<typename MAP, MemType MEM>
74  inline void writeLevelFootprint(const MBLevelMap<MAP, MEM>& map, std::string filename) const;
75  inline void writeFootprint(std::string filename) const;
76 
77  private:
78 
79  // inline void computeSourcePoints(
80  // const std::set<Point>& footprint,
81  // const MBDisjointBoxLayout& layout,
82  // Point ghostSizes);
83  inline void computeExponents();
84  inline void validateMatrixDimensions() const;
85  template <typename MAP, MemType MEM>
87  const MBLevelMap<MAP, MEM> &map,
88  Array<double, DIM>& xCenter) const;
89  template<typename MAP, MemType MEM>
90  std::unordered_map<BlockIndex, std::vector<BoxData<double>>> computeMoments(
91  const MBLevelMap<MAP, MEM>& map) const;
92  void computeCoefficients(std::unordered_map<BlockIndex, std::vector<BoxData<double>>>& momentData);
93 
95  std::vector<MBDataPoint> m_srcs;
96  std::vector<Point> m_exponents;
97  std::vector<double> m_coefs;
98  int m_order;
99  };
100  #include "implem/Proto_MBPointInterpOpImplem.H"
101 } // end proto namespace
102 #endif // end include guard
const MBDataPoint & target() const
Coefficients.
Definition: Proto_MBPointInterpOp.H:63
unsigned int size() const
Size.
Definition: Proto_MBPointInterpOp.H:305
const std::vector< MBDataPoint > & sources() const
Sources.
Definition: Proto_MBPointInterpOp.H:69
void writeLevelFootprint(const MBLevelMap< MAP, MEM > &map, std::string filename) const
Definition: Proto_MBPointInterpOp.H:337
Multidimensional Rectangular Array.
Definition: Proto_BoxData.H:314
Definition: Proto_MBInterpLayout.H:11
void print() const
Definition: Proto_MBPointInterpOp.H:310
std::unordered_map< BlockIndex, std::vector< BoxData< double > > > computeMoments(const MBLevelMap< MAP, MEM > &map) const
Definition: Proto_MBPointInterpOp.H:157
int BlockIndex
Defines what type is used for indexing block entities.
Definition: Proto_MBGraph.H:9
std::vector< double > m_coefs
Definition: Proto_MBPointInterpOp.H:97
Single Level Mapped Multiblock Map.
Definition: Proto_MBLevelBoxData.H:19
MBPointInterpOp(MBDataPoint a_dst, Point a_ghost, const MBLevelMap< MAP, MEM > &a_map, const MBInterpLayout &a_interpLayout, unsigned int a_order)
Constructor.
Definition: Proto_MBPointInterpOp.H:30
Multiblock Level Box Data.
Definition: Proto_MBLevelBoxData.H:17
int m_order
Definition: Proto_MBPointInterpOp.H:98
void computeCoefficients(std::unordered_map< BlockIndex, std::vector< BoxData< double >>> &momentData)
Definition: Proto_MBPointInterpOp.H:226
double computeSourceDataRadius(const MBLevelMap< MAP, MEM > &map, Array< double, DIM > &xCenter) const
Definition: Proto_MBPointInterpOp.H:207
An interval in DIM dimensional space.
Definition: Proto_Box.H:29
Box span() const
Definition: Proto_MBPointInterpOp.H:364
void writeFootprint(std::string filename) const
Definition: Proto_MBPointInterpOp.H:318
Definition: Proto_Array.H:17
void apply(MBLevelBoxData< T, C, MEM > &a_dst, MBLevelBoxData< T, C, MEM > &a_src)
Apply.
Definition: Proto_MBPointInterpOp.H:285
const std::vector< double > & coefs() const
Definition: Proto_MBPointInterpOp.H:70
Integer Valued Vector.
Definition: Proto_Point.H:24
void validateMatrixDimensions() const
Definition: Proto_MBPointInterpOp.H:95
Mapped Multiblock Block Boundary Interpolation Operator.
Definition: Proto_MBPointInterpOp.H:12
MBDataPoint m_dst
Definition: Proto_MBPointInterpOp.H:94
std::vector< MBDataPoint > m_srcs
Definition: Proto_MBPointInterpOp.H:95
Definition: Proto_MBDataPoint.H:10
void computeExponents()
Definition: Proto_MBPointInterpOp.H:69
std::vector< Point > m_exponents
Definition: Proto_MBPointInterpOp.H:96