[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" |
---|
[933] | 13 | #include "transformation.hpp" |
---|
[630] | 14 | |
---|
| 15 | namespace xios { |
---|
[933] | 16 | |
---|
| 17 | class CAxis; |
---|
| 18 | class CGrid; |
---|
| 19 | class CInterpolateAxis; |
---|
[2033] | 20 | |
---|
[630] | 21 | /*! |
---|
| 22 | \class CAxisAlgorithmInterpolate |
---|
| 23 | Implementing interpolation on axis |
---|
| 24 | The values on axis source are assumed monotonic |
---|
| 25 | */ |
---|
| 26 | class CAxisAlgorithmInterpolate : public CAxisAlgorithmTransformation |
---|
| 27 | { |
---|
| 28 | public: |
---|
| 29 | CAxisAlgorithmInterpolate(CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis); |
---|
| 30 | |
---|
| 31 | virtual ~CAxisAlgorithmInterpolate() {} |
---|
| 32 | |
---|
[933] | 33 | static bool registerTrans(); |
---|
[1704] | 34 | |
---|
[1982] | 35 | virtual StdString getName() {return "interpolate_axis";} |
---|
[1980] | 36 | bool isInversed() {return isInversed_;} |
---|
[1704] | 37 | |
---|
[827] | 38 | protected: |
---|
| 39 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
[630] | 40 | |
---|
| 41 | private: |
---|
[827] | 42 | void retrieveAllAxisValue(const CArray<double,1>& axisValue, const CArray<bool,1>& axisMask, |
---|
| 43 | std::vector<double>& recvBuff, std::vector<int>& indexVec); |
---|
[912] | 44 | void computeInterpolantPoint(const std::vector<double>& recvBuff, const std::vector<int>&, int transPos = 0); |
---|
[1980] | 45 | void computeInterpolantPoint(const std::vector<double>& recvBuff, const std::vector<int>&, |
---|
| 46 | const std::vector<CArray<double,1>* >& dataAuxInputs, int transPos = 0); |
---|
[2033] | 47 | void computeWeightedValueAndMapping(CArray<double,1>& axisDestValue, const std::map<int, std::vector<std::pair<int,double> > >& interpolatingIndexValues, int transPos = 0); |
---|
[827] | 48 | void fillInAxisValue(std::vector<CArray<double,1> >& vecAxisValue, |
---|
| 49 | const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
[630] | 50 | |
---|
| 51 | private: |
---|
| 52 | // Interpolation order |
---|
| 53 | int order_; |
---|
[2033] | 54 | bool extrapolate_ ; |
---|
[827] | 55 | StdString coordinate_; |
---|
[1980] | 56 | StdString coordinateDST_; |
---|
| 57 | bool isInversed_; |
---|
[827] | 58 | std::vector<std::vector<int> > transPosition_; |
---|
[933] | 59 | |
---|
| 60 | private: |
---|
| 61 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
| 62 | CTransformation<CAxis>* transformation, |
---|
| 63 | int elementPositionInGrid, |
---|
| 64 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
| 65 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|
| 66 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
| 67 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
| 68 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|
| 69 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
[630] | 70 | }; |
---|
| 71 | |
---|
| 72 | } |
---|
[896] | 73 | |
---|
[630] | 74 | #endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__ |
---|