[960] | 1 | /*! |
---|
| 2 | \file scalar_algorithm_extract_scalar.hpp |
---|
| 3 | \author Ha NGUYEN |
---|
| 4 | \since 23 June 2016 |
---|
| 5 | \date 23 June 2016 |
---|
| 6 | |
---|
| 7 | \brief Algorithm for extract an axis to a scalar |
---|
| 8 | */ |
---|
| 9 | #ifndef __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__ |
---|
| 10 | #define __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__ |
---|
| 11 | |
---|
| 12 | #include "scalar_algorithm_transformation.hpp" |
---|
| 13 | #include "transformation.hpp" |
---|
[1601] | 14 | #include "reduction.hpp" |
---|
[960] | 15 | |
---|
| 16 | namespace xios { |
---|
| 17 | |
---|
| 18 | class CScalar; |
---|
| 19 | class CAxis; |
---|
| 20 | class CExtractAxisToScalar; |
---|
| 21 | class CReductionAlgorithm; |
---|
| 22 | |
---|
| 23 | /*! |
---|
[980] | 24 | \class CScalarAlgorithmExtractAxis |
---|
[960] | 25 | Extract a scalar from an axis |
---|
| 26 | */ |
---|
[1601] | 27 | class CScalarAlgorithmExtractAxis : public CScalarAlgorithmTransformation, public CReductionAlgorithm |
---|
[960] | 28 | { |
---|
| 29 | public: |
---|
[980] | 30 | CScalarAlgorithmExtractAxis(CScalar* scalarDestination, CAxis* axisSource, CExtractAxisToScalar* algo); |
---|
[960] | 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); |
---|
[960] | 37 | |
---|
[980] | 38 | virtual ~CScalarAlgorithmExtractAxis(); |
---|
[960] | 39 | |
---|
| 40 | static bool registerTrans(); |
---|
| 41 | |
---|
[1680] | 42 | virtual StdString getName() {return "Scalar Trans. Filter \\n Extract Axis";} |
---|
| 43 | |
---|
[960] | 44 | protected: |
---|
| 45 | int pos_; |
---|
| 46 | |
---|
| 47 | protected: |
---|
| 48 | void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs); |
---|
| 49 | |
---|
| 50 | protected: |
---|
| 51 | CReductionAlgorithm* reduction_; |
---|
| 52 | |
---|
| 53 | private: |
---|
| 54 | static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc, |
---|
| 55 | CTransformation<CScalar>* transformation, |
---|
| 56 | int elementPositionInGrid, |
---|
| 57 | std::map<int, int>& elementPositionInGridSrc2ScalarPosition, |
---|
| 58 | std::map<int, int>& elementPositionInGridSrc2AxisPosition, |
---|
| 59 | std::map<int, int>& elementPositionInGridSrc2DomainPosition, |
---|
| 60 | std::map<int, int>& elementPositionInGridDst2ScalarPosition, |
---|
| 61 | std::map<int, int>& elementPositionInGridDst2AxisPosition, |
---|
| 62 | std::map<int, int>& elementPositionInGridDst2DomainPosition); |
---|
| 63 | }; |
---|
| 64 | |
---|
| 65 | } |
---|
| 66 | #endif // __XIOS_SCALAR_ALGORITHM_EXTRACT_AXIS_HPP__ |
---|