[631] | 1 | /*! |
---|
| 2 | \file domain_algorithm_transformation.hpp |
---|
| 3 | \author Ha NGUYEN |
---|
| 4 | \since 02 Jul 2015 |
---|
| 5 | \date 02 Jul 2015 |
---|
| 6 | |
---|
| 7 | \brief Interface for all domain transformation algorithms. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include "domain_algorithm_transformation.hpp" |
---|
[862] | 11 | #include "context.hpp" |
---|
| 12 | #include "context_client.hpp" |
---|
[866] | 13 | #include "domain.hpp" |
---|
[631] | 14 | |
---|
| 15 | namespace xios { |
---|
| 16 | |
---|
| 17 | CDomainAlgorithmTransformation::CDomainAlgorithmTransformation(CDomain* domainDestination, CDomain* domainSource) |
---|
| 18 | : CGenericAlgorithmTransformation(), domainDest_(domainDestination), domainSrc_(domainSource) |
---|
| 19 | { |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | CDomainAlgorithmTransformation::~CDomainAlgorithmTransformation() |
---|
| 23 | { |
---|
| 24 | } |
---|
| 25 | |
---|
[827] | 26 | void CDomainAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) |
---|
[631] | 27 | { |
---|
| 28 | } |
---|
| 29 | |
---|
[867] | 30 | /*! |
---|
| 31 | Compute global index of domain on different processes |
---|
| 32 | \param [in] globalDomainIndex global index of domain source |
---|
| 33 | \param [out] globalDomainIndexOnProc processes which contain the corresponding global index of domain source |
---|
| 34 | */ |
---|
[862] | 35 | void CDomainAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalDomainIndex, |
---|
[888] | 36 | int elementType, |
---|
[866] | 37 | CClientClientDHTInt::Index2VectorInfoTypeMap& globalDomainIndexOnProc) |
---|
[1642] | 38 | TRY |
---|
[862] | 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; |
---|
| 49 | CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; |
---|
| 50 | globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); |
---|
[1460] | 51 | CArray<bool,1>& localMask=domainSrc_->localMask ; |
---|
[862] | 52 | for (int idx = 0; idx < nIndexSize; ++idx) |
---|
| 53 | { |
---|
[1460] | 54 | if (localMask(idx)) |
---|
| 55 | { |
---|
| 56 | i_ind=domainSrc_->i_index(idx) ; |
---|
| 57 | j_ind=domainSrc_->j_index(idx) ; |
---|
[862] | 58 | |
---|
[1460] | 59 | globalIndex = i_ind + j_ind * niGlob; |
---|
| 60 | globalIndex2ProcRank[globalIndex].push_back(clientRank); |
---|
| 61 | } |
---|
[862] | 62 | } |
---|
| 63 | |
---|
| 64 | CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); |
---|
| 65 | dhtIndexProcRank.computeIndexInfoMapping(globalDomainIndex); |
---|
[866] | 66 | globalDomainIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); |
---|
[862] | 67 | } |
---|
[1642] | 68 | CATCH |
---|
[862] | 69 | |
---|
[631] | 70 | } |
---|