source:XIOS/dev/XIOS_DEV_CMIP6/src/transformation/axis_algorithm_reduce_axis.hpp

Last change on this file 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.2 KB
Line
1/*!
2   \file axis_algorithm_reduce_axis.hpp
3   \author Ha NGUYEN
4   \since 23 June 2016
5   \date 23 June 2016
6
7   \brief Algorithm for reduce an axis to a axis
8 */
9#ifndef __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__
10#define __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__
11
12#include "axis_algorithm_transformation.hpp"
13#include "transformation.hpp"
14
15namespace xios {
16
17class CAxis;
18class CReduceAxisToAxis;
19class CReductionAlgorithm;
20
21/*!
22  \class CAxisAlgorithmReduceAxis
23  Reduce a axis to an axis
24*/
25class CAxisAlgorithmReduceAxis : public CAxisAlgorithmTransformation
26{
27public:
28  CAxisAlgorithmReduceAxis(CAxis* axisDestination, CAxis* axisSource, CReduceAxisToAxis* algo);
29
30  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
31                     const double* dataInput,
32                     CArray<double,1>& dataOut,
33                     std::vector<bool>& flagInitial,
34                     bool ignoreMissingValue, bool firstPass);
35
36  virtual void updateData(CArray<double,1>& dataOut);
37
38  virtual ~CAxisAlgorithmReduceAxis();
39
40  static bool registerTrans();
41protected:
42
43protected:
44  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
45
46protected:
47  CReductionAlgorithm* reduction_;
48
49private:
50  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
51                                                CTransformation<CAxis>* transformation,
52                                                int elementPositionInGrid,
53                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
54                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
55                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
56                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
57                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
58                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
59};
60
61}
62#endif // __XIOS_AXIS_ALGORITHM_REDUCE_AXIS_HPP__
Note: See TracBrowser for help on using the repository browser.