36 #ifndef LIBUTILITIES_BASICUTILS_INTERPOLATOR_H 37 #define LIBUTILITIES_BASICUTILS_INTERPOLATOR_H 44 #include <boost/geometry/geometries/box.hpp> 45 #include <boost/geometry/geometries/point.hpp> 46 #include <boost/geometry/index/rtree.hpp> 56 namespace LibUtilities
92 short int coordId = -1,
133 template <
typename FuncPo
interT,
typename ObjectPo
interT>
137 func, obj, std::placeholders::_1, std::placeholders::_2);
147 std::function<void(const int position, const int goal)>
162 : idx(idx), coords(coords), dist(dist){};
166 return (dist < comp.
dist);
172 typedef boost::geometry::model::point<NekDouble, m_dim, boost::geometry::cs::cartesian>
BPoint;
174 typedef boost::geometry::index::rtree<PtsPointPair, boost::geometry::index::rstar<16> >
PtsRtree;
199 const int maxPts = 250);
213 std::vector<PtsPoint> &neighbourPts,
215 const unsigned int maxPts = 1);
218 std::vector<PtsPoint> &neighbourPts,
219 const unsigned int numPts = 1);
LibUtilities::PtsFieldSharedPtr m_ptsOutField
output field
Array< TwoD, unsigned int > m_neighInds
Indices of the relevant neighbours for each physical point. Structure: m_neighInds[ptIdx][neighbourId...
short int m_coordId
coordinate id along which the interpolation should be performed
Interpolator(InterpMethod method=eNoMethod, short int coordId=-1, NekDouble filtWidth=0.0, int maxPts=1000)
Constructor of the Interpolator class.
void CalcW_Gauss(const PtsPoint &searchPt, const NekDouble sigma, const int maxPts=250)
Computes interpolation weights using gaussian interpolation.
boost::geometry::index::rtree< PtsPointPair, boost::geometry::index::rstar< 16 > > PtsRtree
NekDouble GetFiltWidth() const
Returns the filter width.
A class that contains algorithms for interpolation between pts fields, expansions and different meshe...
void SetProgressCallback(FuncPointerT func, ObjectPointerT obj)
sets a callback funtion which gets called every time the interpolation progresses ...
void FindNeighbours(const PtsPoint &searchPt, std::vector< PtsPoint > &neighbourPts, const NekDouble dist, const unsigned int maxPts=1)
Finds the neares neighbours of a point.
void CalcWeights(const LibUtilities::PtsFieldSharedPtr ptsInField, LibUtilities::PtsFieldSharedPtr &ptsOutField)
Compute interpolation weights without doing any interpolation.
PtsPoint(int idx, Array< OneD, NekDouble > coords, NekDouble dist)
Array< OneD, NekDouble > coords
LibUtilities::PtsFieldSharedPtr GetInField() const
Returns the input field.
void CalcW_Linear(const PtsPoint &searchPt, int coordId)
Computes interpolation weights using linear interpolation.
int m_maxPts
Max number of interpolation points.
std::pair< BPoint, unsigned int > PtsPointPair
void FindNNeighbours(const PtsPoint &searchPt, std::vector< PtsPoint > &neighbourPts, const unsigned int numPts=1)
Finds the neares neighbours of a point.
Array< TwoD, NekDouble > m_weights
Interpolation weights for each neighbour. Structure: m_weights[physPtIdx][neighbourIdx].
boost::geometry::model::point< NekDouble, m_dim, boost::geometry::cs::cartesian > BPoint
void CalcW_Shepard(const PtsPoint &searchPt, int numPts)
Computes interpolation weights using linear interpolation.
std::shared_ptr< PtsRtree > m_rtree
A tree structure to speed up the neighbour search. Note that we fill it with an iterator, so instead of rstar, the packing algorithm is used.
InterpMethod m_method
Interpolation Method.
void CalcW_NNeighbour(const PtsPoint &searchPt)
Computes interpolation weights using nearest neighbour interpolation.
static const int m_dim
dimension of this interpolator. Hardcoded to 3
LibUtilities::PtsFieldSharedPtr m_ptsInField
input field
void Interpolate(const LibUtilities::PtsFieldSharedPtr ptsInField, LibUtilities::PtsFieldSharedPtr &ptsOutField)
Interpolate from a pts field to a pts field.
std::shared_ptr< PtsField > PtsFieldSharedPtr
#define LIB_UTILITIES_EXPORT
bool operator<(const PtsPoint &comp) const
void CalcW_Quadratic(const PtsPoint &searchPt, int coordId)
Computes interpolation weights using quadratic interpolation.
std::function< void(const int position, const int goal)> m_progressCallback
std::shared_ptr< Interpolator > InterpolatorSharedPtr
InterpMethod GetInterpMethod() const
Returns the interpolation method used by this interpolator.
LibUtilities::PtsFieldSharedPtr GetOutField() const
Returns the output field.
NekDouble m_filtWidth
Filter width used for some interpolation algorithms.
int GetDim() const
returns the dimension of the Interpolator. Should be higher than the dimensions of the interpolated f...
int GetCoordId() const
Returns the coordinate id along which the interpolation should be performed.
void PrintStatistics()
Returns if the weights have already been computed.