1 | #ifndef __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ |
---|
2 | #define __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ |
---|
3 | |
---|
4 | #include <map> |
---|
5 | #include <vector> |
---|
6 | #include "array_new.hpp" |
---|
7 | |
---|
8 | namespace xios { |
---|
9 | |
---|
10 | class CGenericAlgorithmTransformation |
---|
11 | { |
---|
12 | public: |
---|
13 | CGenericAlgorithmTransformation(); |
---|
14 | |
---|
15 | virtual ~CGenericAlgorithmTransformation() {} |
---|
16 | |
---|
17 | void computeGlobalSourceIndex(int elementPositionInGrid, |
---|
18 | const std::vector<int>& gridDestGlobalDim, |
---|
19 | const CArray<size_t,1>& globalIndexGridDestSendToServer, |
---|
20 | std::map<size_t, std::set<size_t> >& globaIndexMapFromDestToSource); |
---|
21 | |
---|
22 | /*! |
---|
23 | Compute global index mapping from one element of destination grid to the corresponding element of source grid |
---|
24 | */ |
---|
25 | virtual void computeIndexSourceMapping() = 0; |
---|
26 | |
---|
27 | protected: |
---|
28 | /*! |
---|
29 | Compute an array of global index from a global index on an element |
---|
30 | \param[in] destGlobalIndex global index on an element of destination grid |
---|
31 | \param[in] srcGlobalIndex global index(es) on an element of source grid (which are needed by one index on element destination) |
---|
32 | \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) |
---|
33 | \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) |
---|
34 | \param[in] globalIndexGridDestSendToServer global index of destination grid which are to be sent to server(s) |
---|
35 | \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 |
---|
36 | \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 |
---|
37 | */ |
---|
38 | virtual void computeGlobalIndexFromGlobalIndexElement(int destGlobalIndex, |
---|
39 | const std::vector<int>& srcGlobalIndex, |
---|
40 | int elementPositionInGrid, |
---|
41 | const std::vector<int>& gridDestGlobalDim, |
---|
42 | const CArray<size_t,1>& globalIndexGridDestSendToServer, |
---|
43 | CArray<size_t,1>& globalIndexDestGrid, |
---|
44 | std::vector<CArray<size_t,1> >& globalIndexSrcGrid) = 0; |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | protected: |
---|
49 | std::map<int, std::vector<int> > transformationMapping_; |
---|
50 | }; |
---|
51 | |
---|
52 | } |
---|
53 | #endif // __XIOS_GENERIC_ALGORITHM_TRANSFORMATION_HPP__ |
---|