[888] | 1 | /*! |
---|
| 2 | \file scalar_algorithm_reduce_scalar.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 scalar |
---|
| 8 | */ |
---|
| 9 | #ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ |
---|
| 10 | #define __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ |
---|
| 11 | |
---|
| 12 | #include "scalar_algorithm_transformation.hpp" |
---|
[933] | 13 | #include "transformation.hpp" |
---|
[1155] | 14 | #include "reduction.hpp" |
---|
[888] | 15 | |
---|
| 16 | namespace xios { |
---|
| 17 | |
---|
| 18 | class CScalar; |
---|
| 19 | class CAxis; |
---|
| 20 | class CReduceAxisToScalar; |
---|
| 21 | class CReductionAlgorithm; |
---|
| 22 | |
---|
| 23 | /*! |
---|
[980] | 24 | \class CScalarAlgorithmReduceAxis |
---|
[933] | 25 | Reducing an axis to a scalar |
---|
[888] | 26 | */ |
---|
[1155] | 27 | class CScalarAlgorithmReduceAxis : public CScalarAlgorithmTransformation, public CReductionAlgorithm |
---|
[888] | 28 | { |
---|
| 29 | public: |
---|
[980] | 30 | CScalarAlgorithmReduceAxis(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo); |
---|
[888] | 31 | |
---|
| 32 | virtual void apply(const std::vector<std::pair<int,double> >& localIndex, |
---|
| 33 | const double* dataInput, |
---|
| 34 | CArray<double,1>& dataOut, |
---|
[918] | 35 | std::vector<bool>& flagInitial, |
---|
[1082] | 36 | bool ignoreMissingValue); |
---|
[888] | 37 | |
---|
[979] | 38 | virtual void updateData(CArray<double,1>& dataOut); |
---|
| 39 | |
---|
[980] | 40 | virtual ~CScalarAlgorithmReduceAxis(); |
---|
[888] | 41 | |
---|
[933] | 42 | static bool registerTrans(); |
---|
[888] | 43 | protected: |
---|
| 44 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
| 45 | |
---|
| 46 | protected: |
---|
| 47 | CReductionAlgorithm* reduction_; |
---|
| 48 | |
---|
[933] | 49 | private: |
---|
| 50 | |
---|
| 51 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
| 52 | CTransformation<CScalar>* 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); |
---|
[888] | 60 | }; |
---|
| 61 | |
---|
| 62 | } |
---|
| 63 | #endif // __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ |
---|