1 | /*! |
---|
2 | \file axis_algorithm_transformation.hpp |
---|
3 | \author Ha NGUYEN |
---|
4 | \since 14 May 2015 |
---|
5 | \date 29 June 2015 |
---|
6 | |
---|
7 | \brief Interface for all axis transformation algorithms. |
---|
8 | */ |
---|
9 | |
---|
10 | #include "axis_algorithm_transformation.hpp" |
---|
11 | #include "axis_algorithm_inverse.hpp" |
---|
12 | #include "axis_algorithm_zoom.hpp" |
---|
13 | #include "context.hpp" |
---|
14 | #include "context_client.hpp" |
---|
15 | #include "client_client_dht_template.hpp" |
---|
16 | #include "axis.hpp" |
---|
17 | |
---|
18 | namespace xios { |
---|
19 | |
---|
20 | CAxisAlgorithmTransformation::CAxisAlgorithmTransformation(CAxis* axisDestination, CAxis* axisSource) |
---|
21 | : CGenericAlgorithmTransformation(), axisDest_(axisDestination), axisSrc_(axisSource) |
---|
22 | { |
---|
23 | axisDestGlobalSize_ = axisDestination->n_glo.getValue(); |
---|
24 | int niDest = axisDestination->n.getValue(); |
---|
25 | int ibeginDest = axisDestination->begin.getValue(); |
---|
26 | |
---|
27 | for (int idx = 0; idx < niDest; ++idx) |
---|
28 | if ((axisDestination->mask)(idx)) axisDestGlobalIndex_.push_back(ibeginDest+idx); |
---|
29 | } |
---|
30 | |
---|
31 | CAxisAlgorithmTransformation::~CAxisAlgorithmTransformation() |
---|
32 | { |
---|
33 | } |
---|
34 | |
---|
35 | void CAxisAlgorithmTransformation::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) |
---|
36 | { |
---|
37 | } |
---|
38 | |
---|
39 | /*! |
---|
40 | Compute global index of axis on different processes |
---|
41 | \param [in] globalAxisIndex global index of axis source |
---|
42 | \param [out] globalAxisIndexOnProc processes which contain the corresponding global index of axis source |
---|
43 | */ |
---|
44 | void CAxisAlgorithmTransformation::computeExchangeGlobalIndex(const CArray<size_t,1>& globalAxisIndex, |
---|
45 | int elementType, |
---|
46 | CClientClientDHTInt::Index2VectorInfoTypeMap& globalAxisIndexOnProc) |
---|
47 | { |
---|
48 | CContext* context = CContext::getCurrent(); |
---|
49 | CContextClient* client=context->client; |
---|
50 | int clientRank = client->clientRank; |
---|
51 | int clientSize = client->clientSize; |
---|
52 | |
---|
53 | |
---|
54 | size_t globalIndex; |
---|
55 | int nIndexSize = axisSrc_->index.numElements(); |
---|
56 | CClientClientDHTInt::Index2VectorInfoTypeMap globalIndex2ProcRank; |
---|
57 | globalIndex2ProcRank.rehash(std::ceil(nIndexSize/globalIndex2ProcRank.max_load_factor())); |
---|
58 | for (int idx = 0; idx < nIndexSize; ++idx) |
---|
59 | { |
---|
60 | globalIndex = axisSrc_->index(idx); |
---|
61 | globalIndex2ProcRank[globalIndex].resize(1); |
---|
62 | globalIndex2ProcRank[globalIndex][0] = clientRank; |
---|
63 | } |
---|
64 | |
---|
65 | CClientClientDHTInt dhtIndexProcRank(globalIndex2ProcRank, client->intraComm); |
---|
66 | dhtIndexProcRank.computeIndexInfoMapping(globalAxisIndex); |
---|
67 | |
---|
68 | globalAxisIndexOnProc = dhtIndexProcRank.getInfoIndexMap(); |
---|
69 | } |
---|
70 | |
---|
71 | } |
---|