1 | /*! |
---|
2 | \file scalar_algorithm_reduce_scalar.hpp |
---|
3 | \author Ha NGUYEN |
---|
4 | \since 13 Oct 2016 |
---|
5 | \date 13 Oct 2016 |
---|
6 | |
---|
7 | \brief Algorithm for reduce an DOMAIN to a scalar |
---|
8 | */ |
---|
9 | #ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__ |
---|
10 | #define __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__ |
---|
11 | |
---|
12 | #include "scalar_algorithm_transformation.hpp" |
---|
13 | #include "transformation.hpp" |
---|
14 | #include "reduction.hpp" |
---|
15 | |
---|
16 | namespace xios { |
---|
17 | |
---|
18 | class CScalar; |
---|
19 | class CDomain; |
---|
20 | class CReduceDomainToScalar; |
---|
21 | class CReductionAlgorithm; |
---|
22 | |
---|
23 | /*! |
---|
24 | \class CScalarAlgorithmReduceDomain |
---|
25 | Reducing an DOMAIN to a scalar |
---|
26 | */ |
---|
27 | class CScalarAlgorithmReduceDomain : public CScalarAlgorithmTransformation, public CReductionAlgorithm |
---|
28 | { |
---|
29 | public: |
---|
30 | CScalarAlgorithmReduceDomain(CScalar* scalarDestination, CDomain* domainSource, CReduceDomainToScalar* algo); |
---|
31 | |
---|
32 | virtual void apply(const std::vector<std::pair<int,double> >& localIndex, |
---|
33 | const double* dataInput, |
---|
34 | CArray<double,1>& dataOut, |
---|
35 | std::vector<bool>& flagInitial, |
---|
36 | bool ignoreMissingValue, bool firstPass); |
---|
37 | |
---|
38 | virtual void updateData(CArray<double,1>& dataOut); |
---|
39 | |
---|
40 | virtual ~CScalarAlgorithmReduceDomain(); |
---|
41 | |
---|
42 | static bool registerTrans(); |
---|
43 | |
---|
44 | virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Domain";} |
---|
45 | |
---|
46 | protected: |
---|
47 | bool local ; |
---|
48 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
49 | |
---|
50 | protected: |
---|
51 | CReductionAlgorithm* reduction_; |
---|
52 | |
---|
53 | private: |
---|
54 | |
---|
55 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
56 | CTransformation<CScalar>* transformation, |
---|
57 | int elementPositionInGrid, |
---|
58 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
59 | std::map<int, int>& elementPositionInGridSrc2DOMAINPosition, |
---|
60 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
61 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
62 | std::map<int, int>& elementPositionInGridDst2DOMAINPosition, |
---|
63 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
64 | }; |
---|
65 | |
---|
66 | } |
---|
67 | #endif // __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__ |
---|