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