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