Ignore:
Timestamp:
09/06/18 18:55:44 (6 years ago)
Author:
oabramkina
Message:

Taking care of cases when a process doesn't possess a grid (its domain or axe size is zero).

Tested with CMIP6 toy models and IPSL model.

To do: remove grid mask from transformations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/node/axis.cpp

    r1570 r1571  
    245245   void CAxis::checkAttributes(void) 
    246246   { 
    247       if (this->n_glo.isEmpty()) 
     247     CContext* context=CContext::getCurrent(); 
     248 
     249     if (this->n_glo.isEmpty()) 
    248250        ERROR("CAxis::checkAttributes(void)", 
    249251              << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
     
    287289      if (!this->value.isEmpty()) 
    288290      { 
    289         StdSize true_size = value.numElements(); 
    290         if (this->n.getValue() != true_size) 
    291           ERROR("CAxis::checkAttributes(void)", 
     291        // Avoid this check at writing because it fails in case of a hole 
     292        if (context->hasClient) 
     293        { 
     294          StdSize true_size = value.numElements(); 
     295          if (this->n.getValue() != true_size) 
     296            ERROR("CAxis::checkAttributes(void)", 
    292297                << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
    293                 << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 
     298                << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size 
     299                << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 
     300        } 
    294301        this->hasValue = true; 
    295302      } 
     
    297304      this->checkBounds(); 
    298305 
    299       CContext* context=CContext::getCurrent(); 
    300306      if (context->hasClient) 
    301307      { 
     
    651657         // Even if a client has no index, it must connect to at least one server and  
    652658         // send an "empty" data to this server 
    653          if (connectedServerRank_[nbServer].empty()) 
    654           connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
     659//         if (connectedServerRank_[nbServer].empty()) 
     660//          connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
     661        // Send empty data to all servers 
     662        if (connectedServerRank_[nbServer].empty()) 
     663          for (int i=0; i<nbServer; ++i) 
     664            connectedServerRank_[nbServer].push_back(i); 
     665 
    655666 
    656667         nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
     
    690701    CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 
    691702                                     itSrve = writtenGlobalIndex.end(), itSrv;   
     703//    for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     704//    { 
     705//      indGlo = *itSrv; 
     706//      if (ite != globalLocalIndexMap_.find(indGlo)) 
     707//      { 
     708//        ++nbWritten; 
     709//      } 
     710//    } 
     711 
     712    localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
     713//    localIndexToWriteOnServer.resize(nbWritten); 
     714 
     715    nbWritten = 0; 
    692716    for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    693717    { 
     
    695719      if (ite != globalLocalIndexMap_.find(indGlo)) 
    696720      { 
    697         ++nbWritten; 
    698       } 
    699     } 
    700  
    701     localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
    702 //      localIndexToWriteOnServer.resize(nbWritten); 
    703  
    704     nbWritten = 0; 
    705     for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    706     { 
    707       indGlo = *itSrv; 
    708       if (ite != globalLocalIndexMap_.find(indGlo)) 
    709       { 
    710721        localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; 
    711         ++nbWritten; 
    712       } 
    713     } 
     722      } 
     723      else 
     724      { 
     725        localIndexToWriteOnServer(nbWritten) = -1; 
     726      } 
     727      ++nbWritten; 
     728    } 
     729 
    714730  } 
    715731 
     
    11941210         if (0 == globalLocalIndexMap_.count(gloInd)) 
    11951211         { 
    1196            index(nbIndLoc) = gloInd % n_glo; 
    1197            globalLocalIndexMap_[gloInd] = nbIndLoc; 
     1212//           index(nbIndLoc) = gloInd % n_glo; 
     1213//           globalLocalIndexMap_[gloInd] = nbIndLoc; 
     1214//           ++nbIndexGlob; 
     1215           index(nbIndexGlob) = gloInd % n_glo; 
     1216           globalLocalIndexMap_[gloInd] = nbIndexGlob; 
    11981217           ++nbIndexGlob; 
    11991218         }  
     
    12711290  } 
    12721291 
    1273  
    12741292  /*! 
    12751293    Compare two axis objects.  
Note: See TracChangeset for help on using the changeset viewer.