source: XIOS/dev/dev_olga/src/transformation/axis_algorithm_interpolate.hpp @ 1620

Last change on this file since 1620 was 933, checked in by mhnguyen, 4 years ago

Improving transformation selection. Instead of modifying directly grid_transformation
we only need to register a new transformation with the framework

+) Update all transformations with this new method

Test
+) On Curie
+) Basic tests pass

File size: 2.5 KB
Line 
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 "transformation.hpp"
14
15namespace xios {
16
17class CAxis;
18class CGrid;
19class CInterpolateAxis;
20
21/*!
22  \class CAxisAlgorithmInterpolate
23  Implementing interpolation on axis
24  The values on axis source are assumed monotonic
25*/
26class CAxisAlgorithmInterpolate : public CAxisAlgorithmTransformation
27{
28public:
29  CAxisAlgorithmInterpolate(CAxis* axisDestination, CAxis* axisSource, CInterpolateAxis* interpAxis);
30
31  virtual ~CAxisAlgorithmInterpolate() {}
32
33  static bool registerTrans();
34protected:
35  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
36
37private:
38  void retrieveAllAxisValue(const CArray<double,1>& axisValue, const CArray<bool,1>& axisMask,
39                            std::vector<double>& recvBuff, std::vector<int>& indexVec);
40  void computeInterpolantPoint(const std::vector<double>& recvBuff, const std::vector<int>&, int transPos = 0);
41  void computeWeightedValueAndMapping(const std::map<int, std::vector<std::pair<int,double> > >& interpolatingIndexValues, int transPos = 0);
42  void fillInAxisValue(std::vector<CArray<double,1> >& vecAxisValue,
43                       const std::vector<CArray<double,1>* >& dataAuxInputs);
44
45private:
46  // Interpolation order
47  int order_;
48  StdString coordinate_;
49  std::vector<std::vector<int> > transPosition_;
50
51private:
52  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
53                                                CTransformation<CAxis>* transformation,
54                                                int elementPositionInGrid,
55                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
56                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
57                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
58                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
59                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
60                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
61};
62
63}
64
65#endif // __XIOS_AXIS_ALGORITHM_INTERPOLATE_HPP__
Note: See TracBrowser for help on using the repository browser.