1 | /*! |
---|

2 | \file axis_algorithm_reduce_domain.hpp |
---|

3 | \author Ha NGUYEN |
---|

4 | \since 23 June 2016 |
---|

5 | \date 23 June 2016 |
---|

6 | |
---|

7 | \brief Algorithm for reduce an axis to a axis |
---|

8 | */ |
---|

9 | #ifndef __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__ |
---|

10 | #define __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__ |
---|

11 | |
---|

12 | #include "axis_algorithm_transformation.hpp" |
---|

13 | #include "transformation.hpp" |
---|

14 | |
---|

15 | namespace xios { |
---|

16 | |
---|

17 | class CAxis; |
---|

18 | class CDomain; |
---|

19 | class CExtractDomainToAxis; |
---|

20 | class CReductionAlgorithm; |
---|

21 | |
---|

22 | |
---|

23 | /*! |
---|

24 | \class CAxisAlgorithmExtractDomain |
---|

25 | Extract a domain to an axis |
---|

26 | */ |
---|

27 | class CAxisAlgorithmExtractDomain : public CAxisAlgorithmTransformation |
---|

28 | { |
---|

29 | public: |
---|

30 | CAxisAlgorithmExtractDomain(CAxis* axisDestination, CDomain* domainSource, CExtractDomainToAxis* algo); |
---|

31 | |
---|

32 | virtual void apply(const std::vector<std::pair<int,double> >& localIndex, |
---|

33 | const double* dataInput, |
---|

34 | CArray<double,1>& dataOut, |
---|

35 | std::vector<bool>& flagInitial, |
---|

36 | const double& defaultValue); |
---|

37 | |
---|

38 | virtual ~CAxisAlgorithmExtractDomain(); |
---|

39 | |
---|

40 | static bool registerTrans(); |
---|

41 | protected: |
---|

42 | enum ExtractDirection { |
---|

43 | undefined = 0, |
---|

44 | iDir = 1, |
---|

45 | jDir = 2 |
---|

46 | }; |
---|

47 | |
---|

48 | ExtractDirection dir_; |
---|

49 | int pos_; //! Position to extract |
---|

50 | protected: |
---|

51 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|

52 | |
---|

53 | protected: |
---|

54 | CReductionAlgorithm* reduction_; |
---|

55 | |
---|

56 | private: |
---|

57 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|

58 | CTransformation<CAxis>* transformation, |
---|

59 | int elementPositionInGrid, |
---|

60 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|

61 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|

62 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|

63 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|

64 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|

65 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|

66 | }; |
---|

67 | |
---|

68 | } |
---|

69 | #endif // __XIOS_AXIS_ALGORITHM_EXTRACT_DOMAIN_HPP__ |
---|