[630] | 1 | /*! |
---|
| 2 | \file axis_algorithm_interpolate.hpp |
---|
| 3 | \author Ha NGUYEN |
---|
| 4 | \since 23 June 2015 |
---|
| 5 | \date 23 June 2015 |
---|
| 6 | |
---|
| 7 | \brief Algorithm for interpolation on an axis. |
---|
| 8 | */ |
---|
| 9 | #ifndef __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ |
---|
| 10 | #define __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ |
---|
| 11 | |
---|
| 12 | #include "axis_algorithm_transformation.hpp" |
---|
| 13 | #include "axis.hpp" |
---|
| 14 | #include "interpolate_axis.hpp" |
---|
| 15 | |
---|
| 16 | namespace xios { |
---|
| 17 | /*! |
---|
| 18 | \class CAxisAlgorithmInterpolate |
---|
| 19 | Implementing interpolation on axis |
---|
| 20 | The values on axis source are assumed monotonic |
---|
| 21 | */ |
---|
| 22 | class CAxisAlgorithmInterpolate : public CAxisAlgorithmTransformation |
---|
| 23 | { |
---|
| 24 | public: |
---|
| 25 | CAxisAlgorithmInterpolate(CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis); |
---|
| 26 | |
---|
| 27 | virtual ~CAxisAlgorithmInterpolate() {} |
---|
| 28 | |
---|
[827] | 29 | protected: |
---|
| 30 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
[630] | 31 | |
---|
| 32 | private: |
---|
[827] | 33 | void retrieveAllAxisValue(const CArray<double,1>& axisValue, const CArray<bool,1>& axisMask, |
---|
| 34 | std::vector<double>& recvBuff, std::vector<int>& indexVec); |
---|
| 35 | void computeInterpolantPoint(const std::vector<double>& recvBuff, const std::vector<int>& indexVec, int transPos = 0); |
---|
| 36 | void computeWeightedValueAndMapping(const std::map<int, std::vector<std::pair<int,double> > >& interpolatingIndexValues, int transPos = 0); |
---|
| 37 | void fillInAxisValue(std::vector<CArray<double,1> >& vecAxisValue, |
---|
| 38 | const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
[630] | 39 | |
---|
| 40 | private: |
---|
| 41 | // Interpolation order |
---|
| 42 | int order_; |
---|
[827] | 43 | StdString coordinate_; |
---|
| 44 | std::vector<std::vector<int> > transPosition_; |
---|
[630] | 45 | }; |
---|
| 46 | |
---|
| 47 | } |
---|
| 48 | #endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ |
---|