source: XIOS/trunk/src/transformation/domain_algorithm_interpolate.hpp @ 1960

Last change on this file since 1960 was 1704, checked in by yushan, 5 years ago

Introducing the new graph functionality. Attribute build_workflow_graph=.TRUE. is used in the field definition section in the xml file to enable the workflow graph of the field and other fields referecing to it. A more detailed document will be available soon on the graph fuctionality.

File size: 4.1 KB
RevLine 
[689]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"
[933]13#include "transformation.hpp"
[1021]14#include "nc4_data_output.hpp"
[689]15
16namespace xios {
[933]17
18class CDomain;
19class CInterpolateDomain;
20
[1021]21
[689]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
[1264]33  virtual void apply(const std::vector<std::pair<int,double> >& localIndex,
34                     const double* dataInput,
35                     CArray<double,1>& dataOut,
36                     std::vector<bool>& flagInitial,                     
37                     bool ignoreMissingValue, bool firstPass);
38  virtual void updateData(CArray<double,1>& dataOut);
39
[933]40  static bool registerTrans();
[1704]41
42  virtual StdString getName() {return "Domain Trans. Filter \\n Interpolation";}
43
[827]44protected:
45  void computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs);
[689]46
47private:
48  void readInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
[1021]49  void writeInterpolationInfo(std::string& filename, std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
[743]50  void processPole(std::map<int,std::vector<std::pair<int,double> > >& interMapValuePole,
51                   int nbGlobalPointOnPole);
[689]52  void computeRemap();
53  void readRemapInfo();
[1021]54  void writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >&);
[856]55  void exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
[1173]56  void convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue);
[1021]57
[689]58private:
[1264]59  CArray<double,1> renormalizationFactor ;
[1480]60  CArray<bool,1> allMissing ;
[1264]61  bool detectMissingValue ;
62  bool renormalize ;
63  bool quantity ;
64 
[689]65  CInterpolateDomain* interpDomain_;
[1021]66  bool writeToFile_;
67  bool readFromFile_;
68  StdString fileToReadWrite_;
[1269]69  bool fortranConvention ;
[689]70
[1021]71  // class WriteNetCdf;
72  class WriteNetCdf : public CNc4DataOutput
73  {
74  public:
[1641]75    WriteNetCdf(const StdString& filename, const MPI_Comm comm);
[1021]76    int addDimensionWrite(const StdString& name, const StdSize size = UNLIMITED_DIM);
77    int addVariableWrite(const StdString& name, nc_type type,
78                         const std::vector<StdString>& dim);
[1158]79    void endDefinition();
[1021]80    void writeDataIndex(const CArray<int,1>& data, const StdString& name,
81                        bool collective, StdSize record,
82                        const std::vector<StdSize>* start = NULL,
83                        const std::vector<StdSize>* count = NULL);
84    void writeDataIndex(const CArray<double,1>& data, const StdString& name,
85                        bool collective, StdSize record,
86                        const std::vector<StdSize>* start = NULL,
87                        const std::vector<StdSize>* count = NULL);
88  };
89
90
[933]91private:
92
93  static CGenericAlgorithmTransformation* create(CGrid* gridDst, CGrid* gridSrc,
94                                                CTransformation<CDomain>* transformation,
95                                                int elementPositionInGrid,
96                                                std::map<int, int>& elementPositionInGridSrc2ScalarPosition,
97                                                std::map<int, int>& elementPositionInGridSrc2AxisPosition,
98                                                std::map<int, int>& elementPositionInGridSrc2DomainPosition,
99                                                std::map<int, int>& elementPositionInGridDst2ScalarPosition,
100                                                std::map<int, int>& elementPositionInGridDst2AxisPosition,
101                                                std::map<int, int>& elementPositionInGridDst2DomainPosition);
[689]102};
103
104}
105#endif // __XIOS_DOMAIN_ALGORITHM_INTERPOLATE_HPP__
Note: See TracBrowser for help on using the repository browser.