[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" |
---|
[888] | 14 | |
---|
| 15 | namespace xios { |
---|
| 16 | |
---|
| 17 | class CScalar; |
---|
| 18 | class CAxis; |
---|
| 19 | class CReduceAxisToScalar; |
---|
| 20 | class CReductionAlgorithm; |
---|
| 21 | |
---|
| 22 | /*! |
---|
[980] | 23 | \class CScalarAlgorithmReduceAxis |
---|
[933] | 24 | Reducing an axis to a scalar |
---|
[888] | 25 | */ |
---|
[980] | 26 | class CScalarAlgorithmReduceAxis : public CScalarAlgorithmTransformation |
---|
[888] | 27 | { |
---|
| 28 | public: |
---|
[980] | 29 | CScalarAlgorithmReduceAxis(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo); |
---|
[888] | 30 | |
---|
| 31 | virtual void apply(const std::vector<std::pair<int,double> >& localIndex, |
---|
| 32 | const double* dataInput, |
---|
| 33 | CArray<double,1>& dataOut, |
---|
[918] | 34 | std::vector<bool>& flagInitial, |
---|
[1260] | 35 | bool ignoreMissingValue, bool firstPass); |
---|
[888] | 36 | |
---|
[979] | 37 | virtual void updateData(CArray<double,1>& dataOut); |
---|
| 38 | |
---|
[980] | 39 | virtual ~CScalarAlgorithmReduceAxis(); |
---|
[888] | 40 | |
---|
[933] | 41 | static bool registerTrans(); |
---|
[888] | 42 | protected: |
---|
| 43 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
| 44 | |
---|
| 45 | protected: |
---|
| 46 | CReductionAlgorithm* reduction_; |
---|
| 47 | |
---|
[933] | 48 | private: |
---|
| 49 | |
---|
| 50 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
| 51 | CTransformation<CScalar>* transformation, |
---|
| 52 | int elementPositionInGrid, |
---|
| 53 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
| 54 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|
| 55 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
| 56 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
| 57 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|
| 58 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
[888] | 59 | }; |
---|
| 60 | |
---|
| 61 | } |
---|
| 62 | #endif // __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__ |
---|