[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" |
---|
| 14 | |
---|
| 15 | namespace xios { |
---|
| 16 | |
---|
| 17 | class CScalar; |
---|
| 18 | class CDomain; |
---|
| 19 | class CReduceDomainToScalar; |
---|
| 20 | class CReductionAlgorithm; |
---|
| 21 | |
---|
| 22 | /*! |
---|
| 23 | \class CScalarAlgorithmReduceDomain |
---|
| 24 | Reducing an DOMAIN to a scalar |
---|
| 25 | */ |
---|
| 26 | class CScalarAlgorithmReduceDomain : public CScalarAlgorithmTransformation |
---|
| 27 | { |
---|
| 28 | public: |
---|
| 29 | CScalarAlgorithmReduceDomain(CScalar* scalarDestination, CDomain* domainSource, CReduceDomainToScalar* algo); |
---|
| 30 | |
---|
| 31 | virtual void apply(const std::vector<std::pair<int,double> >& localIndex, |
---|
| 32 | const double* dataInput, |
---|
| 33 | CArray<double,1>& dataOut, |
---|
[1158] | 34 | std::vector<bool>& flagInitial, |
---|
[1260] | 35 | bool ignoreMissingValue, bool firstPass); |
---|
[976] | 36 | |
---|
[979] | 37 | virtual void updateData(CArray<double,1>& dataOut); |
---|
| 38 | |
---|
[976] | 39 | virtual ~CScalarAlgorithmReduceDomain(); |
---|
| 40 | |
---|
| 41 | static bool registerTrans(); |
---|
| 42 | protected: |
---|
[1313] | 43 | bool local ; |
---|
[976] | 44 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
| 45 | |
---|
| 46 | protected: |
---|
| 47 | CReductionAlgorithm* reduction_; |
---|
| 48 | |
---|
| 49 | private: |
---|
| 50 | |
---|
| 51 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
| 52 | CTransformation<CScalar>* transformation, |
---|
| 53 | int elementPositionInGrid, |
---|
| 54 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
| 55 | std::map<int, int>& elementPositionInGridSrc2DOMAINPosition, |
---|
| 56 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
| 57 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
| 58 | std::map<int, int>& elementPositionInGridDst2DOMAINPosition, |
---|
| 59 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | } |
---|
| 63 | #endif // __XIOS_SCALAR_ALGORITHM_REDUCE_DOMAIN_HPP__ |
---|