[1301] | 1 | /*! |
---|

| 2 | \file axis_algorithm_reduce_axis.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_REDUCE_AXIS_HPP__ |
---|

| 10 | #define __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ |
---|

| 11 | |
---|

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

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

| 14 | |
---|

| 15 | namespace xios { |
---|

| 16 | |
---|

| 17 | class CAxis; |
---|

| 18 | class CReduceAxisToAxis; |
---|

| 19 | class CReductionAlgorithm; |
---|

| 20 | |
---|

| 21 | /*! |
---|

| 22 | \class CAxisAlgorithmReduceAxis |
---|

| 23 | Reduce a axis to an axis |
---|

| 24 | */ |
---|

| 25 | class CAxisAlgorithmReduceAxis : public CAxisAlgorithmTransformation |
---|

| 26 | { |
---|

| 27 | public: |
---|

| 28 | CAxisAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo); |
---|

| 29 | |
---|

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

| 31 | const double* dataInput, |
---|

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

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

| 34 | bool ignoreMissingValue, bool firstPass); |
---|

| 35 | |
---|

| 36 | virtual void updateData(CArray<double,1>& dataOut); |
---|

| 37 | |
---|

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

| 39 | |
---|

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

| 41 | protected: |
---|

| 42 | bool local ; |
---|

| 43 | |
---|

| 44 | protected: |
---|

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

| 46 | |
---|

| 47 | protected: |
---|

| 48 | CReductionAlgorithm* reduction_; |
---|

| 49 | |
---|

| 50 | private: |
---|

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

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

| 53 | int elementPositionInGrid, |
---|

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

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

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

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

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

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

| 60 | }; |
---|

| 61 | |
---|

| 62 | } |
---|

| 63 | #endif // __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__ |
---|