source: XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.hpp @ 1173

Last change on this file since 1173 was 1173, checked in by mhnguyen, 4 years ago

Fixing bug: Overlapped domains behave incorrectly

+) If local domains are overlapping on client, the re-constructed domain on server must take care of this overlapped region

Test
+) On Curie
+) test_client, test_complete work
+) Need to test with models

File size: 3.5 KB
Line 
1/*!
2   \file domain_algorithm_interpolate_from_file.hpp
3   \author Ha NGUYEN
4   \since 09 July 2015
5   \date 09 Sep 2015
6
7   \brief Algorithm for interpolation on a domain.
8 */
9#ifndef __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
10#define __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
11
12#include "domain_algorithm_transformation.hpp"
13#include "transformation.hpp"
14#include "nc4_data_output.hpp"
15
16namespace xios {
17
18class CDomain;
19class CInterpolateDomain;
20
21
22/*!
23  \class CDomainAlgorithmInterpolate
24  Reading interpolation from file then apply on a domain
25*/
26class CDomainAlgorithmInterpolate : public CDomainAlgorithmTransformation
27{
28public:
29  CDomainAlgorithmInterpolate(CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain);
30
31  virtual ~CDomainAlgorithmInterpolate() {}
32
33  static bool registerTrans();
34protected:
35  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
36
37private:
38  void readInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
39  void writeInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
40  void processPole(std::map<int,std::vector<std::pair<int,double> > >& interMapValuePole,
41                   int nbGlobalPointOnPole);
42  void computeRemap();
43  void readRemapInfo();
44  void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&);
45  void exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
46  void convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
47
48private:
49  CInterpolateDomain* interpDomain_;
50  bool writeToFile_;
51  bool readFromFile_;
52  StdString fileToReadWrite_;
53
54  // class WriteNetCdf;
55  class WriteNetCdf : public CNc4DataOutput
56  {
57  public:
58    WriteNetCdf(const StdString& filename, const MPI_Comm comm);
59    int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM);
60    int addVariableWrite(const StdString& name, nc_type type,
61                         const std::vector<StdString>& dim);
62    void endDefinition();
63    void writeDataIndex(const CArray<int,1>& data, const StdString& name,
64                        bool collective, StdSize record,
65                        const std::vector<StdSize>* start = NULL,
66                        const std::vector<StdSize>* count = NULL);
67    void writeDataIndex(const CArray<double,1>& data, const StdString& name,
68                        bool collective, StdSize record,
69                        const std::vector<StdSize>* start = NULL,
70                        const std::vector<StdSize>* count = NULL);
71  };
72
73
74private:
75
76  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
77                                                CTransformation<CDomain>* transformation,
78                                                int elementPositionInGrid,
79                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
80                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
81                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
82                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
83                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
84                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
85};
86
87}
88#endif // __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
Note: See TracBrowser for help on using the repository browser.