Changeset 2034 for XIOS/dev/dev_oa/src/node/grid.cpp
- Timestamp:
- 02/15/21 21:14:02 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_oa/src/node/grid.cpp
r1966 r2034 40 40 , clients() 41 41 , nTiles_(0) 42 , isTiled_(false) 42 , isTiled_(false), isTiledOnly_(false) 43 43 , storeTileIndex() 44 44 { … … 64 64 , clients() 65 65 , nTiles_(0) 66 , isTiled_(false) 66 , isTiled_(false), isTiledOnly_(false) 67 67 , storeTileIndex() 68 68 { … … 638 638 else domListP[i]->checkAttributesOnClient(); 639 639 if (domListP[i]->isTiled()) this->isTiled_ = true; 640 if (domListP[i]->isTiledOnly()) this->isTiledOnly_ = true; 640 641 } 641 642 } … … 802 803 outLocalIndexStoreOnClient.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 803 804 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient[rank]; 805 size_t nbIndex = 0; 806 807 // Keep this code for this moment but it should be removed (or moved to DEBUG) to improve performance 808 for (size_t idx = 0; idx < globalIndex.numElements(); ++idx) 809 { 810 if (itGloe != globalDataIndex.find(globalIndex(idx))) 811 { 812 ++nbIndex; 813 } 814 } 815 816 if (doGridHaveDataDistributed(client) && (nbIndex != localIndex.numElements())) 817 ERROR("void CGrid::computeClientIndex()", 818 << "Number of local index on client is different from number of received global index" 819 << "Rank of sent client " << rank <<"." 820 << "Number of local index " << nbIndex << ". " 821 << "Number of received global index " << localIndex.numElements() << "."); 822 823 nbIndex = 0; 824 for (size_t idx = 0; idx < globalIndex.numElements(); ++idx) 825 { 826 if (itGloe != globalDataIndex.find(globalIndex(idx))) 827 { 828 localIndex(idx) = globalDataIndex[globalIndex(idx)]; 829 } 830 } 831 } 832 } 833 } 834 CATCH_DUMP_ATTR 835 836 //--------------------------------------------------------------- 837 838 /* 839 Compute the global index and its local index taking account mask and data index. 840 These global indexes will be used to compute the connection of this client (sender) to its servers (receivers) 841 (via function computeConnectedClient) 842 These global indexes also correspond to data sent to servers (if any) 843 */ 844 void CGrid::computeClientIndexTiled() 845 TRY 846 { 847 CContext* context = CContext::getCurrent(); 848 849 CContextClient* client = context->client; 850 int rank = client->clientRank; 851 852 clientDistributionTiled_ = new CDistributionClient(rank, this, true); 853 // Get local data index on client 854 int nbStoreIndex = clientDistributionTiled_->getLocalDataIndexOnClient().size(); 855 int nbStoreGridMask = clientDistributionTiled_->getLocalMaskIndexOnClient().size(); 856 // nbStoreGridMask = nbStoreIndex if grid mask is defined, and 0 otherwise 857 storeIndexTiled_client.resize(nbStoreIndex); 858 storeMaskTiled_client.resize(nbStoreGridMask); 859 for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndexTiled_client(idx) = (clientDistributionTiled_->getLocalDataIndexOnClient())[idx]; 860 for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMaskTiled_client(idx) = (clientDistributionTiled_->getLocalMaskIndexOnClient())[idx]; 861 862 if (0 == serverDistribution_) isDataDistributed_= clientDistributionTiled_->isDataDistributed(); 863 else 864 { 865 // Mapping global index received from clients to the storeIndex_client 866 CDistributionClient::GlobalLocalDataMap& globalDataIndex = clientDistributionTiled_->getGlobalDataIndexOnClient(); 867 CDistributionClient::GlobalLocalDataMap::const_iterator itGloe = globalDataIndex.end(); 868 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClientTiled.begin(), 869 ite = outGlobalIndexFromClientTiled.end(), it; 870 871 for (it = itb; it != ite; ++it) 872 { 873 int rank = it->first; 874 CArray<size_t,1>& globalIndex = outGlobalIndexFromClientTiled[rank]; 875 outLocalIndexStoreOnClientTiled.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 876 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClientTiled[rank]; 804 877 size_t nbIndex = 0; 805 878 … … 978 1051 else 979 1052 { 980 computeClientIndex(); 1053 if (this->isTiled_) 1054 { 1055 computeClientIndexTiled(); 1056 if (!this->isTiledOnly_) 1057 computeClientIndex(); 1058 } 1059 else 1060 computeClientIndex(); 1061 981 1062 if (this->isTiled_) computeTileIndex(); 982 1063 if (context->hasClient) … … 1543 1624 CATCH 1544 1625 1545 void CGrid::maskField_arr(const double* const data, CArray<double, 1>& stored) const 1546 TRY 1547 { 1548 const StdSize size = storeIndex_client.numElements(); 1626 void CGrid::maskField_arr(const double* const data, CArray<double, 1>& stored, bool isTiled) const 1627 TRY 1628 { 1629 const CArray<int, 1>& storeIndex_clientP = isTiled ? storeIndexTiled_client : storeIndex_client; 1630 const CArray<bool, 1>& storeMask_clientP = isTiled ? storeMaskTiled_client : storeMask_client; 1631 const StdSize size = storeIndex_clientP.numElements(); 1549 1632 stored.resize(size); 1550 1633 const double nanValue = std::numeric_limits<double>::quiet_NaN(); 1551 1634 1552 if (storeMask_client .numElements() != 0)1553 for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_client (i)) ? data[storeIndex_client(i)] : nanValue;1635 if (storeMask_clientP.numElements() != 0) 1636 for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_clientP(i)) ? data[storeIndex_clientP(i)] : nanValue; 1554 1637 else 1555 for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client (i)];1638 for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_clientP(i)]; 1556 1639 } 1557 1640 CATCH … … 2513 2596 CATCH_DUMP_ATTR 2514 2597 2598 bool CGrid::isTiled(void) const 2599 TRY 2600 { 2601 return isTiled_; 2602 } 2603 CATCH 2604 2605 bool CGrid::isTiledOnly(void) const 2606 TRY 2607 { 2608 return isTiledOnly_; 2609 } 2610 CATCH 2611 2515 2612 bool CGrid::isTransformed() 2516 2613 TRY
Note: See TracChangeset
for help on using the changeset viewer.