[1460] | 1 | /*! |
---|
| 2 | \file scalar_algorithm_reduce_scalar.hpp |
---|
| 3 | \brief Algorithm for reduce an scalar to a scalar |
---|
| 4 | */ |
---|
| 5 | #ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ |
---|
| 6 | #define __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ |
---|
| 7 | |
---|
| 8 | #include "scalar_algorithm_transformation.hpp" |
---|
| 9 | #include "transformation.hpp" |
---|
| 10 | #include "reduction.hpp" |
---|
| 11 | |
---|
| 12 | namespace xios { |
---|
| 13 | |
---|
| 14 | class CScalar; |
---|
| 15 | class CReduceScalarToScalar; |
---|
| 16 | class CReductionAlgorithm; |
---|
| 17 | |
---|
| 18 | /*! |
---|
| 19 | \class CScalarAlgorithmReduceScalar |
---|
| 20 | Reducing an scalar to a scalar |
---|
| 21 | */ |
---|
| 22 | class CScalarAlgorithmReduceScalar : public CScalarAlgorithmTransformation, public CReductionAlgorithm |
---|
| 23 | { |
---|
| 24 | public: |
---|
| 25 | CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo); |
---|
| 26 | |
---|
| 27 | virtual void apply(const std::vector<std::pair<int,double> >& localIndex, |
---|
| 28 | const double* dataInput, |
---|
| 29 | CArray<double,1>& dataOut, |
---|
| 30 | std::vector<bool>& flagInitial, |
---|
| 31 | bool ignoreMissingValue, bool firstPass); |
---|
| 32 | |
---|
| 33 | virtual void updateData(CArray<double,1>& dataOut); |
---|
| 34 | |
---|
| 35 | virtual ~CScalarAlgorithmReduceScalar(); |
---|
| 36 | |
---|
| 37 | static bool registerTrans(); |
---|
| 38 | protected: |
---|
| 39 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
| 40 | |
---|
| 41 | protected: |
---|
| 42 | CReductionAlgorithm* reduction_; |
---|
| 43 | |
---|
| 44 | private: |
---|
| 45 | |
---|
| 46 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
| 47 | CTransformation<CScalar>* transformation, |
---|
| 48 | int elementPositionInGrid, |
---|
| 49 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
| 50 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|
| 51 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
| 52 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
| 53 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|
| 54 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | } |
---|
| 58 | #endif // __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ |
---|