Changeset 1794 for XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
- Timestamp:
- 12/16/19 19:22:59 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r1787 r1794 695 695 int nbStoreGridMask = clientDistribution_->getLocalMaskIndexOnClient().size(); 696 696 // nbStoreGridMask = nbStoreIndex if grid mask is defined, and 0 otherwise 697 storeIndex_client .resize(nbStoreIndex);698 storeMask_client .resize(nbStoreGridMask);699 for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client (idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx];700 for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMask_client (idx) = (clientDistribution_->getLocalMaskIndexOnClient())[idx];697 storeIndex_client_.resize(nbStoreIndex); 698 storeMask_client_.resize(nbStoreGridMask); 699 for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client_(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 700 for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMask_client_(idx) = (clientDistribution_->getLocalMaskIndexOnClient())[idx]; 701 701 702 702 if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed(); 703 703 else 704 704 { 705 // Mapping global index received from clients to the storeIndex_client 705 // Mapping global index received from clients to the storeIndex_client_ 706 706 CDistributionClient::GlobalLocalDataMap& globalDataIndex = clientDistribution_->getGlobalDataIndexOnClient(); 707 707 CDistributionClient::GlobalLocalDataMap::const_iterator itGloe = globalDataIndex.end(); 708 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient .begin(),709 ite = outGlobalIndexFromClient .end(), it;708 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient_.begin(), 709 ite = outGlobalIndexFromClient_.end(), it; 710 710 711 711 for (it = itb; it != ite; ++it) 712 712 { 713 713 int rank = it->first; 714 CArray<size_t,1>& globalIndex = outGlobalIndexFromClient [rank];715 outLocalIndexStoreOnClient .insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements())));716 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient [rank];714 CArray<size_t,1>& globalIndex = outGlobalIndexFromClient_[rank]; 715 outLocalIndexStoreOnClient_.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 716 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient_[rank]; 717 717 size_t nbIndex = 0; 718 718 … … 772 772 connectedDataSize_.erase(receiverSize); 773 773 globalIndexOnServer_.erase(receiverSize); 774 nbSenders .erase(receiverSize);774 nbSenders_.erase(receiverSize); 775 775 } 776 776 … … 872 872 } 873 873 874 nbSenders [receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]);874 nbSenders_[receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]); 875 875 } 876 876 } … … 911 911 if (serverDistribution_!=0) serverDistribution_->partialClear() ; 912 912 if (clientDistribution_!=0) clientDistribution_->partialClear() ; 913 outGlobalIndexFromClient .clear() ;913 outGlobalIndexFromClient_.clear() ; 914 914 } 915 915 } … … 1310 1310 TRY 1311 1311 { 1312 const StdSize size = storeIndex_client .numElements();1312 const StdSize size = storeIndex_client_.numElements(); 1313 1313 1314 1314 stored.resize(size); 1315 for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client (i)];1315 for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client_(i)]; 1316 1316 } 1317 1317 CATCH … … 1320 1320 TRY 1321 1321 { 1322 const StdSize size = storeIndex_client .numElements();1323 1324 for(StdSize i = 0; i < size; i++) data[storeIndex_client (i)] = stored(i);1322 const StdSize size = storeIndex_client_.numElements(); 1323 1324 for(StdSize i = 0; i < size; i++) data[storeIndex_client_(i)] = stored(i); 1325 1325 } 1326 1326 CATCH … … 1328 1328 void CGrid::maskField_arr(const double* const data, CArray<double, 1>& stored) const 1329 1329 { 1330 const StdSize size = storeIndex_client .numElements();1330 const StdSize size = storeIndex_client_.numElements(); 1331 1331 stored.resize(size); 1332 1332 const double nanValue = std::numeric_limits<double>::quiet_NaN(); 1333 1333 1334 if (storeMask_client .numElements() != 0)1335 for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_client (i)) ? data[storeIndex_client(i)] : nanValue;1334 if (storeMask_client_.numElements() != 0) 1335 for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_client_(i)) ? data[storeIndex_client_(i)] : nanValue; 1336 1336 else 1337 for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client (i)];1337 for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client_(i)]; 1338 1338 } 1339 1339 … … 1356 1356 clientDistribution_ = new CDistributionClient(rank, this); 1357 1357 1358 storeIndex_client .resize(1);1359 storeIndex_client (0) = 0;1358 storeIndex_client_.resize(1); 1359 storeIndex_client_(0) = 0; 1360 1360 1361 1361 if (0 != serverDistribution_) 1362 1362 { 1363 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient .begin(),1364 ite = outGlobalIndexFromClient .end(), it;1363 map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient_.begin(), 1364 ite = outGlobalIndexFromClient_.end(), it; 1365 1365 for (it = itb; it != ite; ++it) 1366 1366 { 1367 1367 int rank = it->first; 1368 CArray<size_t,1>& globalIndex = outGlobalIndexFromClient [rank];1369 outLocalIndexStoreOnClient .insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements())));1370 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient [rank];1368 CArray<size_t,1>& globalIndex = outGlobalIndexFromClient_[rank]; 1369 outLocalIndexStoreOnClient_.insert(make_pair(rank, CArray<size_t,1>(globalIndex.numElements()))); 1370 CArray<size_t,1>& localIndex = outLocalIndexStoreOnClient_[rank]; 1371 1371 if (1 != globalIndex.numElements()) 1372 1372 ERROR("void CGrid::computeClientIndexScalarGrid()", … … 1406 1406 connectedDataSize_.erase(receiverSize); 1407 1407 globalIndexOnServer_.erase(receiverSize); 1408 nbSenders .erase(receiverSize);1408 nbSenders_.erase(receiverSize); 1409 1409 } 1410 1410 … … 1418 1418 connectedServerRank_[receiverSize].push_back(rank); 1419 1419 connectedDataSize_[receiverSize][rank] = nb; 1420 nbSenders [receiverSize][rank] = nb;1420 nbSenders_[receiverSize][rank] = nb; 1421 1421 } 1422 1422 } … … 1430 1430 connectedServerRank_[receiverSize].push_back(rank); 1431 1431 connectedDataSize_[receiverSize][rank] = nb; 1432 nbSenders [receiverSize][rank] = nb;1432 nbSenders_[receiverSize][rank] = nb; 1433 1433 } 1434 1434 } … … 1443 1443 { 1444 1444 CContext* context = CContext::getCurrent(); 1445 storeIndex_toSrv .clear();1445 storeIndex_toSrv_.clear(); 1446 1446 std::list<CContextClient*>::iterator it; 1447 1447 … … 1462 1462 int rank = *itRank; 1463 1463 int nb = 1; 1464 storeIndex_toSrv [client].insert(std::make_pair(rank, CArray<int,1>(nb)));1464 storeIndex_toSrv_[client].insert(std::make_pair(rank, CArray<int,1>(nb))); 1465 1465 listOutIndex.push_back(CArray<size_t,1>(nb)); 1466 1466 1467 CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv [client][rank];1467 CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv_[client][rank]; 1468 1468 CArray<size_t, 1>& outGlobalIndexOnServer = listOutIndex.back(); 1469 1469 … … 1475 1475 1476 1476 if (context->hasClient && !context->hasServer) 1477 storeIndex_fromSrv .insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer)));1477 storeIndex_fromSrv_.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 1478 1478 1479 1479 listMsg.push_back(CMessage()); … … 1498 1498 1499 1499 if (context->hasClient && !context->hasServer) 1500 storeIndex_fromSrv .insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer)));1500 storeIndex_fromSrv_.insert(std::make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 1501 1501 } 1502 1502 client->sendEvent(event); … … 1510 1510 { 1511 1511 CContext* context = CContext::getCurrent(); 1512 storeIndex_toSrv .clear();1512 storeIndex_toSrv_.clear(); 1513 1513 std::list<CContextClient*>::iterator it; 1514 1514 … … 1543 1543 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1544 1544 { 1545 storeIndex_toSrv [client].insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer)));1545 storeIndex_toSrv_[client].insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1546 1546 if (context->hasClient && !context->hasServer) 1547 storeIndex_fromSrv .insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer)));1547 storeIndex_fromSrv_.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1548 1548 1549 1549 listOutIndex.push_back(CArray<size_t,1>(outGlobalIndexOnServer)); … … 1568 1568 for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 1569 1569 { 1570 storeIndex_fromSrv .insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer)));1570 storeIndex_fromSrv_.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 1571 1571 } 1572 1572 client->sendEvent(event); … … 1604 1604 nb = globalIndexTmp[rank].size(); 1605 1605 1606 storeIndex_toSrv [client].insert(make_pair(rank, CArray<int,1>(nb)));1606 storeIndex_toSrv_[client].insert(make_pair(rank, CArray<int,1>(nb))); 1607 1607 listOutIndex.push_back(CArray<size_t,1>(nb)); 1608 1608 1609 CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv [client][rank];1609 CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv_[client][rank]; 1610 1610 CArray<size_t, 1>& outGlobalIndexOnServer = listOutIndex.back(); 1611 1611 … … 1616 1616 } 1617 1617 1618 storeIndex_fromSrv .insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer)));1618 storeIndex_fromSrv_.insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 1619 1619 listMsg.push_back(CMessage()); 1620 1620 listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); 1621 1621 1622 event.push(rank, nbSenders [receiverSize][rank], listMsg.back());1622 event.push(rank, nbSenders_[receiverSize][rank], listMsg.back()); 1623 1623 } 1624 1624 … … 1654 1654 connectedServerRankRead_ = ranks; 1655 1655 1656 nbReadSenders .clear();1656 nbReadSenders_.clear(); 1657 1657 CContextServer* server = context->server ; 1658 1658 CContextClient* client = context->client; … … 1750 1750 CArray<size_t,1> outIndex; 1751 1751 buffer >> outIndex; 1752 outGlobalIndexFromClient .insert(std::make_pair(rank, outIndex));1752 outGlobalIndexFromClient_.insert(std::make_pair(rank, outIndex)); 1753 1753 connectedDataSizeRead_[rank] = outIndex.numElements(); 1754 1754 … … 1811 1811 if (isScalarGrid()) return; 1812 1812 1813 nbReadSenders [client] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks);1813 nbReadSenders_[client] = CClientServerMappingDistributed::computeConnectedClients(context->client->serverSize, context->client->clientSize, context->client->intraComm, ranks); 1814 1814 1815 1815 } … … 1975 1975 TRY 1976 1976 { 1977 // This function is now useless because it will return false only if server and client size are equal to 1 1978 // to be seriously check in future 1979 1977 1980 if (isScalarGrid()) return false; 1978 1981 else if (0 != client)
Note: See TracChangeset
for help on using the changeset viewer.