[895] | 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_REDUCE_DOMAIN_HPP__ |
---|
| 10 | #define __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ |
---|
| 11 | |
---|
| 12 | #include "axis_algorithm_transformation.hpp" |
---|
[933] | 13 | #include "transformation.hpp" |
---|
[1601] | 14 | #include "reduction.hpp" |
---|
[895] | 15 | |
---|
| 16 | namespace xios { |
---|
| 17 | |
---|
| 18 | class CAxis; |
---|
| 19 | class CDomain; |
---|
| 20 | class CReduceDomainToAxis; |
---|
| 21 | class CReductionAlgorithm; |
---|
| 22 | |
---|
| 23 | /*! |
---|
| 24 | \class CAxisAlgorithmReduceDomain |
---|
| 25 | Reduce a domain to an axis |
---|
| 26 | */ |
---|
[1601] | 27 | class CAxisAlgorithmReduceDomain : public CAxisAlgorithmTransformation, public CReductionAlgorithm |
---|
[895] | 28 | { |
---|
| 29 | public: |
---|
| 30 | CAxisAlgorithmReduceDomain(CAxis* axisDestination, CDomain* domainSource, CReduceDomainToAxis* algo); |
---|
| 31 | |
---|
| 32 | virtual void apply(const std::vector<std::pair<int,double> >& localIndex, |
---|
| 33 | const double* dataInput, |
---|
| 34 | CArray<double,1>& dataOut, |
---|
[1158] | 35 | std::vector<bool>& flagInitial, |
---|
[1260] | 36 | bool ignoreMissingValue, bool firstPass); |
---|
[895] | 37 | |
---|
[979] | 38 | virtual void updateData(CArray<double,1>& dataOut); |
---|
| 39 | |
---|
[895] | 40 | virtual ~CAxisAlgorithmReduceDomain(); |
---|
| 41 | |
---|
[933] | 42 | static bool registerTrans(); |
---|
[895] | 43 | protected: |
---|
| 44 | enum ReduceDirection { |
---|
| 45 | undefined = 0, |
---|
| 46 | iDir = 1, |
---|
| 47 | jDir = 2 |
---|
| 48 | }; |
---|
[1601] | 49 | |
---|
[895] | 50 | ReduceDirection dir_; |
---|
[1299] | 51 | bool local ; |
---|
| 52 | |
---|
[895] | 53 | protected: |
---|
[979] | 54 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
| 55 | |
---|
[895] | 56 | protected: |
---|
| 57 | CReductionAlgorithm* reduction_; |
---|
| 58 | |
---|
[933] | 59 | private: |
---|
| 60 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
| 61 | CTransformation<CAxis>* transformation, |
---|
| 62 | int elementPositionInGrid, |
---|
| 63 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
| 64 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|
| 65 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
| 66 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
| 67 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|
| 68 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
[895] | 69 | }; |
---|
| 70 | |
---|
| 71 | } |
---|
| 72 | #endif // __XIOS_AXIS_ALGORITHM_REDUCE_DOMAIN_HPP__ |
---|