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

Last change on this file since 2179 was 2179, checked in by ymipsl, 3 years ago

Improve performance of CGridRemoteConnector when grid source and/or destination are non distributed.

YM

  • Property svn:executable set to *
File size: 3.3 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<CLocalView*>& srcView, vector<CDistributedView*>& dstView, MPI_Comm localComm, int remoteSize) ;
21      CGridRemoteConnector(vector<CLocalView*>& srcView, vector<CLocalView*>& dstView, MPI_Comm localComm, int remoteSize) ;
22      void computeViewDistribution(void) ;
23      void computeConnector(void) ;
24      void computeGenericMethod(vector<CLocalView*>& srcView, vector<CDistributedView*>& dstView, vector<int>& indElements) ;
25      void computeSrcDstNonDistributed(int i, map<int,bool>& ranks) ;
26      void computeDstNonDistributed(int i, map<int,bool>& ranks) ;
27      void computeSrcNonDistributed(int i) ;
28      void removeRedondantRanks(void) ;
29      std::map<int, CArray<size_t,1>>& getDistributedGlobalIndex(int pos) { return elements_[pos] ;} 
30
31    private:
32 
33    /**
34     * Source views composing the source grid. The vector store an internal copy of pointer elements composing the grid.
35     * It is feed at construction time
36     */
37      vector<CLocalView*> srcView_ ;
38
39    /**
40     * Destination views composing the source grid. The vector store an internal copy of pointer elements composing the grid
41     * It is feed at construction time
42     */
43      vector<CDistributedView*> dstView_ ;
44
45    /** 
46     * 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
47     * specify a list of global indices to send to each rank of the remote view.
48     * size of element_[] -> number of elements composing the grids (source/destination)
49     * 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
50     * The is computed when calling computeConnector internal methods
51     * map can be returned trough the public accessor : getDistributedGlobalIndex(int)
52     */
53      vector<map<int, CArray<size_t,1>>> elements_ ;
54   
55      /**
56      /* internal copy of the local communicator (client workflow). Feed at construction time.
57       */
58      MPI_Comm localComm_ ;
59
60      /**
61      /* size of the remote communicator (== nb of servers). Feed at consctruction time
62       */
63      int remoteSize_ ;
64
65      /**
66      /* for each view composing the source grid, the vector store the information about the distribution of the element, i.e.
67       * if each ranks of the local view has exactly the same global indices than each other. This is computed when calling 
68       * \b computeViewDistribution method. 
69       */
70      vector<bool> isSrcViewDistributed_ ;
71
72     /**
73      /* for each view composing the destination grid, the vector store the information about the distribution of the element, i.e.
74       * if each ranks of the remote view has exactly the same global indices than each other. This is computed when calling 
75       * \b computeViewDistribution method.
76       */
77      vector<bool> isDstViewDistributed_ ;
78     
79   
80  } ;
81
82}
83
84#endif
Note: See TracBrowser for help on using the repository browser.