source: XIOS/dev/branch_yushan/src/transformation/domain_algorithm_interpolate.hpp @ 1037

Last change on this file since 1037 was 1037, checked in by yushan, 7 years ago

initialize the branch

File size: 3.4 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
47private:
48  CInterpolateDomain* interpDomain_;
49  bool writeToFile_;
50
51  // class WriteNetCdf;
52  class WriteNetCdf : public CNc4DataOutput
53  {
54  public:
55    WriteNetCdf(const StdString& filename, const MPI_Comm comm);
56    int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM);
57    int addVariableWrite(const StdString& name, nc_type type,
58                         const std::vector<StdString>& dim);
59    void writeDataIndex(const CArray<int,1>& data, const StdString& name,
60                        bool collective, StdSize record,
61                        const std::vector<StdSize>* start = NULL,
62                        const std::vector<StdSize>* count = NULL);
63    void writeDataIndex(const CArray<double,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  };
68
69
70private:
71
72  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
73                                                CTransformation<CDomain>* transformation,
74                                                int elementPositionInGrid,
75                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
76                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
77                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
78                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
79                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
80                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
81};
82
83}
84#endif // __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
Note: See TracBrowser for help on using the repository browser.