XIOS  1.0
Xml I/O Server
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros
domain_algorithm_transformation.cpp
Aller à la documentation de ce fichier.
1 
11 #include "context.hpp"
12 #include "context_client.hpp"
13 #include "domain.hpp"
14 
15 namespace xios {
16 
18  : CGenericAlgorithmTransformation(), domainDest_(domainDestination), domainSrc_(domainSource)
19 {
20 }
21 
23 {
24 }
25 
27 {
28 }
29 
36  int elementType,
37  CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc)
38 TRY
39 {
40  CContext* context = CContext::getCurrent();
41  CContextClient* client=context->client;
42  int clientRank = client->clientRank;
43  int clientSize = client->clientSize;
44 
45  int niGlob = domainSrc_->ni_glo.getValue();
46  int njGlob = domainSrc_->nj_glo.getValue();
47  size_t globalIndex;
48  int nIndexSize = domainSrc_->i_index.numElements(), i_ind, j_ind;
50  globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor()));
51  CArray<bool,1>& localMask=domainSrc_->localMask ;
52  for (int idx = 0; idx < nIndexSize; ++idx)
53  {
54  if (localMask(idx))
55  {
56  i_ind=domainSrc_->i_index(idx) ;
57  j_ind=domainSrc_->j_index(idx) ;
58 
59  globalIndex = i_ind + j_ind * niGlob;
60  globalIndex2ProcRank[globalIndex].push_back(clientRank);
61  }
62  }
63 
64  CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm);
65  dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex);
66  globalDomainIndexOnProc = dhtIndexProcRank.getInfoIndexMap();
67 }
68 CATCH
69 
70 }
MPI_Comm intraComm
Communicator of client group.
#define TRY
Definition: exception.hpp:154
int clientSize
Size of client group.
virtual void computeExchangeGlobalIndex(const CArray< size_t, 1 > &globalDomainIndex, int elementType, CClientClientDHTInt::Index2VectorInfoTypeMap &globalDomainIndexOnProc)
Compute global index of domain on different processes.
This class provides the similar features like.
#define xios(arg)
A context can be both on client and on server side.
This class defines the interface for all other inherited algorithms class.
int clientRank
Rank of current client.
std::unordered_map< size_t, std::vector< InfoType > > Index2VectorInfoTypeMap
CDomainAlgorithmTransformation(CDomain *domainDestination, CDomain *domainSource)
void computeIndexSourceMapping_(const std::vector< CArray< double, 1 > * > &)
Interface for all domain transformation algorithms.
const Index2VectorInfoTypeMap & getInfoIndexMap() const
#define CATCH
Definition: exception.hpp:155
void computeIndexInfoMapping(const CArray< size_t, 1 > &indices)
Compute mapping between indices and information corresponding to these indices.
static CContext * getCurrent(void)
Get current context.
Definition: context.cpp:2018
CContextClient * client
Concrete contex client.
Definition: context.hpp:251