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 | |
---|
38 | virtual StdString getName() {return "reduce_scalar";} |
---|
39 | |
---|
40 | protected: |
---|
41 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
42 | |
---|
43 | protected: |
---|
44 | CReductionAlgorithm* reduction_; |
---|
45 | |
---|
46 | private: |
---|
47 | |
---|
48 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
49 | CTransformation<CScalar>* transformation, |
---|
50 | int elementPositionInGrid, |
---|
51 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
52 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|
53 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
54 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
55 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|
56 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
57 | }; |
---|
58 | |
---|
59 | } |
---|
60 | #endif // __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__ |
---|