source: XIOS/trunk/src/transformation/scalar_algorithm_reduce_axis.hpp @ 933

Last change on this file since 933 was 933, checked in by mhnguyen, 8 years ago

Improving transformation selection. Instead of modifying directly grid_transformation
we only need to register a new transformation with the framework

+) Update all transformations with this new method

Test
+) On Curie
+) Basic tests pass

File size: 2.1 KB
Line 
1/*!
2   \file scalar_algorithm_reduce_scalar.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 scalar
8 */
9#ifndef __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__
10#define __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__
11
12#include "scalar_algorithm_transformation.hpp"
13#include "transformation.hpp"
14
15namespace xios {
16
17class CScalar;
18class CAxis;
19class CReduceAxisToScalar;
20class CReductionAlgorithm;
21
22/*!
23  \class CScalarAlgorithmReduceScalar
24  Reducing an axis to a scalar
25*/
26class CScalarAlgorithmReduceScalar : public CScalarAlgorithmTransformation
27{
28public:
29  CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CAxis* axisSource, CReduceAxisToScalar* algo);
30
31  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
32                     const double* dataInput,
33                     CArray<double,1>& dataOut,
34                     std::vector<bool>& flagInitial,
35                     const double& defaultValue);
36
37  virtual ~CScalarAlgorithmReduceScalar();
38
39  static bool registerTrans();
40protected:
41  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
42
43protected:
44  CReductionAlgorithm* reduction_;
45
46private:
47
48  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
49                                                CTransformation<CScalar>* transformation,
50                                                int elementPositionInGrid,
51                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
52                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
53                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
54                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
55                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
56                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
57};
58
59}
60#endif // __XIOS_SCALAR_ALGORITHM_REDUCE_AXIS_HPP__
Note: See TracBrowser for help on using the repository browser.