source: XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/grid_remote_connector.hpp @ 2291

Last change on this file since 2291 was 2291, checked in by ymipsl, 2 years ago

Improve reduction transformation

  • make the difference between reduction over geometry or reduction between process.
  • geometrical reduction :

domain -> axis
axis -> scalar
domain -> scalar

  • reduction across processes for redondant geometrical cell :

axis -> axis
scalar -> scalar

Reduction can be local (only for the geometrical cell owned by current process) or global, using the "local" attribute (bool) over the reduction.

YM

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#ifndef __GRID_REMOTE_CONNECTOR_HPP__
2#define __GRID_REMOTE_CONNECTOR_HPP__
3
4#include "xios_spl.hpp"
5#include "array_new.hpp"
6#include "mpi.hpp"
7#include "local_view.hpp"
8#include "distributed_view.hpp"
9#include "context_client.hpp"
10
11
12namespace xios
13{
14 
15  class CGridRemoteConnector
16  {
17
18    public:
19
20      CGridRemoteConnector(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CDistributedView>>& dstView, MPI_Comm localComm, int remoteSize) ;
21      CGridRemoteConnector(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CLocalView>>& dstView, MPI_Comm localComm, int remoteSize) ;
22      void computeViewDistribution(void) ;
23      void computeConnector(bool eliminateRedundant=true) ;
24      void computeConnectorMethods(void) ;
25      void computeConnectorRedundant(void) ;
26      void computeGenericMethod(vector<shared_ptr<CLocalView>>& srcView, vector<shared_ptr<CDistributedView>>& dstView, vector<int>& indElements) ;
27      void computeSrcDstNonDistributed(int i, map<int,bool>& ranks) ;
28      void computeDstNonDistributed(int i, map<int,bool>& ranks) ;
29      void computeSrcNonDistributed(int i) ;
30      void computeRedondantRanks(void) ;
31      std::map<int, CArray<size_t,1>>& getDistributedGlobalIndex(int pos) { return elements_[pos] ;} 
32      const vector<bool>& getIsSrcViewDistributed(void) { return isSrcViewDistributed_ ;}
33      const vector<bool>& getIsDstViewDistributed(void) { return isDstViewDistributed_ ;}
34      const set<int>& getRankToRemove(void) {return rankToRemove_;} 
35   
36    protected:
37 
38    /**
39     * Source views composing the source grid. The vector store an internal copy of pointer elements composing the grid.
40     * It is feed at construction time
41     */
42      vector<shared_ptr<CLocalView>> srcView_ ;
43
44    /**
45     * Destination views composing the source grid. The vector store an internal copy of pointer elements composing the grid
46     * It is feed at construction time
47     */
48      vector<shared_ptr<CDistributedView>> dstView_ ;
49
50    /** 
51     * The list of global indices to send to each rank of the remote view (servers). The vector store the information for each element, and the map
52     * specify a list of global indices to send to each rank of the remote view.
53     * size of element_[] -> number of elements composing the grids (source/destination)
54     * element[i][rank] == CArray<size_t,1> -> list of global indices  to send to the remote process of rank \b rank for the view \b i
55     * The is computed when calling computeConnector internal methods
56     * map can be returned trough the public accessor : getDistributedGlobalIndex(int)
57     */
58      vector<map<int, CArray<size_t,1>>> elements_ ;
59   
60      /**
61      /* internal copy of the local communicator (client workflow). Feed at construction time.
62       */
63      MPI_Comm localComm_ ;
64
65      /**
66      /* size of the remote communicator (== nb of servers). Feed at consctruction time
67       */
68      int remoteSize_ ;
69
70      /**
71      /* for each view composing the source grid, the vector store the information about the distribution of the element, i.e.
72       * if each ranks of the local view has exactly the same global indices than each other. This is computed when calling 
73       * \b computeViewDistribution method. 
74       */
75      vector<bool> isSrcViewDistributed_ ;
76
77     /**
78      /* for each view composing the destination grid, the vector store the information about the distribution of the element, i.e.
79       * if each ranks of the remote view has exactly the same global indices than each other. This is computed when calling 
80       * \b computeViewDistribution method.
81       */
82      vector<bool> isDstViewDistributed_ ;
83
84      /**
85      /* Redondant ranks of the \b elements_ are stored there by calling computeRedondantRanks(), to be removed latter or to be retrieve from elsewhere.
86       */
87      set<int> rankToRemove_ ;
88     
89   
90  } ;
91
92}
93
94#endif
Note: See TracBrowser for help on using the repository browser.