source: XIOS/dev/dev_olga/src/transformation/scalar_algorithm_reduce_scalar.hpp @ 1620

Last change on this file since 1620 was 1314, checked in by ymipsl, 3 years ago

Add 2 new spatial transformations :

  • reduce_scalar_to_scalar : global reduction between scalar
  • duplicate_scalar_to_axis : a scalar value is duplicated on each level of the axis.

YM

File size: 2.1 KB
Line 
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
11namespace xios {
12
13class CScalar;
14class CReduceScalarToScalar;
15class CReductionAlgorithm;
16
17/*!
18  \class CScalarAlgorithmReduceScalar
19  Reducing an scalar to a scalar
20*/
21class CScalarAlgorithmReduceScalar : public CScalarAlgorithmTransformation
22{
23public:
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();
37protected:
38  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
39
40protected:
41  CReductionAlgorithm* reduction_;
42
43private:
44
45  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
46                                                CTransformation<CScalar>* transformation,
47                                                int elementPositionInGrid,
48                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
49                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
50                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
51                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
52                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
53                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
54};
55
56}
57#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_SCALAR_HPP__
Note: See TracBrowser for help on using the repository browser.