#include "scatterer_connector.hpp" namespace xios { void CScattererConnector::computeConnector(void) { auto& srcGlobalIndex = srcView_->getGlobalIndex() ; auto& srcIndex = srcView_->getIndex() ; srcSize_=srcIndex.numElements() ; auto srcSize = srcView_->getSize() ; auto srcLocalSize = srcView_->getLocalSize() ; auto& dstIndex = dstView_->getIndex() ; for(auto& rankIndex : dstIndex) dstSize_[rankIndex.first]=rankIndex.second.numElements() ; auto& dstGlobalIndex = dstView_->getGlobalIndex() ; unordered_map mapGlobalLocalIndex ; int globalIndexSize=srcGlobalIndex.size() ; for(int i=0 ; i=0 && srcIndex(i) = 0 && index(i) < localSize) { const auto& it = mapGlobalLocalIndex.find(globalIndex(index(i))) ; if (it != mapGlobalLocalIndex.end()) { connector.push_back(it->second) ; mask[i] = true ; } else mask[i]=false ; } else mask[i]=false ; } } // compute the number of senders for a remote destination view int commSize ; MPI_Comm_size(localComm_, &commSize) ; vector ranks(commSize,0) ; for(auto& rank : connector_) ranks[rank.first] = 1 ; MPI_Allreduce(MPI_IN_PLACE,ranks.data(),commSize,MPI_INT,MPI_SUM,localComm_) ; for(auto& rank : connector_) nbSenders_[rank.first] = ranks[rank.first] ; } }