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