source: XIOS/dev/branch_openmp/src/transformation/domain_algorithm_interpolate.hpp @ 1207

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

branch merged with trunk @1200

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