source: XIOS/trunk/src/transformation/generic_algorithm_transformation.hpp @ 827

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

Implementing dynamic interpolation on axis

+) Change grid transformation to make it more flexible
+) Make some small improvements

Test
+) On Curie
+) All test pass

File size: 4.1 KB
Line 
1/*!
2   \file generic_algorithm_transformation.hpp
3   \author Ha NGUYEN
4   \since 14 May 2015
5   \date 29 June 2015
6
7   \brief Interface for all transformation algorithms.
8 */
9#ifndef __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__
10#define __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__
11
12#include <map>
13#include <set>
14#include "array_new.hpp"
15
16namespace xios {
17  /*!
18  \class CGenericAlgorithmTransformation
19  This class defines the interface for all other inherted algorithms class
20  */
21class CGenericAlgorithmTransformation
22{
23public:
24  CGenericAlgorithmTransformation();
25
26  virtual ~CGenericAlgorithmTransformation() {}
27
28  void computeGlobalSourceIndex(int elementPositionInGrid,
29                                const std::vector<int>& gridDestGlobalDim,
30                                const std::vector<int>& gridSrcGlobalDim,
31                                const std::vector<size_t>& globalIndexGridDestSendToServer,
32                                std::map<size_t, std::vector<std::pair<size_t,double> > >& globaIndexWeightFromDestToSource);
33
34  std::vector<StdString> getIdAuxInputs();
35
36  /*!
37  Compute global index mapping from one element of destination grid to the corresponding element of source grid
38  */
39  void computeIndexSourceMapping(const std::vector<CArray<double,1>* >& dataAuxInputs = std::vector<CArray<double,1>* >());
40
41protected:
42  /*!
43  Compute an array of global index from a global index on an element
44    \param[in] destGlobalIndex global index on an element of destination grid
45    \param[in] srcGlobalIndex global index(es) on an element of source grid (which are needed by one index on element destination)
46    \param[in] elementPositionInGrid position of the element in the grid (for example: a grid with one domain and one axis, position of domain is 1, position of axis is 2)
47    \param[in] gridDestGlobalDim dimension size of destination grid (it should share the same size for all dimension, maybe except the element on which transformation is performed)
48    \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s), this array is already acsending sorted
49    \param[in/out] globalIndexDestGrid array of global index (for 2d grid, this array maybe a line, for 3d, this array may represent a plan). It should be preallocated
50    \param[in/out] globalIndexSrcGrid array of global index of source grid (for 2d grid, this array is a line, for 3d, this array represents a plan). It should be preallocated
51  */
52  virtual void computeGlobalGridIndexFromGlobalIndexElement(int destGlobalIndex,
53                                                        const std::vector<int>& srcGlobalIndex,
54                                                        const std::vector<int>& destGlobalIndexPositionInGrid,
55                                                        int elementPositionInGrid,
56                                                        const std::vector<int>& gridDestGlobalDim,
57                                                        const std::vector<int>& gridSrcGlobalDim,
58                                                        const std::vector<size_t>& globalIndexGridDestSendToServer,
59                                                        CArray<size_t,1>& globalIndexDestGrid,
60                                                        std::vector<std::vector<size_t> >& globalIndexSrcGrid) = 0;
61
62  virtual void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >&) = 0;
63
64protected:
65  //! Map between global index of destination element and source element
66  std::vector<std::map<int, std::vector<int> > > transformationMapping_;
67  //! Weight corresponding of source to destination
68  std::vector<std::map<int, std::vector<double> > > transformationWeight_;
69  //! Map of global index of destination element and corresponding global index of other elements in the same grid
70  //! By default, one index of an element corresponds to all index of remaining element in the grid. So it's empty
71  std::vector<std::map<int, std::vector<int> > > transformationPosition_;
72
73  //! Id of auxillary inputs which help doing transformation dynamically
74  std::vector<StdString> idAuxInputs_;
75};
76
77}
78#endif // __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__
Note: See TracBrowser for help on using the repository browser.