[976] | 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" |
---|
[1601] | 14 | #include "reduction.hpp" |
---|
[976] | 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 | */ |
---|
[1601] | 27 | class CScalarAlgorithmReduceDomain : public CScalarAlgorithmTransformation, public CReductionAlgorithm |
---|
[976] | 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, |
---|
[1158] | 35 | std::vector<bool>& flagInitial, |
---|
[1260] | 36 | bool ignoreMissingValue, bool firstPass); |
---|
[976] | 37 | |
---|
[979] | 38 | virtual void updateData(CArray<double,1>& dataOut); |
---|
| 39 | |
---|
[976] | 40 | virtual ~CScalarAlgorithmReduceDomain(); |
---|
| 41 | |
---|
| 42 | static bool registerTrans(); |
---|
[1680] | 43 | |
---|
| 44 | virtual StdString getName() {return "Scalar Trans. Filter \\n Reduce Domain";} |
---|
| 45 | |
---|
[976] | 46 | protected: |
---|
[1313] | 47 | bool local ; |
---|
[976] | 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__ |
---|