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

Last change on this file since 630 was 630, checked in by mhnguyen, 9 years ago

Implementing interpolation (polynomial) and correct some bugs

+) Implement interpolation (polynomial)
+) Correct some minor bugs relating to memory allocation
+) Clear some redundant codes

Test
+) On Curie
+) test_client and test_complete pass

File size: 3.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 CArray<size_t,1>& globalIndexGridDestSendToServer,
31                                std::map<size_t, std::vector<std::pair<size_t,double> > >& globaIndexWeightFromDestToSource);
32
33  /*!
34  Compute global index mapping from one element of destination grid to the corresponding element of source grid
35  */
36  virtual void computeIndexSourceMapping() = 0;
37
38protected:
39  /*!
40  Compute an array of global index from a global index on an element
41    \param[in] destGlobalIndex global index on an element of destination grid
42    \param[in] srcGlobalIndex global index(es) on an element of source grid (which are needed by one index on element destination)
43    \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)
44    \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)
45    \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s)
46    \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
47    \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
48  */
49  virtual void computeGlobalGridIndexFromGlobalIndexElement(int destGlobalIndex,
50                                                        const std::vector<int>& srcGlobalIndex,
51                                                        int elementPositionInGrid,
52                                                        const std::vector<int>& gridDestGlobalDim,
53                                                        const CArray<size_t,1>& globalIndexGridDestSendToServer,
54                                                        CArray<size_t,1>& globalIndexDestGrid,
55                                                        std::vector<std::vector<size_t> >& globalIndexSrcGrid) = 0;
56
57
58
59protected:
60  std::map<int, std::vector<int> > transformationMapping_;
61  std::map<int, std::vector<double> > transformationWeight_;
62};
63
64}
65#endif // __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__
Note: See TracBrowser for help on using the repository browser.