Ignore:
Timestamp:
12/16/19 19:22:59 (5 years ago)
Author:
ymipsl
Message:
  • add some comment about grid map/array/indexes
  • Add some "_" to suffix data members of the class

YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r1787 r1794  
    695695     int nbStoreGridMask = clientDistribution_->getLocalMaskIndexOnClient().size(); 
    696696     // 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]; 
    701701 
    702702     if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed(); 
    703703     else 
    704704     { 
    705         // Mapping global index received from clients to the storeIndex_client 
     705        // Mapping global index received from clients to the storeIndex_client_ 
    706706        CDistributionClient::GlobalLocalDataMap& globalDataIndex = clientDistribution_->getGlobalDataIndexOnClient(); 
    707707        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; 
    710710 
    711711        for (it = itb; it != ite; ++it) 
    712712        { 
    713713          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]; 
    717717          size_t nbIndex = 0; 
    718718 
     
    772772            connectedDataSize_.erase(receiverSize); 
    773773            globalIndexOnServer_.erase(receiverSize); 
    774             nbSenders.erase(receiverSize); 
     774            nbSenders_.erase(receiverSize); 
    775775         } 
    776776 
     
    872872         } 
    873873 
    874          nbSenders[receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]); 
     874         nbSenders_[receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]); 
    875875       } 
    876876     } 
     
    911911       if (serverDistribution_!=0) serverDistribution_->partialClear() ; 
    912912       if (clientDistribution_!=0) clientDistribution_->partialClear() ; 
    913        outGlobalIndexFromClient.clear() ; 
     913       outGlobalIndexFromClient_.clear() ; 
    914914     } 
    915915   } 
     
    13101310   TRY 
    13111311   { 
    1312       const StdSize size = storeIndex_client.numElements(); 
     1312      const StdSize size = storeIndex_client_.numElements(); 
    13131313 
    13141314      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)]; 
    13161316   } 
    13171317   CATCH 
     
    13201320   TRY 
    13211321   { 
    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); 
    13251325   } 
    13261326   CATCH 
     
    13281328   void CGrid::maskField_arr(const double* const data, CArray<double, 1>& stored) const 
    13291329   { 
    1330       const StdSize size = storeIndex_client.numElements(); 
     1330      const StdSize size = storeIndex_client_.numElements(); 
    13311331      stored.resize(size); 
    13321332      const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
    13331333 
    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; 
    13361336      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)]; 
    13381338   } 
    13391339 
     
    13561356      clientDistribution_ = new CDistributionClient(rank, this); 
    13571357 
    1358       storeIndex_client.resize(1); 
    1359       storeIndex_client(0) = 0;       
     1358      storeIndex_client_.resize(1); 
     1359      storeIndex_client_(0) = 0;       
    13601360 
    13611361      if (0 != serverDistribution_) 
    13621362      { 
    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; 
    13651365        for (it = itb; it != ite; ++it) 
    13661366        { 
    13671367          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]; 
    13711371          if (1 != globalIndex.numElements()) 
    13721372            ERROR("void CGrid::computeClientIndexScalarGrid()", 
     
    14061406          connectedDataSize_.erase(receiverSize); 
    14071407          globalIndexOnServer_.erase(receiverSize); 
    1408           nbSenders.erase(receiverSize); 
     1408          nbSenders_.erase(receiverSize); 
    14091409        } 
    14101410 
     
    14181418            connectedServerRank_[receiverSize].push_back(rank); 
    14191419            connectedDataSize_[receiverSize][rank] = nb; 
    1420             nbSenders[receiverSize][rank] = nb; 
     1420            nbSenders_[receiverSize][rank] = nb; 
    14211421          } 
    14221422        } 
     
    14301430            connectedServerRank_[receiverSize].push_back(rank); 
    14311431            connectedDataSize_[receiverSize][rank] = nb; 
    1432             nbSenders[receiverSize][rank] = nb; 
     1432            nbSenders_[receiverSize][rank] = nb; 
    14331433          } 
    14341434        } 
     
    14431443  { 
    14441444    CContext* context = CContext::getCurrent(); 
    1445     storeIndex_toSrv.clear(); 
     1445    storeIndex_toSrv_.clear(); 
    14461446    std::list<CContextClient*>::iterator it; 
    14471447 
     
    14621462          int rank = *itRank; 
    14631463          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))); 
    14651465          listOutIndex.push_back(CArray<size_t,1>(nb)); 
    14661466 
    1467           CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv[client][rank]; 
     1467          CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv_[client][rank]; 
    14681468          CArray<size_t, 1>& outGlobalIndexOnServer = listOutIndex.back(); 
    14691469 
     
    14751475 
    14761476          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))); 
    14781478 
    14791479          listMsg.push_back(CMessage()); 
     
    14981498 
    14991499          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))); 
    15011501        } 
    15021502        client->sendEvent(event); 
     
    15101510  { 
    15111511    CContext* context = CContext::getCurrent(); 
    1512     storeIndex_toSrv.clear(); 
     1512    storeIndex_toSrv_.clear(); 
    15131513    std::list<CContextClient*>::iterator it; 
    15141514 
     
    15431543          for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    15441544          { 
    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))); 
    15461546            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))); 
    15481548             
    15491549            listOutIndex.push_back(CArray<size_t,1>(outGlobalIndexOnServer)); 
     
    15681568           for (std::list<int>::const_iterator itRank = ranks.begin(), itRankEnd = ranks.end(); itRank != itRankEnd; ++itRank) 
    15691569           { 
    1570              storeIndex_fromSrv.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
     1570             storeIndex_fromSrv_.insert(std::make_pair(*itRank, CArray<int,1>(outLocalIndexToServer))); 
    15711571           } 
    15721572           client->sendEvent(event); 
     
    16041604            nb = globalIndexTmp[rank].size(); 
    16051605 
    1606           storeIndex_toSrv[client].insert(make_pair(rank, CArray<int,1>(nb))); 
     1606          storeIndex_toSrv_[client].insert(make_pair(rank, CArray<int,1>(nb))); 
    16071607          listOutIndex.push_back(CArray<size_t,1>(nb)); 
    16081608 
    1609           CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv[client][rank]; 
     1609          CArray<int, 1>& outLocalIndexToServer = storeIndex_toSrv_[client][rank]; 
    16101610          CArray<size_t, 1>& outGlobalIndexOnServer = listOutIndex.back(); 
    16111611 
     
    16161616          } 
    16171617 
    1618           storeIndex_fromSrv.insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
     1618          storeIndex_fromSrv_.insert(make_pair(rank, CArray<int,1>(outLocalIndexToServer))); 
    16191619          listMsg.push_back(CMessage()); 
    16201620          listMsg.back() << getId() << isDataDistributed_ << isCompressible_ << listOutIndex.back(); 
    16211621 
    1622           event.push(rank, nbSenders[receiverSize][rank], listMsg.back()); 
     1622          event.push(rank, nbSenders_[receiverSize][rank], listMsg.back()); 
    16231623        } 
    16241624 
     
    16541654    connectedServerRankRead_ = ranks; 
    16551655 
    1656     nbReadSenders.clear(); 
     1656    nbReadSenders_.clear(); 
    16571657    CContextServer* server = context->server  ; 
    16581658    CContextClient* client = context->client;    
     
    17501750      CArray<size_t,1> outIndex; 
    17511751      buffer >> outIndex; 
    1752       outGlobalIndexFromClient.insert(std::make_pair(rank, outIndex)); 
     1752      outGlobalIndexFromClient_.insert(std::make_pair(rank, outIndex)); 
    17531753      connectedDataSizeRead_[rank] = outIndex.numElements(); 
    17541754 
     
    18111811    if (isScalarGrid()) return; 
    18121812 
    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); 
    18141814 
    18151815  } 
     
    19751975  TRY 
    19761976  { 
     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 
    19771980    if (isScalarGrid()) return false; 
    19781981    else if (0 != client) 
Note: See TracChangeset for help on using the changeset viewer.