Ignore:
Timestamp:
01/23/19 10:31:44 (5 years ago)
Author:
yushan
Message:

dev on ADA. add flag switch _usingEP/_usingMPI

Location:
XIOS/dev/branch_openmp/src/node
Files:
39 edited

Legend:

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

    r1545 r1642  
    1414#include "distribution_client.hpp" 
    1515 
    16 using namespace ep_lib; 
    17  
    1816namespace xios { 
    1917 
     
    2826      , transformationMap_(), hasValue(false), hasLabel(false) 
    2927      , computedWrittenIndex_(false) 
    30       , clients() 
     28          , clients() 
    3129   { 
    3230   } 
     
    4038      , transformationMap_(), hasValue(false), hasLabel(false) 
    4139      , computedWrittenIndex_(false) 
    42       , clients() 
     40          , clients() 
    4341   { 
    4442   } 
     
    4745   { /* Ne rien faire de plus */ } 
    4846 
    49    std::map<StdString, ETranformationType> *CAxis::transformationMapList_ptr = 0; 
    50  
     47   std::map<StdString, ETranformationType> CAxis::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     48   bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_); 
    5149   bool CAxis::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     50   TRY 
    5251   { 
    5352     m["zoom_axis"] = TRANS_ZOOM_AXIS; 
    5453     m["interpolate_axis"] = TRANS_INTERPOLATE_AXIS; 
     54     m["extract_axis"] = TRANS_EXTRACT_AXIS; 
    5555     m["inverse_axis"] = TRANS_INVERSE_AXIS; 
    5656     m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_AXIS; 
     
    5959     m["temporal_splitting"] = TRANS_TEMPORAL_SPLITTING; 
    6060     m["duplicate_scalar"] = TRANS_DUPLICATE_SCALAR_TO_AXIS; 
    61    } 
    62  
    63    bool CAxis::initializeTransformationMap() 
    64    { 
    65      if(CAxis::transformationMapList_ptr == 0) CAxis::transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
    66      (*CAxis::transformationMapList_ptr)["zoom_axis"]        = TRANS_ZOOM_AXIS; 
    67      (*CAxis::transformationMapList_ptr)["interpolate_axis"] = TRANS_INTERPOLATE_AXIS; 
    68      (*CAxis::transformationMapList_ptr)["inverse_axis"]     = TRANS_INVERSE_AXIS; 
    69      (*CAxis::transformationMapList_ptr)["reduce_domain"]    = TRANS_REDUCE_DOMAIN_TO_AXIS; 
    70      (*CAxis::transformationMapList_ptr)["extract_domain"]   = TRANS_EXTRACT_DOMAIN_TO_AXIS; 
    71      (*CAxis::transformationMapList_ptr)["reduce_axis"]      = TRANS_REDUCE_AXIS_TO_AXIS; 
    72      (*CAxis::transformationMapList_ptr)["temporal_splitting"] = TRANS_TEMPORAL_SPLITTING; 
    73      (*CAxis::transformationMapList_ptr)["duplicate_scalar"] = TRANS_DUPLICATE_SCALAR_TO_AXIS; 
    74    } 
     61 
     62   } 
     63   CATCH 
    7564 
    7665   ///--------------------------------------------------------------- 
    7766 
    7867   const std::set<StdString> & CAxis::getRelFiles(void) const 
     68   TRY 
    7969   { 
    8070      return (this->relFiles); 
    8171   } 
     72   CATCH 
    8273 
    8374   bool CAxis::IsWritten(const StdString & filename) const 
     75   TRY 
    8476   { 
    8577      return (this->relFiles.find(filename) != this->relFiles.end()); 
    8678   } 
     79   CATCH 
    8780 
    8881   bool CAxis::isWrittenCompressed(const StdString& filename) const 
     82   TRY 
    8983   { 
    9084      return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); 
    9185   } 
     86   CATCH 
    9287 
    9388   bool CAxis::isDistributed(void) const 
     89   TRY 
    9490   { 
    9591      bool distributed = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 
    9692             (!this->n.isEmpty() && (this->n != this->n_glo)); 
    97       // A same stupid condition to make sure that if there is only one client, axis 
     93      // A condition to make sure that if there is only one client, axis 
    9894      // should be considered to be distributed. This should be a temporary solution      
    9995      distributed |= (1 == CContext::getCurrent()->client->clientSize); 
    10096      return distributed; 
    10197   } 
     98   CATCH 
    10299 
    103100   /*! 
     
    107104    */ 
    108105   bool CAxis::isCompressible(void) const 
     106   TRY 
    109107   { 
    110108      return isCompressible_; 
    111109   } 
     110   CATCH 
    112111 
    113112   void CAxis::addRelFile(const StdString & filename) 
     113   TRY 
    114114   { 
    115115      this->relFiles.insert(filename); 
    116116   } 
     117   CATCH_DUMP_ATTR 
    117118 
    118119   void CAxis::addRelFileCompressed(const StdString& filename) 
     120   TRY 
    119121   { 
    120122      this->relFilesCompressed.insert(filename); 
    121123   } 
     124   CATCH_DUMP_ATTR 
    122125 
    123126   //---------------------------------------------------------------- 
     
    128131   */ 
    129132   int CAxis::getNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom) 
     133   TRY 
    130134   { 
    131135     int writtenSize; 
     
    133137     return numberWrittenIndexes_[writtenSize]; 
    134138   } 
     139   CATCH_DUMP_ATTR 
    135140 
    136141   /*! 
     
    139144   */ 
    140145   int CAxis::getTotalNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom) 
     146   TRY 
    141147   { 
    142148     int writtenSize; 
     
    144150     return totalNumberWrittenIndexes_[writtenSize]; 
    145151   } 
     152   CATCH_DUMP_ATTR 
    146153 
    147154   /*! 
     
    150157   */ 
    151158   int CAxis::getOffsetWrittenIndexes(ep_lib::MPI_Comm writtenCom) 
     159   TRY 
    152160   { 
    153161     int writtenSize; 
     
    155163     return offsetWrittenIndexes_[writtenSize]; 
    156164   } 
     165   CATCH_DUMP_ATTR 
    157166 
    158167   CArray<int, 1>& CAxis::getCompressedIndexToWriteOnServer(ep_lib::MPI_Comm writtenCom) 
     168   TRY 
    159169   { 
    160170     int writtenSize; 
     
    162172     return compressedIndexToWriteOnServer[writtenSize]; 
    163173   } 
     174   CATCH_DUMP_ATTR 
     175 
    164176   //---------------------------------------------------------------- 
    165177 
     
    171183   std::map<int, StdSize> CAxis::getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 
    172184                                                         CServerDistributionDescription::ServerDistributionType distType) 
     185   TRY 
    173186   { 
    174187 
     
    234247       } 
    235248     } 
    236  
    237249     return attributesSizes; 
    238250   } 
     251   CATCH_DUMP_ATTR 
    239252 
    240253   //---------------------------------------------------------------- 
     
    247260 
    248261   CAxis* CAxis::createAxis() 
     262   TRY 
    249263   { 
    250264     CAxis* axis = CAxisGroup::get("axis_definition")->createChild(); 
    251265     return axis; 
    252266   } 
     267   CATCH 
    253268 
    254269   /*! 
     
    257272   */ 
    258273   void CAxis::checkAttributes(void) 
    259    { 
    260       if (this->n_glo.isEmpty()) 
     274   TRY 
     275   { 
     276     CContext* context=CContext::getCurrent(); 
     277 
     278     if (this->n_glo.isEmpty()) 
    261279        ERROR("CAxis::checkAttributes(void)", 
    262280              << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
     
    298316      } 
    299317 
    300       // Remove this check because it doen't make sense in case of a hole or overlapping axes 
    301318      if (!this->value.isEmpty()) 
    302319      { 
    303 //        StdSize true_size = value.numElements(); 
    304 //        if (this->n.getValue() != true_size) 
    305 //          ERROR("CAxis::checkAttributes(void)", 
    306 //                << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
    307 //                << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 
     320        // Avoid this check at writing because it fails in case of a hole 
     321        if (context->hasClient) 
     322        { 
     323          StdSize true_size = value.numElements(); 
     324          if (this->n.getValue() != true_size) 
     325            ERROR("CAxis::checkAttributes(void)", 
     326                << "[ id = '" << getId() << "' , context = '" << CObjectFactory::GetCurrentContextId() << "' ] " 
     327                << "The axis is wrongly defined, attribute 'value' has a different size (" << true_size 
     328                << ") than the one defined by the \'size\' attribute (" << n.getValue() << ")."); 
     329        } 
    308330        this->hasValue = true; 
    309331      } 
     
    311333      this->checkBounds(); 
    312334 
    313       CContext* context=CContext::getCurrent(); 
    314335      if (context->hasClient) 
    315336      { 
     337        this->checkMask(); 
    316338        this->checkData(); 
    317         this->checkZoom(); 
    318         this->checkMask(); 
    319339        this->checkLabel(); 
    320340      } 
    321341   } 
     342   CATCH_DUMP_ATTR 
    322343 
    323344   /*! 
    324       Check the validity of data and fill in values if any. 
     345      Check the validity of data, fill in values if any, and apply mask. 
    325346   */ 
    326347   void CAxis::checkData() 
     348   TRY 
    327349   { 
    328350      if (data_begin.isEmpty()) data_begin.setValue(0); 
     
    342364      { 
    343365        data_index.resize(data_n); 
    344         for (int i = 0; i < data_n; ++i) data_index(i) = i; 
    345       } 
    346    } 
    347  
    348    /*! 
    349      Check validity of zoom info and fill in values if any. 
    350    */ 
    351    void CAxis::checkZoom(void) 
    352    { 
    353      if (global_zoom_begin.isEmpty()) global_zoom_begin.setValue(0); 
    354      if (global_zoom_n.isEmpty()) global_zoom_n.setValue(n_glo.getValue()); 
    355      if (zoom_index.isEmpty()) 
    356      { 
    357        zoom_index.setValue(index.getValue()); 
    358      } 
    359      if (zoom_n.isEmpty()) zoom_n.setValue(n); 
    360      if (zoom_begin.isEmpty()) zoom_begin.setValue(begin); 
    361    } 
     366        for (int i = 0; i < data_n; ++i) 
     367        { 
     368          if ((i+data_begin) >= 0 && (i+data_begin<n)) 
     369          { 
     370            if (mask(i+data_begin)) 
     371              data_index(i) = i+data_begin; 
     372            else 
     373              data_index(i) = -1; 
     374          } 
     375          else 
     376            data_index(i) = -1; 
     377        } 
     378      } 
     379      else 
     380      { 
     381        if (data_index.numElements() != data_n) 
     382        { 
     383          ERROR("CAxis::checkData(void)", 
     384                << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
     385                << "The size of data_index = "<< data_index.numElements() << "is not equal to the data size data_n = " << data_n.getValue() << ")."); 
     386        } 
     387        for (int i = 0; i < data_n; ++i) 
     388        { 
     389          if ((i+data_begin) >= 0 && (i+data_begin<n) && !mask(i+data_begin)) 
     390            data_index(i) = -1; 
     391        } 
     392      } 
     393 
     394   } 
     395   CATCH_DUMP_ATTR 
    362396 
    363397    size_t CAxis::getGlobalWrittenSize(void) 
    364398    { 
    365       if (zoomByIndex()) return  global_zoom_index.numElements(); 
    366       else return global_zoom_n ; 
     399      return n_glo ; 
    367400    } 
    368401 
     
    371404   */ 
    372405   void CAxis::checkMask() 
     406   TRY 
    373407   { 
    374408      if (!mask.isEmpty()) 
    375409      { 
    376          if (mask.extent(0) != n) 
    377            ERROR("CAxis::checkMask(void)", 
    378                  << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    379                  << "The mask does not have the same size as the local domain." << std::endl 
    380                  << "Local size is " << n.getValue() << "." << std::endl 
    381                  << "Mask size is " << mask.extent(0) << "."); 
    382       } 
    383       else // (mask.isEmpty()) 
    384       { // If no mask was defined, we create a default one without any masked point. 
    385          mask.resize(n); 
    386          for (int i = 0; i < n; ++i) 
    387          { 
    388            mask(i) = true; 
    389          } 
    390       } 
    391    } 
     410        if (mask.extent(0) != n) 
     411        { 
     412          ERROR("CAxis::checkMask(void)", 
     413              << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
     414              << "The mask does not have the same size as the local domain." << std::endl 
     415              << "Local size is " << n.getValue() << "." << std::endl 
     416              << "Mask size is " << mask.extent(0) << "."); 
     417        } 
     418      } 
     419      else 
     420      { 
     421        mask.resize(n); 
     422        mask = true; 
     423      } 
     424   } 
     425   CATCH_DUMP_ATTR 
    392426 
    393427   /*! 
     
    395429   */ 
    396430   void CAxis::checkBounds() 
     431   TRY 
    397432   { 
    398433     if (!bounds.isEmpty()) 
     
    407442     else hasBounds = false; 
    408443   } 
     444   CATCH_DUMP_ATTR 
    409445 
    410446  void CAxis::checkLabel() 
     447  TRY 
    411448  { 
    412449    if (!label.isEmpty()) 
     
    421458    else hasLabel = false; 
    422459  } 
     460  CATCH_DUMP_ATTR 
    423461 
    424462  /*! 
     
    426464  */ 
    427465  void CAxis::checkEligibilityForCompressedOutput() 
     466  TRY 
    428467  { 
    429468    // We don't check if the mask is valid here, just if a mask has been defined at this point. 
    430469    isCompressible_ = !mask.isEmpty(); 
    431470  } 
    432  
    433   /* 
    434     Check whether we do zooming by indexing 
    435     return true if do zooming by index 
    436   */ 
    437   bool CAxis::zoomByIndex() 
    438   { 
    439     return (!global_zoom_index.isEmpty() && (0 != global_zoom_index.numElements())); 
    440   } 
     471  CATCH_DUMP_ATTR 
    441472 
    442473  /*! 
     
    444475  */ 
    445476  bool CAxis::dispatchEvent(CEventServer& event) 
     477  TRY 
    446478  { 
    447479     if (SuperClass::dispatchEvent(event)) return true; 
     
    469501     } 
    470502  } 
     503  CATCH 
    471504 
    472505   /*! 
     
    474507   */ 
    475508   void CAxis::checkAttributesOnClient() 
     509   TRY 
    476510   { 
    477511     if (this->areClientAttributesChecked_) return; 
     
    482516     this->areClientAttributesChecked_ = true; 
    483517   } 
     518   CATCH_DUMP_ATTR 
    484519 
    485520   /* 
     
    489524   void CAxis::checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid, 
    490525                                                          CServerDistributionDescription::ServerDistributionType distType) 
     526   TRY 
    491527   { 
    492528     CContext* context=CContext::getCurrent() ; 
     
    502538     this->isClientAfterTransformationChecked = true; 
    503539   } 
     540   CATCH_DUMP_ATTR 
    504541 
    505542   /* 
     
    512549   void CAxis::sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
    513550                                     CServerDistributionDescription::ServerDistributionType distType) 
     551   TRY 
    514552   { 
    515553     if (!this->areClientAttributesChecked_) checkAttributesOnClient(); 
     
    522560     this->isChecked = true; 
    523561   } 
     562   CATCH_DUMP_ATTR 
    524563 
    525564  /*! 
     
    530569  void CAxis::sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
    531570                             CServerDistributionDescription::ServerDistributionType distType) 
     571  TRY 
    532572  { 
    533573     sendDistributionAttribute(globalDim, orderPositionInGrid, distType); 
     
    544584     }      
    545585  } 
     586  CATCH_DUMP_ATTR 
    546587 
    547588  /* 
     
    555596  void CAxis::computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid, 
    556597                                     CServerDistributionDescription::ServerDistributionType distType) 
     598  TRY 
    557599  { 
    558600    CContext* context = CContext::getCurrent(); 
     
    574616        size_t ni = this->n.getValue(); 
    575617        size_t ibegin = this->begin.getValue(); 
    576         size_t global_zoom_end = global_zoom_begin+global_zoom_n-1; 
    577         size_t nZoomCount = 0; 
    578618        size_t nbIndex = index.numElements(); 
    579619 
     
    588628 
    589629        // Calculate the compressed index if any 
    590         std::set<int> writtenInd; 
    591         if (isCompressible_) 
    592         { 
    593           for (int idx = 0; idx < data_index.numElements(); ++idx) 
    594           { 
    595             int ind = CDistributionClient::getAxisIndex(data_index(idx), data_begin, ni); 
    596  
    597             if (ind >= 0 && ind < ni && mask(ind)) 
    598             { 
    599               ind += ibegin; 
    600               if (ind >= global_zoom_begin && ind <= global_zoom_end) 
    601                 writtenInd.insert(ind); 
    602             } 
    603           } 
    604         } 
     630//        std::set<int> writtenInd; 
     631//        if (isCompressible_) 
     632//        { 
     633//          for (int idx = 0; idx < data_index.numElements(); ++idx) 
     634//          { 
     635//            int ind = CDistributionClient::getAxisIndex(data_index(idx), data_begin, ni); 
     636// 
     637//            if (ind >= 0 && ind < ni && mask(ind)) 
     638//            { 
     639//              ind += ibegin; 
     640//              writtenInd.insert(ind); 
     641//            } 
     642//          } 
     643//        } 
    605644 
    606645        // Compute the global index of the current client (process) hold 
     
    635674 
    636675        CServerDistributionDescription serverDescription(nGlobAxis, nbServer, distType); 
    637  
     676       
    638677        std::vector<int> serverZeroIndex; 
    639678        serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t&,size_t&>(indexBegin, indexEnd), 0); 
     
    654693        if (distType==CServerDistributionDescription::ROOT_DISTRIBUTION) 
    655694        { 
    656           for(int i=1; i<nbServer; ++i)  
    657           { 
    658             indSrv_[nbServer].insert(pair<int, vector<size_t> >(i,indSrv_[nbServer][0]) ) ; 
    659           } 
    660  
     695          for(int i=1; i<nbServer; ++i) indSrv_[nbServer].insert(pair<int, vector<size_t> >(i,indSrv_[nbServer][0]) ) ; 
    661696          serverZeroIndexLeader.clear() ; 
    662697        } 
    663  
     698          
    664699        CClientServerMapping::GlobalIndexMap::const_iterator it  = indSrv_[nbServer].begin(), 
    665700                                                             ite = indSrv_[nbServer].end(); 
     
    675710          connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
    676711 
    677          nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
     712        nbSenders[nbServer] = CClientServerMapping::computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
    678713 
    679714        delete clientServerMap; 
     
    681716    } 
    682717  } 
     718  CATCH_DUMP_ATTR 
    683719 
    684720  /* 
     
    688724  */ 
    689725  void CAxis::computeWrittenIndex() 
     726  TRY 
    690727  {   
    691728    if (computedWrittenIndex_) return; 
     
    697734    // We describe the distribution of client (server) on which data are written 
    698735    std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); 
    699     nBegin[0]       = zoom_begin; 
    700     nSize[0]        = zoom_n;    
     736    nBegin[0]       = begin; 
     737    nSize[0]        = n; 
    701738    nBeginGlobal[0] = 0;  
    702739    nGlob[0]        = n_glo; 
     
    711748    CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 
    712749                                     itSrve = writtenGlobalIndex.end(), itSrv;   
    713     if (!zoomByIndex()) 
    714     {    
    715       for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    716       { 
    717         indGlo = *itSrv; 
    718         if (ite != globalLocalIndexMap_.find(indGlo)) 
    719         {           
    720           ++nbWritten; 
    721         }                  
    722       } 
    723  
    724       localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
    725 //      localIndexToWriteOnServer.resize(nbWritten); 
    726  
    727       nbWritten = 0; 
    728       for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    729       { 
    730         indGlo = *itSrv; 
    731         if (ite != globalLocalIndexMap_.find(indGlo)) 
    732         { 
    733           localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; 
    734           ++nbWritten; 
    735         }                  
    736       } 
    737     } 
    738     else 
    739     { 
    740       nbWritten = 0; 
    741       std::unordered_map<size_t,size_t>::const_iterator itb = globalLocalIndexMap_.begin(), 
    742                                                           ite = globalLocalIndexMap_.end(), it; 
    743       for (int i = 0; i < zoom_index.numElements(); ++i) 
    744       { 
    745          if (ite != globalLocalIndexMap_.find(zoom_index(i))) 
    746           ++nbWritten; 
    747       } 
    748  
    749       localIndexToWriteOnServer.resize(nbWritten); 
    750  
    751       nbWritten = 0; 
    752       for (int i = 0; i < zoom_index.numElements(); ++i) 
    753       { 
    754          if (ite != globalLocalIndexMap_.find(zoom_index(i))) 
    755          { 
    756            localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[zoom_index(i)]; 
    757            ++nbWritten; 
    758          } 
    759       } 
    760     } 
    761  
    762   } 
     750 
     751    localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
     752    nbWritten = 0; 
     753    for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     754    { 
     755      indGlo = *itSrv; 
     756      if (ite != globalLocalIndexMap_.find(indGlo)) 
     757      { 
     758        localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; 
     759      } 
     760      else 
     761      { 
     762        localIndexToWriteOnServer(nbWritten) = -1; 
     763      } 
     764      ++nbWritten; 
     765    } 
     766 
     767  } 
     768  CATCH_DUMP_ATTR 
    763769 
    764770  void CAxis::computeWrittenCompressedIndex(ep_lib::MPI_Comm writtenComm) 
     771  TRY 
    765772  { 
    766773    int writtenCommSize; 
     
    777784      // We describe the distribution of client (server) on which data are written 
    778785      std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); 
    779       nBegin[0]       = zoom_begin; 
    780       nSize[0]        = zoom_n;    
     786      nBegin[0]       = 0; 
     787      nSize[0]        = n; 
    781788      nBeginGlobal[0] = 0;  
    782789      nGlob[0]        = n_glo; 
     
    798805        }                  
    799806      } 
     807// 
     808//      nbWritten = 0; 
     809//      for (int idx = 0; idx < data_index.numElements(); ++idx) 
     810//      { 
     811//        if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 
     812//        { 
     813//          ++nbWritten; 
     814//        } 
     815//      } 
     816// 
     817//      compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten); 
     818//      nbWritten = 0; 
     819//      for (int idx = 0; idx < data_index.numElements(); ++idx) 
     820//      { 
     821//        if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 
     822//        { 
     823//          compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_index(idx)]; 
     824//          ++nbWritten; 
     825//        } 
     826//      } 
    800827 
    801828      nbWritten = 0; 
     
    823850      { 
    824851              
    825         ep_lib::MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); 
    826         ep_lib::MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); 
     852        ep_lib::MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, EP_INT, EP_SUM, writtenComm); 
     853        ep_lib::MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, EP_INT, EP_SUM, writtenComm); 
    827854        offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize]; 
    828855      } 
     
    831858    } 
    832859  } 
     860  CATCH_DUMP_ATTR 
    833861 
    834862  /*! 
     
    841869  void CAxis::sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid, 
    842870                                        CServerDistributionDescription::ServerDistributionType distType) 
     871  TRY 
    843872  { 
    844873    std::list<CContextClient*>::iterator it; 
     
    865894          const int begin = serverIndexBegin[*itRank][orderPositionInGrid]; 
    866895          const int ni    = serverDimensionSizes[*itRank][orderPositionInGrid]; 
    867           const int end   = begin + ni - 1;           
    868896 
    869897          msgs.push_back(CMessage()); 
    870898          CMessage& msg = msgs.back(); 
    871899          msg << this->getId(); 
    872           msg << ni << begin << end;           
     900          msg << ni << begin; 
    873901          msg << isCompressible_;                     
    874902 
     
    880908    } 
    881909  } 
     910  CATCH_DUMP_ATTR 
    882911 
    883912  /* 
     
    886915  */ 
    887916  void CAxis::recvDistributionAttribute(CEventServer& event) 
     917  TRY 
    888918  { 
    889919    CBufferIn* buffer = event.subEvents.begin()->buffer; 
     
    892922    get(axisId)->recvDistributionAttribute(*buffer); 
    893923  } 
     924  CATCH 
    894925 
    895926  /* 
     
    898929  */ 
    899930  void CAxis::recvDistributionAttribute(CBufferIn& buffer) 
    900   { 
    901     int ni_srv, begin_srv, end_srv; 
    902     int global_zoom_end, zoom_end; 
    903     bool zoomIndex = zoomByIndex(); 
    904      
    905     std::vector<int> zoom_index_tmp; 
    906     std::vector<int>::iterator itZoomBegin, itZoomEnd, itZoom; 
    907  
    908     buffer >> ni_srv >> begin_srv >> end_srv;     
     931  TRY 
     932  { 
     933    int ni_srv, begin_srv; 
     934    buffer >> ni_srv >> begin_srv; 
    909935    buffer >> isCompressible_;             
    910936 
     
    912938    n.setValue(ni_srv); 
    913939    begin.setValue(begin_srv); 
    914  
    915     // If we have zoom by index then process it 
    916     if (zoomIndex) 
    917     { 
    918       zoom_index_tmp.resize(global_zoom_index.numElements()); 
    919       std::copy(global_zoom_index.begin(), global_zoom_index.end(), zoom_index_tmp.begin()); 
    920       std::sort(zoom_index_tmp.begin(), zoom_index_tmp.end()); 
    921       itZoomBegin = std::lower_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), begin_srv); 
    922       itZoomEnd   = std::upper_bound(zoom_index_tmp.begin(), zoom_index_tmp.end(), end_srv);       
    923       int sz = std::distance(itZoomBegin, itZoomEnd); 
    924       zoom_index.resize(sz); 
    925       itZoom = itZoomBegin; 
    926       for (int i = 0; i < sz; ++i, ++itZoom) 
    927       { 
    928         zoom_index(i) = *(itZoom); 
    929       } 
    930     } 
    931  
    932     global_zoom_begin = zoomIndex ? 0 : global_zoom_begin ; 
    933     global_zoom_n     = zoomIndex ? zoom_index_tmp.size() : global_zoom_n; 
    934     global_zoom_end   = global_zoom_begin + global_zoom_n - 1; 
    935  
    936     zoom_begin = zoomIndex ? std::distance(zoom_index_tmp.begin(), itZoomBegin) 
    937                            : global_zoom_begin > begin_srv ? global_zoom_begin : begin_srv ; 
    938     zoom_end   = zoomIndex ? std::distance(zoom_index_tmp.begin(), itZoomEnd) - 1  
    939                            : global_zoom_end < end_srv ? global_zoom_end : end_srv ; 
    940     zoom_n     = zoom_end - zoom_begin + 1; 
    941  
    942     if (zoom_n<=0) 
    943     { 
    944       zoom_n = 0; zoom_begin=global_zoom_begin; //0; zoom_begin = 0;  
    945     } 
    946  
    947     if (n_glo == n) 
    948     { 
    949       zoom_begin = zoomIndex ? std::distance(itZoomBegin, zoom_index_tmp.begin()) 
    950                              : global_zoom_begin;       
    951       zoom_n     = zoomIndex ? zoom_index_tmp.size() : global_zoom_n; 
    952     } 
    953   } 
     940  } 
     941  CATCH_DUMP_ATTR 
    954942 
    955943  /* 
     
    959947  */ 
    960948  void CAxis::sendNonDistributedAttributes() 
     949  TRY 
    961950  { 
    962951    std::list<CContextClient*>::iterator it; 
    963952    for (it=clients.begin(); it!=clients.end(); ++it) 
    964     { 
    965       CContextClient* client = *it; 
     953        { 
     954          CContextClient* client = *it; 
    966955 
    967956      CEventClient event(getType(), EVENT_ID_NON_DISTRIBUTED_ATTRIBUTES); 
     
    10121001    } 
    10131002  } 
     1003  CATCH_DUMP_ATTR 
    10141004 
    10151005  /* 
     
    10181008  */ 
    10191009  void CAxis::recvNonDistributedAttributes(CEventServer& event) 
     1010  TRY 
    10201011  { 
    10211012    list<CEventServer::SSubEvent>::iterator it; 
     
    10281019    } 
    10291020  } 
     1021  CATCH 
    10301022 
    10311023  /* 
     
    10351027  */ 
    10361028  void CAxis::recvNonDistributedAttributes(int rank, CBufferIn& buffer) 
     1029  TRY 
    10371030  {  
    1038     CArray<int,1> tmp_index, tmp_data_index, tmp_zoom_index; 
     1031    CArray<int,1> tmp_index, tmp_data_index; 
    10391032    CArray<bool,1> tmp_mask; 
    10401033    CArray<double,1> tmp_val; 
     
    10761069    for (int idx = 0; idx < index.numElements(); ++idx) globalLocalIndexMap_[index(idx)] = idx; 
    10771070  } 
     1071  CATCH_DUMP_ATTR 
    10781072 
    10791073  /* 
    1080     Send attributes of axis from a group of client to other group of clients/servers  
    1081     on supposing that these attributes are distributed among the clients of the sending group 
    1082     In the future, if new attributes are added, they should also be processed in this function 
     1074    Send axis attributes from a group of clients to another group of clients/servers 
     1075    supposing that these attributes are distributed among the clients of the sending group 
     1076    In future, if new attributes are added, they should also be processed in this function 
    10831077  */ 
    10841078  void CAxis::sendDistributedAttributes(void) 
    1085   { 
    1086     int ns, n, i, j, ind, nv, idx; 
     1079  TRY 
     1080  { 
     1081    int ind, idx; 
    10871082    std::list<CContextClient*>::iterator it; 
    10881083 
     
    10951090 
    10961091      list<CMessage> listData; 
    1097       list<CArray<int,1> > list_indi, list_dataInd, list_zoomInd; 
    1098       list<CArray<bool,1> > list_mask; 
     1092      list<CArray<int,1> > list_indi, list_dataInd; 
    10991093      list<CArray<double,1> > list_val; 
    11001094      list<CArray<double,2> > list_bounds; 
    11011095      list<CArray<string,1> > list_label; 
    11021096 
     1097      // Cut off the ghost points 
    11031098      int nbIndex = index.numElements(); 
    11041099      CArray<int,1> dataIndex(nbIndex); 
     
    11071102      { 
    11081103        if (0 <= data_index(idx) && data_index(idx) < nbIndex) 
    1109           dataIndex(idx) = 1; 
     1104          dataIndex(data_index(idx)) = 1; 
    11101105      } 
    11111106 
     
    11141109      for (int k = 0; k < connectedServerRank_[nbServer].size(); ++k) 
    11151110      { 
    1116         int nbData = 0; 
     1111        int nbData = 0, nbDataCount = 0; 
    11171112        int rank = connectedServerRank_[nbServer][k]; 
    11181113        it = indSrv_[nbServer].find(rank); 
     
    11211116 
    11221117        list_indi.push_back(CArray<int,1>(nbData)); 
    1123         list_dataInd.push_back(CArray<int,1>(nbData));         
    1124         list_mask.push_back(CArray<bool,1>(nbData)); 
     1118        list_dataInd.push_back(CArray<int,1>(nbData)); 
    11251119 
    11261120        if (hasValue) 
     
    11341128 
    11351129        CArray<int,1>& indi = list_indi.back(); 
    1136         CArray<int,1>& dataIndi = list_dataInd.back();         
    1137         CArray<bool,1>& maskIndi = list_mask.back(); 
    1138  
    1139         for (n = 0; n < nbData; ++n) 
     1130        CArray<int,1>& dataIndi = list_dataInd.back(); 
     1131        dataIndi = -1; 
     1132 
     1133        for (int n = 0; n < nbData; ++n) 
    11401134        { 
    11411135          idx = static_cast<int>(it->second[n]); 
     
    11441138          ind = globalLocalIndexMap_[idx]; 
    11451139          dataIndi(n) = dataIndex(ind); 
    1146           maskIndi(n) = mask(ind); 
    11471140 
    11481141          if (hasValue) 
     
    11681161        listData.push_back(CMessage()); 
    11691162        listData.back() << this->getId() 
    1170                         << list_indi.back() << list_dataInd.back() << list_mask.back(); 
     1163                        << list_indi.back() << list_dataInd.back(); 
    11711164 
    11721165        listData.back() << hasValue; 
     
    11881181    } 
    11891182  } 
     1183  CATCH_DUMP_ATTR 
    11901184 
    11911185  /* 
     
    11941188  */ 
    11951189  void CAxis::recvDistributedAttributes(CEventServer& event) 
     1190  TRY 
    11961191  { 
    11971192    string axisId; 
     
    12091204    get(axisId)->recvDistributedAttributes(ranks, buffers); 
    12101205  } 
     1206  CATCH 
    12111207 
    12121208  /* 
     
    12161212  */ 
    12171213  void CAxis::recvDistributedAttributes(vector<int>& ranks, vector<CBufferIn*> buffers) 
     1214  TRY 
    12181215  { 
    12191216    int nbReceived = ranks.size(), idx, ind, gloInd, locInd; 
    1220     vector<CArray<int,1> > vec_indi(nbReceived), vec_dataInd(nbReceived), vec_zoomInd(nbReceived);     
    1221     vector<CArray<bool,1> > vec_mask(nbReceived); 
     1217    vector<CArray<int,1> > vec_indi(nbReceived), vec_dataInd(nbReceived); 
    12221218    vector<CArray<double,1> > vec_val(nbReceived); 
    12231219    vector<CArray<double,2> > vec_bounds(nbReceived); 
     
    12291225      buffer >> vec_indi[idx]; 
    12301226      buffer >> vec_dataInd[idx];       
    1231       buffer >> vec_mask[idx]; 
    12321227 
    12331228      buffer >> hasValue; 
     
    12561251    globalLocalIndexMap_.rehash(std::ceil(index.numElements()/globalLocalIndexMap_.max_load_factor())); 
    12571252    nbIndexGlob = 0; 
     1253    int nbIndLoc = 0; 
    12581254    for (idx = 0; idx < nbReceived; ++idx) 
    12591255    { 
     
    12621258      { 
    12631259         gloInd = tmp(ind); 
     1260         nbIndLoc = (gloInd % n_glo)-begin; 
    12641261         if (0 == globalLocalIndexMap_.count(gloInd)) 
    12651262         { 
    1266            index(nbIndexGlob) = gloInd % n_glo;            
    1267            globalLocalIndexMap_[gloInd] = nbIndexGlob;   
     1263           index(nbIndexGlob) = gloInd % n_glo; 
     1264           globalLocalIndexMap_[gloInd] = nbIndexGlob; 
    12681265           ++nbIndexGlob; 
    12691266         }  
     
    12781275    CArray<int,1> nonCompressedData(nbData); 
    12791276    nonCompressedData = -1;    
    1280     mask.resize(nbData); 
     1277    // Mask is incorporated into data_index and is not sent/received anymore 
     1278    mask.resize(0); 
    12811279    if (hasValue) 
    12821280      value.resize(nbData); 
     
    12911289      CArray<int,1>& indi = vec_indi[idx]; 
    12921290      CArray<int,1>& dataIndi = vec_dataInd[idx]; 
    1293       CArray<bool,1>& maskIndi = vec_mask[idx]; 
    12941291      int nb = indi.numElements(); 
    12951292      for (int n = 0; n < nb; ++n) 
     
    12991296        nonCompressedData(locInd) = (-1 == nonCompressedData(locInd)) ? dataIndi(n) : nonCompressedData(locInd); 
    13001297 
    1301         if (!mask(locInd)) // Only rewrite mask if it's not true 
    1302           mask(locInd) = maskIndi(n); 
    1303          
    13041298        if (hasValue) 
    13051299          value(locInd) = vec_val[idx](n); 
     
    13161310    } 
    13171311     
    1318     int nbCompressedData = 0;  
     1312    int nbCompressedData = 0; 
    13191313    for (idx = 0; idx < nonCompressedData.numElements(); ++idx) 
    13201314    { 
    13211315      if (0 <= nonCompressedData(idx)) 
    1322         ++nbCompressedData;         
     1316        ++nbCompressedData; 
    13231317    } 
    13241318 
     
    13301324      { 
    13311325        data_index(nbCompressedData) = idx % n; 
    1332         ++nbCompressedData;         
     1326        ++nbCompressedData; 
    13331327      } 
    13341328    } 
    13351329 
    13361330    data_begin.setValue(0); 
    1337   } 
     1331    data_n.setValue(data_index.numElements()); 
     1332  } 
     1333  CATCH_DUMP_ATTR 
    13381334 
    13391335  /*! 
     
    13451341  */ 
    13461342  bool CAxis::isEqual(CAxis* obj) 
     1343  TRY 
    13471344  { 
    13481345    vector<StdString> excludedAttr; 
     
    13681365    return objEqual; 
    13691366  } 
     1367  CATCH_DUMP_ATTR 
    13701368 
    13711369  /* 
     
    13751373  */ 
    13761374  CTransformation<CAxis>* CAxis::addTransformation(ETranformationType transType, const StdString& id) 
     1375  TRY 
    13771376  { 
    13781377    transformationMap_.push_back(std::make_pair(transType, CTransformation<CAxis>::createTransformation(transType,id))); 
    13791378    return transformationMap_.back().second; 
    13801379  } 
     1380  CATCH_DUMP_ATTR 
    13811381 
    13821382  /* 
     
    13841384  */ 
    13851385  bool CAxis::hasTransformation() 
     1386  TRY 
    13861387  { 
    13871388    return (!transformationMap_.empty()); 
    13881389  } 
     1390  CATCH_DUMP_ATTR 
    13891391 
    13901392  /* 
     
    13931395  */ 
    13941396  void CAxis::setTransformations(const TransMapTypes& axisTrans) 
     1397  TRY 
    13951398  { 
    13961399    transformationMap_ = axisTrans; 
    13971400  } 
     1401  CATCH_DUMP_ATTR 
    13981402 
    13991403  /* 
     
    14021406  */ 
    14031407  CAxis::TransMapTypes CAxis::getAllTransformations(void) 
     1408  TRY 
    14041409  { 
    14051410    return transformationMap_; 
    14061411  } 
     1412  CATCH_DUMP_ATTR 
    14071413 
    14081414  /* 
     
    14111417  */ 
    14121418  void CAxis::duplicateTransformation(CAxis* src) 
     1419  TRY 
    14131420  { 
    14141421    if (src->hasTransformation()) 
     
    14171424    } 
    14181425  } 
     1426  CATCH_DUMP_ATTR 
    14191427 
    14201428  /*! 
     
    14221430   */ 
    14231431  void CAxis::solveInheritanceTransformation() 
     1432  TRY 
    14241433  { 
    14251434    if (hasTransformation() || !hasDirectAxisReference()) 
     
    14381447        refAxis[i]->setTransformations(axis->getAllTransformations()); 
    14391448  } 
     1449  CATCH_DUMP_ATTR 
    14401450 
    14411451  void CAxis::setContextClient(CContextClient* contextClient) 
     1452  TRY 
    14421453  { 
    14431454    if (clientsSet.find(contextClient)==clientsSet.end()) 
     
    14461457      clientsSet.insert(contextClient); 
    14471458    } 
    1448 } 
     1459  } 
     1460  CATCH_DUMP_ATTR 
    14491461 
    14501462  void CAxis::parse(xml::CXMLNode & node) 
     1463  TRY 
    14511464  { 
    14521465    SuperClass::parse(node); 
     
    14621475 
    14631476        nodeElementName = node.getElementName(); 
    1464  
    1465         if(transformationMapList_ptr == 0) initializeTransformationMap(); 
    1466         std::map<StdString, ETranformationType>::const_iterator ite = (*CAxis::transformationMapList_ptr).end(), it; 
    1467         it = (*CAxis::transformationMapList_ptr).find(nodeElementName); 
     1477        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
     1478        it = transformationMapList_.find(nodeElementName); 
    14681479        if (ite != it) 
    14691480        { 
     
    14811492    } 
    14821493  } 
     1494  CATCH_DUMP_ATTR 
    14831495 
    14841496  DEFINE_REF_FUNC(Axis,axis) 
  • XIOS/dev/branch_openmp/src/node/axis.hpp

    r1545 r1642  
    1717#include "transformation_enum.hpp" 
    1818 
    19 #include "mpi_std.hpp" 
    20  
    2119namespace xios { 
    2220   /// ////////////////////// Déclarations ////////////////////// /// 
     
    3129   BEGIN_DECLARE_ATTRIBUTE_MAP(CAxis) 
    3230#  include "axis_attribute.conf" 
    33 #  include "axis_attribute_private.conf" 
    3431   END_DECLARE_ATTRIBUTE_MAP(CAxis) 
    3532 
     
    123120         CTransformation<CAxis>* addTransformation(ETranformationType transType, const StdString& id=""); 
    124121         bool isEqual(CAxis* axis); 
    125          bool zoomByIndex(); 
    126122 
    127123      public:  
    128124        bool hasValue;         
    129         CArray<size_t,1> localIndexToWriteOnServer;         
     125        bool hasBounds; 
     126        bool hasLabel; 
     127 
     128        CArray<int,1> localIndexToWriteOnServer; 
    130129 
    131130      private: 
    132131         void checkData(); 
    133132         void checkMask(); 
    134          void checkZoom(); 
    135133         void checkBounds(); 
    136134         void checkLabel(); 
     
    175173         std::map<int, CArray<int, 1> > compressedIndexToWriteOnServer; 
    176174         std::map<int, std::vector<int> > connectedServerRank_; 
    177          bool hasBounds; 
    178          bool hasLabel;          
    179175         bool computedWrittenIndex_;                   
    180176 
    181177       private: 
    182178         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    183          static bool initializeTransformationMap(); 
    184          static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
    185          #pragma omp threadprivate(transformationMapList_ptr) 
     179         static std::map<StdString, ETranformationType> transformationMapList_; 
    186180         static bool dummyTransformationMapList_; 
    187          #pragma omp threadprivate(dummyTransformationMapList_) 
    188181 
    189182         DECLARE_REF_FUNC(Axis,axis) 
  • XIOS/dev/branch_openmp/src/node/compute_connectivity_domain.hpp

    r1331 r1642  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CComputeConnectivityDomain 
    6463 
  • XIOS/dev/branch_openmp/src/node/context.cpp

    r1545 r1642  
    2121#include "distribute_file_server2.hpp" 
    2222 
    23 using namespace ep_lib; 
    24  
    2523namespace xios { 
    2624 
    27   std::shared_ptr<CContextGroup> * CContext::root_ptr = 0; 
     25  std::shared_ptr<CContextGroup> CContext::root; 
    2826 
    2927   /// ////////////////////// Définitions ////////////////////// /// 
     
    3533      , idServer_(), client(0), server(0) 
    3634      , allProcessed(false), countChildCtx_(0) 
     35 
    3736   { /* Ne rien faire de plus */ } 
    3837 
     
    6766   */ 
    6867   CContextGroup* CContext::getRoot(void) 
    69    { 
    70       if(root_ptr == 0) root_ptr = new std::shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())); 
    71       return root_ptr->get(); 
    72    } 
     68   TRY 
     69   { 
     70      if (root.get()==NULL) root=std::shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())); 
     71      return root.get(); 
     72   } 
     73   CATCH 
    7374 
    7475   //---------------------------------------------------------------- 
     
    7980   */ 
    8081   std::shared_ptr<CCalendar> CContext::getCalendar(void) const 
     82   TRY 
    8183   { 
    8284      return (this->calendar); 
    8385   } 
     86   CATCH 
    8487 
    8588   //---------------------------------------------------------------- 
     
    9093   */ 
    9194   void CContext::setCalendar(std::shared_ptr<CCalendar> newCalendar) 
     95   TRY 
    9296   { 
    9397      this->calendar = newCalendar; 
    9498   } 
     99   CATCH_DUMP_ATTR 
    95100 
    96101   //---------------------------------------------------------------- 
     
    100105   */ 
    101106   void CContext::parse(xml::CXMLNode & node) 
     107   TRY 
    102108   { 
    103109      CContext::SuperClass::parse(node); 
     
    154160      } 
    155161   } 
     162   CATCH_DUMP_ATTR 
    156163 
    157164   //---------------------------------------------------------------- 
    158165   //! Show tree structure of context 
    159166   void CContext::ShowTree(StdOStream & out) 
     167   TRY 
    160168   { 
    161169      StdString currentContextId = CContext::getCurrent() -> getId(); 
     
    178186      CContext::setCurrent(currentContextId); 
    179187   } 
    180  
     188   CATCH 
    181189 
    182190   //---------------------------------------------------------------- 
     
    184192   //! Convert context object into string (to print) 
    185193   StdString CContext::toString(void) const 
     194   TRY 
    186195   { 
    187196      StdOStringStream oss; 
     
    203212 
    204213      } 
    205  
    206214      oss << "</" << CContext::GetName() << " >"; 
    207  
    208215      return (oss.str()); 
    209216   } 
     217   CATCH 
    210218 
    211219   //---------------------------------------------------------------- 
     
    218226   */ 
    219227   void CContext::solveDescInheritance(bool apply, const CAttributeMap * const UNUSED(parent)) 
     228   TRY 
    220229   { 
    221230#define DECLARE_NODE(Name_, name_)    \ 
     
    225234#include "node_type.conf" 
    226235   } 
     236   CATCH_DUMP_ATTR 
    227237 
    228238   //---------------------------------------------------------------- 
     
    230240   //! Verify if all root definition in the context have child. 
    231241   bool CContext::hasChild(void) const 
     242   TRY 
    232243   { 
    233244      return ( 
     
    238249      false); 
    239250} 
     251   CATCH 
    240252 
    241253   //---------------------------------------------------------------- 
    242254 
    243255   void CContext::CleanTree(void) 
     256   TRY 
    244257   { 
    245258#define DECLARE_NODE(Name_, name_) C##Name_##Definition::ClearAllAttributes(); 
     
    247260#include "node_type.conf" 
    248261   } 
     262   CATCH 
     263 
    249264   ///--------------------------------------------------------------- 
    250265 
    251266   //! Initialize client side 
    252267   void CContext::initClient(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtServer /*= 0*/) 
     268   TRY 
    253269   { 
    254270 
     
    257273      
    258274 
    259      if (CServer::serverLevel != 1) // initClient is called by client 
     275     if (CServer::serverLevel != 1) 
     276      // initClient is called by client 
    260277     { 
    261278       client = new CContextClient(this, intraComm, interComm, cxtServer); 
     
    288305       server = new CContextServer(this, intraCommServer, interCommServer); 
    289306     } 
    290  
    291      else // initClient is called by primary server 
     307     else 
     308     // initClient is called by primary server 
    292309     { 
    293310       clientPrimServer.push_back(new CContextClient(this, intraComm, interComm)); 
     
    299316     } 
    300317   } 
     318   CATCH_DUMP_ATTR 
    301319 
    302320   /*! 
     
    307325  */ 
    308326   void CContext::setClientServerBuffer(CContextClient* contextClient, bool bufferForWriting) 
     327   TRY 
    309328   { 
    310329      // Estimated minimum event size for small events (10 is an arbitrary constant just for safety) 
     
    353372     } 
    354373     contextClient->setBufferSize(bufferSize, maxEventSize); 
    355  
    356    } 
     374   } 
     375   CATCH_DUMP_ATTR 
    357376 
    358377   //! Verify whether a context is initialized 
    359378   bool CContext::isInitialized(void) 
     379   TRY 
    360380   { 
    361381     return hasClient; 
    362382   } 
     383   CATCH_DUMP_ATTR 
    363384 
    364385   void CContext::initServer(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtClient /*= 0*/) 
     386   TRY 
    365387   { 
    366388     hasServer=true; 
     
    395417     client = new CContextClient(this,intraCommClient,interCommClient, cxtClient); 
    396418   } 
     419   CATCH_DUMP_ATTR 
    397420 
    398421   //! Try to send the buffers and receive possible answers 
    399422  bool CContext::checkBuffersAndListen(bool enableEventsProcessing /*= true*/) 
     423  TRY 
    400424  { 
    401425    bool clientReady, serverFinished; 
     
    435459    } 
    436460  } 
     461   CATCH_DUMP_ATTR 
    437462 
    438463   //! Terminate a context 
    439464   void CContext::finalize(void) 
     465   TRY 
    440466   { 
    441467      if (hasClient && !hasServer) // For now we only use server level 1 to read data 
     
    480506         comms.clear(); 
    481507 
    482          #pragma omp critical (_output) 
    483508         info(20)<<"CContext: Context <"<<getId()<<"> is finalized."<<endl; 
    484509       } 
     
    496521       { 
    497522         // Blocking send of context finalize message to its client (e.g. primary server or model) 
    498          #pragma omp critical (_output) 
    499523         info(100)<<"DEBUG: context "<<getId()<<" Send client finalize<<"<<endl ; 
    500524         client->finalize(); 
     
    524548         comms.clear(); 
    525549 
    526          #pragma omp critical (_output) 
    527550         info(20)<<"CContext: Context <"<<getId()<<"> is finalized."<<endl; 
    528551       } 
     
    531554     } 
    532555   } 
     556   CATCH_DUMP_ATTR 
    533557 
    534558   //! Free internally allocated communicators 
    535559   void CContext::freeComms(void) 
     560   TRY 
    536561   { 
    537562     for (std::list<ep_lib::MPI_Comm>::iterator it = comms.begin(); it != comms.end(); ++it) 
     
    539564     comms.clear(); 
    540565   } 
     566   CATCH_DUMP_ATTR 
    541567 
    542568   //! Deallocate buffers allocated by clientContexts 
    543569   void CContext::releaseClientBuffers(void) 
     570   TRY 
    544571   { 
    545572     client->releaseBuffers(); 
     
    547574       clientPrimServer[i]->releaseBuffers(); 
    548575   } 
     576   CATCH_DUMP_ATTR 
    549577 
    550578   void CContext::postProcessingGlobalAttributes() 
     579   TRY 
    551580   { 
    552581     if (allProcessed) return;   
     
    612641     allProcessed = true; 
    613642   } 
     643   CATCH_DUMP_ATTR 
    614644 
    615645   void CContext::sendPostProcessingGlobalAttributes() 
     646   TRY 
    616647   { 
    617648      // Use correct context client to send message 
     
    638669     } 
    639670   } 
     671   CATCH_DUMP_ATTR 
    640672 
    641673   void CContext::recvPostProcessingGlobalAttributes(CEventServer& event) 
     674   TRY 
    642675   { 
    643676      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    646679      get(id)->recvPostProcessingGlobalAttributes(*buffer); 
    647680   } 
     681   CATCH 
    648682 
    649683   void CContext::recvPostProcessingGlobalAttributes(CBufferIn& buffer) 
     684   TRY 
    650685   {       
    651686      postProcessingGlobalAttributes(); 
    652687   } 
     688   CATCH_DUMP_ATTR 
    653689 
    654690   /*! 
     
    661697   and the active fields (fields will be written onto active files) 
    662698   */ 
     699 
    663700   void CContext::closeDefinition(void) 
     701   TRY 
    664702   { 
    665703    CTimer::get("Context : close definition").resume() ; 
     
    692730    CTimer::get("Context : close definition").suspend() ; 
    693731   } 
     732   CATCH_DUMP_ATTR 
    694733 
    695734   void CContext::findAllEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 
     735   TRY 
    696736   { 
    697737     for (unsigned int i = 0; i < activeFiles.size(); i++) 
    698738     (void)activeFiles[i]->getEnabledFields(); 
    699739   } 
     740   CATCH_DUMP_ATTR 
    700741 
    701742   void CContext::readAttributesOfEnabledFieldsInReadModeFiles() 
     743   TRY 
    702744   { 
    703745      for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) 
    704746        (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); 
    705747   } 
     748   CATCH_DUMP_ATTR 
    706749 
    707750   void CContext::sendGridComponentEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 
     751   TRY 
    708752   { 
    709753     int size = activeFiles.size(); 
     
    713757     } 
    714758   } 
     759   CATCH_DUMP_ATTR 
    715760 
    716761   /*! 
     
    719764   */ 
    720765   void CContext::sendGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 
     766   TRY 
    721767   { 
    722768     int size = activeFiles.size(); 
     
    726772     } 
    727773   } 
     774   CATCH_DUMP_ATTR 
    728775 
    729776   void CContext::checkGridEnabledFields() 
     777   TRY 
    730778   { 
    731779     int size = enabledFiles.size(); 
     
    735783     } 
    736784   } 
     785   CATCH_DUMP_ATTR 
    737786 
    738787   /*! 
     
    741790   */ 
    742791   void CContext::checkGridEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 
     792   TRY 
    743793   { 
    744794     int size = activeFiles.size(); 
     
    748798     } 
    749799   } 
     800   CATCH_DUMP_ATTR 
    750801 
    751802    /*! 
     
    755806   */ 
    756807   void CContext::solveOnlyRefOfEnabledFields(bool sendToServer) 
     808   TRY 
    757809   { 
    758810     int size = this->enabledFiles.size(); 
     
    767819     } 
    768820   } 
     821   CATCH_DUMP_ATTR 
    769822 
    770823    /*! 
     
    775828   */ 
    776829   void CContext::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 
     830   TRY 
    777831   { 
    778832     int size = this->enabledFiles.size(); 
     
    782836     } 
    783837   } 
     838   CATCH_DUMP_ATTR 
    784839 
    785840   void CContext::buildFilterGraphOfEnabledFields() 
     841   TRY 
    786842   { 
    787843     int size = this->enabledFiles.size(); 
     
    791847     } 
    792848   } 
     849   CATCH_DUMP_ATTR 
    793850 
    794851   void CContext::postProcessFilterGraph() 
     852   TRY 
    795853   { 
    796854     int size = enabledFiles.size(); 
     
    800858     } 
    801859   } 
     860   CATCH_DUMP_ATTR 
    802861 
    803862   void CContext::startPrefetchingOfEnabledReadModeFiles() 
     863   TRY 
    804864   { 
    805865     int size = enabledReadModeFiles.size(); 
     
    809869     } 
    810870   } 
     871   CATCH_DUMP_ATTR 
    811872 
    812873   void CContext::doPreTimestepOperationsForEnabledReadModeFiles() 
     874   TRY 
    813875   { 
    814876     int size = enabledReadModeFiles.size(); 
     
    818880     } 
    819881   } 
     882   CATCH_DUMP_ATTR 
    820883 
    821884   void CContext::doPostTimestepOperationsForEnabledReadModeFiles() 
     885   TRY 
    822886   { 
    823887     int size = enabledReadModeFiles.size(); 
     
    827891     } 
    828892   } 
     893   CATCH_DUMP_ATTR 
    829894 
    830895  void CContext::findFieldsWithReadAccess(void) 
     896  TRY 
    831897  { 
    832898    fieldsWithReadAccess.clear(); 
     
    842908    } 
    843909  } 
     910  CATCH_DUMP_ATTR 
    844911 
    845912  void CContext::solveAllRefOfFieldsWithReadAccess() 
     913  TRY 
    846914  { 
    847915    for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) 
    848916      fieldsWithReadAccess[i]->solveAllReferenceEnabledField(false); 
    849917  } 
     918  CATCH_DUMP_ATTR 
    850919 
    851920  void CContext::buildFilterGraphOfFieldsWithReadAccess() 
     921  TRY 
    852922  { 
    853923    for (size_t i = 0; i < fieldsWithReadAccess.size(); ++i) 
    854924      fieldsWithReadAccess[i]->buildFilterGraph(garbageCollector, true); 
    855925  } 
     926  CATCH_DUMP_ATTR 
    856927 
    857928   void CContext::solveAllInheritance(bool apply) 
     929   TRY 
    858930   { 
    859931     // Résolution des héritages descendants (càd des héritages de groupes) 
     
    878950 
    879951   } 
     952  CATCH_DUMP_ATTR 
    880953 
    881954   void CContext::findEnabledFiles(void) 
     955   TRY 
    882956   { 
    883957      const std::vector<CFile*> allFiles = CFile::getAll(); 
     
    9281002 
    9291003   } 
     1004   CATCH_DUMP_ATTR 
    9301005 
    9311006   void CContext::distributeFiles(void) 
     1007   TRY 
    9321008   { 
    9331009     bool distFileMemory=false ; 
     
    9371013     else distributeFileOverBandwith() ; 
    9381014   } 
    939  
     1015   CATCH_DUMP_ATTR 
    9401016 
    9411017   void CContext::distributeFileOverBandwith(void) 
     1018   TRY 
    9421019   { 
    9431020     double eps=std::numeric_limits<double>::epsilon()*10 ; 
     
    10061083       } 
    10071084 
    1008        for (std::multimap<double,int>:: iterator it=poolDataSize.begin() ; it!=poolDataSize.end(); ++it) 
    1009        { 
    1010          #pragma omp critical (_output) 
    1011          info(30)<<"Load Balancing for servers (perfect=1) : "<<it->second<<" :  ratio "<<it->first*1./dataPerPool<<endl ; 
    1012        } 
    1013  
     1085       for (std::multimap<double,int>:: iterator it=poolDataSize.begin() ; it!=poolDataSize.end(); ++it) info(30)<<"Load Balancing for servers (perfect=1) : "<<it->second<<" :  ratio "<<it->first*1./dataPerPool<<endl ; 
     1086  
    10141087       for (int i = 0; i < this->enabledReadModeFiles.size(); ++i) 
    10151088       { 
     
    10231096     } 
    10241097   } 
     1098   CATCH_DUMP_ATTR 
    10251099 
    10261100   void CContext::distributeFileOverMemoryBandwith(void) 
     1101   TRY 
    10271102   { 
    10281103     // If primary server 
     
    10991174       } 
    11001175 
    1101        for (int i = 0; i < nbPools; ++i) 
    1102        { 
    1103          #pragma omp critical (_output) 
    1104          info(100)<<"Pool server level2 "<<i<<"   assigned file bandwith "<<bandwithSize[i]*86400.*4./1024/1024.<<" Mb / days"<<endl ; 
    1105        } 
    1106        for (int i = 0; i < nbPools; ++i) 
    1107        { 
    1108          #pragma omp critical (_output) 
    1109          info(100)<<"Pool server level2 "<<i<<"   assigned grid memory "<<memorySize[i]*100/1024./1024.<<" Mb"<<endl ; 
    1110        } 
     1176       for (int i = 0; i < nbPools; ++i) info(100)<<"Pool server level2 "<<i<<"   assigned file bandwith "<<bandwithSize[i]*86400.*4./1024/1024.<<" Mb / days"<<endl ; 
     1177       for (int i = 0; i < nbPools; ++i) info(100)<<"Pool server level2 "<<i<<"   assigned grid memory "<<memorySize[i]*100/1024./1024.<<" Mb"<<endl ; 
     1178 
    11111179 
    11121180       for (int i = 0; i < this->enabledReadModeFiles.size(); ++i) 
     
    11221190   } 
    11231191} 
    1124  
    1125  
     1192   CATCH_DUMP_ATTR 
    11261193 
    11271194   /*! 
     
    11291196   */ 
    11301197   void CContext::findEnabledWriteModeFiles(void) 
     1198   TRY 
    11311199   { 
    11321200     int size = this->enabledFiles.size(); 
     
    11381206     } 
    11391207   } 
     1208   CATCH_DUMP_ATTR 
    11401209 
    11411210   /*! 
     
    11431212   */ 
    11441213   void CContext::findEnabledReadModeFiles(void) 
     1214   TRY 
    11451215   { 
    11461216     int size = this->enabledFiles.size(); 
     
    11511221     } 
    11521222   } 
     1223   CATCH_DUMP_ATTR 
    11531224 
    11541225   void CContext::closeAllFile(void) 
     1226   TRY 
    11551227   { 
    11561228     std::vector<CFile*>::const_iterator 
     
    11591231     for (; it != end; it++) 
    11601232     { 
    1161        #pragma omp critical (_output) 
    11621233       info(30)<<"Closing File : "<<(*it)->getId()<<endl; 
    11631234       (*it)->close(); 
    11641235     } 
    11651236   } 
     1237   CATCH_DUMP_ATTR 
    11661238 
    11671239   /*! 
     
    11731245   */ 
    11741246   bool CContext::dispatchEvent(CEventServer& event) 
     1247   TRY 
    11751248   { 
    11761249 
     
    12141287      } 
    12151288   } 
     1289   CATCH 
    12161290 
    12171291   //! Client side: Send a message to server to make it close 
    12181292   void CContext::sendCloseDefinition(void) 
     1293   TRY 
    12191294   { 
    12201295     // Use correct context client to send message 
     
    12391314     } 
    12401315   } 
     1316   CATCH_DUMP_ATTR 
    12411317 
    12421318   //! Server side: Receive a message of client announcing a context close 
    12431319   void CContext::recvCloseDefinition(CEventServer& event) 
     1320   TRY 
    12441321   { 
    12451322      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    12481325      get(id)->closeDefinition(); 
    12491326   } 
     1327   CATCH 
    12501328 
    12511329   //! Client side: Send a message to update calendar in each time step 
    12521330   void CContext::sendUpdateCalendar(int step) 
     1331   TRY 
    12531332   { 
    12541333     // Use correct context client to send message 
     
    12741353     } 
    12751354   } 
     1355   CATCH_DUMP_ATTR 
    12761356 
    12771357   //! Server side: Receive a message of client annoucing calendar update 
    12781358   void CContext::recvUpdateCalendar(CEventServer& event) 
     1359   TRY 
    12791360   { 
    12801361      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    12831364      get(id)->recvUpdateCalendar(*buffer); 
    12841365   } 
     1366   CATCH 
    12851367 
    12861368   //! Server side: Receive a message of client annoucing calendar update 
    12871369   void CContext::recvUpdateCalendar(CBufferIn& buffer) 
     1370   TRY 
    12881371   { 
    12891372      int step; 
     
    12951378      } 
    12961379   } 
     1380   CATCH_DUMP_ATTR 
    12971381 
    12981382   //! Client side: Send a message to create header part of netcdf file 
    12991383   void CContext::sendCreateFileHeader(void) 
     1384   TRY 
    13001385   { 
    13011386     // Use correct context client to send message 
     
    13221407     } 
    13231408   } 
     1409   CATCH_DUMP_ATTR 
    13241410 
    13251411   //! Server side: Receive a message of client annoucing the creation of header part of netcdf file 
    13261412   void CContext::recvCreateFileHeader(CEventServer& event) 
     1413   TRY 
    13271414   { 
    13281415      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    13311418      get(id)->recvCreateFileHeader(*buffer); 
    13321419   } 
     1420   CATCH 
    13331421 
    13341422   //! Server side: Receive a message of client annoucing the creation of header part of netcdf file 
    13351423   void CContext::recvCreateFileHeader(CBufferIn& buffer) 
     1424   TRY 
    13361425   { 
    13371426      if (!hasClient && hasServer)  
    13381427        createFileHeader(); 
    13391428   } 
     1429   CATCH_DUMP_ATTR 
    13401430 
    13411431   //! Client side: Send a message to do some post processing on server 
    13421432   void CContext::sendProcessingGridOfEnabledFields() 
     1433   TRY 
    13431434   { 
    13441435      // Use correct context client to send message 
     
    13641455     } 
    13651456   } 
     1457   CATCH_DUMP_ATTR 
    13661458 
    13671459   //! Server side: Receive a message to do some post processing 
    13681460   void CContext::recvProcessingGridOfEnabledFields(CEventServer& event) 
     1461   TRY 
    13691462   { 
    13701463      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    13721465      *buffer>>id;       
    13731466   } 
     1467   CATCH 
    13741468 
    13751469   //! Client side: Send a message to do some post processing on server 
    13761470   void CContext::sendPostProcessing() 
     1471   TRY 
    13771472   { 
    13781473      // Use correct context client to send message 
     
    13981493     } 
    13991494   } 
     1495   CATCH_DUMP_ATTR 
    14001496 
    14011497   //! Server side: Receive a message to do some post processing 
    14021498   void CContext::recvPostProcessing(CEventServer& event) 
     1499   TRY 
    14031500   { 
    14041501      CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    14071504      get(id)->recvPostProcessing(*buffer); 
    14081505   } 
     1506   CATCH 
    14091507 
    14101508   //! Server side: Receive a message to do some post processing 
    14111509   void CContext::recvPostProcessing(CBufferIn& buffer) 
     1510   TRY 
    14121511   { 
    14131512      CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar(); 
    14141513      postProcessing(); 
    14151514   } 
     1515   CATCH_DUMP_ATTR 
    14161516 
    14171517   const StdString& CContext::getIdServer() 
     1518   TRY 
    14181519   { 
    14191520      if (hasClient) 
     
    14251526      if (hasServer) return (this->getId()); 
    14261527   } 
     1528   CATCH_DUMP_ATTR 
    14271529 
    14281530   const StdString& CContext::getIdServer(const int i) 
     1531   TRY 
    14291532   { 
    14301533     idServer_ = this->getId(); 
     
    14331536     return idServer_; 
    14341537   } 
    1435  
     1538   CATCH_DUMP_ATTR 
    14361539 
    14371540   /*! 
     
    14421545   */ 
    14431546   void CContext::postProcessing() 
     1547   TRY 
    14441548   { 
    14451549     if (isPostProcessed) return; 
     
    15041608      isPostProcessed = true; 
    15051609   } 
     1610   CATCH_DUMP_ATTR 
    15061611 
    15071612   /*! 
     
    15141619   std::map<int, StdSize> CContext::getAttributesBufferSize(std::map<int, StdSize>& maxEventSize, 
    15151620                                                           CContextClient* contextClient, bool bufferForWriting /*= "false"*/) 
     1621   TRY 
    15161622   { 
    15171623         // As calendar attributes are sent even if there are no active files or fields, maps are initialized according the size of calendar attributes 
     
    15451651     return attributesSize; 
    15461652   } 
     1653   CATCH_DUMP_ATTR 
    15471654 
    15481655   /*! 
     
    15551662   std::map<int, StdSize> CContext::getDataBufferSize(std::map<int, StdSize>& maxEventSize, 
    15561663                                                      CContextClient* contextClient, bool bufferForWriting /*= "false"*/) 
     1664   TRY 
    15571665   { 
    15581666     std::map<int, StdSize> dataSize; 
     
    15631671     for (size_t i = 0; i < numEnabledFiles; ++i) 
    15641672     { 
    1565 //       CFile* file = this->enabledFiles[i]; 
    15661673       CFile* file = fileList[i]; 
    15671674       if (file->getContextClient() == contextClient) 
     
    15911698     return dataSize; 
    15921699   } 
     1700   CATCH_DUMP_ATTR 
    15931701 
    15941702   //! Client side: Send infomation of active files (files are enabled to write out) 
    15951703   void CContext::sendEnabledFiles(const std::vector<CFile*>& activeFiles) 
     1704   TRY 
    15961705   { 
    15971706     int size = activeFiles.size(); 
     
    16111720     } 
    16121721   } 
     1722   CATCH_DUMP_ATTR 
    16131723 
    16141724   //! Client side: Send information of active fields (ones are written onto files) 
    16151725   void CContext::sendEnabledFieldsInFiles(const std::vector<CFile*>& activeFiles) 
     1726   TRY 
    16161727   { 
    16171728     int size = activeFiles.size(); 
     
    16211732     } 
    16221733   } 
     1734   CATCH_DUMP_ATTR 
    16231735 
    16241736   //! Client side: Check if the defined axis, domains and grids are eligible for compressed indexed output 
    16251737   void CContext::checkAxisDomainsGridsEligibilityForCompressedOutput() 
     1738   TRY 
    16261739   { 
    16271740     if (!hasClient) return; 
     
    16391752       (*it)->checkEligibilityForCompressedOutput(); 
    16401753   } 
     1754   CATCH_DUMP_ATTR 
    16411755 
    16421756   //! Client side: Prepare the timeseries by adding the necessary files 
    16431757   void CContext::prepareTimeseries() 
     1758   TRY 
    16441759   { 
    16451760     if (!hasClient) return; 
     
    17391854     } 
    17401855   } 
     1856   CATCH_DUMP_ATTR 
    17411857 
    17421858   //! Client side: Send information of reference grid of active fields 
    17431859   void CContext::sendRefGrid(const std::vector<CFile*>& activeFiles) 
     1860   TRY 
    17441861   { 
    17451862     std::set<StdString> gridIds; 
     
    17731890     } 
    17741891   } 
     1892   CATCH_DUMP_ATTR 
    17751893 
    17761894   //! Client side: Send information of reference domain, axis and scalar of active fields 
    17771895   void CContext::sendRefDomainsAxisScalars(const std::vector<CFile*>& activeFiles) 
     1896   TRY 
    17781897   { 
    17791898     std::set<StdString> domainIds, axisIds, scalarIds; 
     
    18341953     } 
    18351954   } 
     1955   CATCH_DUMP_ATTR 
    18361956 
    18371957   //! Update calendar in each time step 
    18381958   void CContext::updateCalendar(int step) 
     1959   TRY 
    18391960   { 
    18401961      int prevStep = calendar->getStep(); 
     
    18471968        } 
    18481969 
    1849         #pragma omp critical (_output) 
    18501970        info(50) << "updateCalendar : before : " << calendar->getCurrentDate() << endl; 
    18511971        calendar->update(step); 
    1852         #pragma omp critical (_output) 
    18531972        info(50) << "updateCalendar : after : " << calendar->getCurrentDate() << endl; 
    18541973  #ifdef XIOS_MEMTRACK_LIGHT 
    1855         #pragma omp critical (_output) 
    18561974        info(50) << " Current memory used by XIOS : "<<  MemTrack::getCurrentMemorySize()*1.0/(1024*1024)<<" Mbyte, at timestep "<<step<<" of context "<<this->getId()<<endl ; 
    18571975  #endif 
     
    18641982      } 
    18651983      else if (prevStep == step) 
    1866       { 
    1867         #pragma omp critical (_output) 
    18681984        info(50) << "updateCalendar: already at step " << step << ", no operation done." << endl; 
    1869       } 
    18701985      else // if (prevStep > step) 
    18711986        ERROR("void CContext::updateCalendar(int step)", 
    18721987              << "Illegal calendar update: previous step was " << prevStep << ", new step " << step << "is in the past!") 
    18731988   } 
     1989   CATCH_DUMP_ATTR 
    18741990 
    18751991   void CContext::initReadFiles(void) 
     1992   TRY 
    18761993   { 
    18771994      vector<CFile*>::const_iterator it; 
     
    18821999      } 
    18832000   } 
     2001   CATCH_DUMP_ATTR 
    18842002 
    18852003   //! Server side: Create header of netcdf file 
    18862004   void CContext::createFileHeader(void) 
     2005   TRY 
    18872006   { 
    18882007      vector<CFile*>::const_iterator it; 
     
    18942013      } 
    18952014   } 
     2015   CATCH_DUMP_ATTR 
    18962016 
    18972017   //! Get current context 
    18982018   CContext* CContext::getCurrent(void) 
     2019   TRY 
    18992020   { 
    19002021     return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()).get(); 
    19012022   } 
     2023   CATCH 
    19022024 
    19032025   /*! 
     
    19062028   */ 
    19072029   void CContext::setCurrent(const string& id) 
     2030   TRY 
    19082031   { 
    19092032     CObjectFactory::SetCurrentContextId(id); 
    19102033     CGroupFactory::SetCurrentContextId(id); 
    19112034   } 
     2035   CATCH 
    19122036 
    19132037  /*! 
     
    19172041  */ 
    19182042  CContext* CContext::create(const StdString& id) 
     2043  TRY 
    19192044  { 
    19202045    CContext::setCurrent(id); 
     
    19232048    CContext* context = CObjectFactory::CreateObject<CContext>(id).get(); 
    19242049    getRoot(); 
    1925     if (!hasctxt) CGroupFactory::AddChild(*root_ptr, context->getShared()); 
     2050    if (!hasctxt) CGroupFactory::AddChild(root, context->getShared()); 
    19262051 
    19272052#define DECLARE_NODE(Name_, name_) \ 
     
    19322057    return (context); 
    19332058  } 
    1934  
     2059  CATCH 
    19352060 
    19362061     //! Server side: Receive a message to do some post processing 
    19372062  void CContext::recvRegistry(CEventServer& event) 
     2063  TRY 
    19382064  { 
    19392065    CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    19422068    get(id)->recvRegistry(*buffer); 
    19432069  } 
     2070  CATCH 
    19442071 
    19452072  void CContext::recvRegistry(CBufferIn& buffer) 
     2073  TRY 
    19462074  { 
    19472075    if (server->intraCommRank==0) 
     
    19522080    } 
    19532081  } 
     2082  CATCH_DUMP_ATTR 
    19542083 
    19552084  void CContext::sendRegistry(void) 
     2085  TRY 
    19562086  { 
    19572087    registryOut->hierarchicalGatherRegistry() ; 
     
    19792109    } 
    19802110  } 
     2111  CATCH_DUMP_ATTR 
    19812112 
    19822113  /*! 
     
    19852116  */ 
    19862117  bool CContext::isFinalized(void) 
     2118  TRY 
    19872119  { 
    19882120    return finalized; 
    19892121  } 
     2122  CATCH_DUMP_ATTR 
     2123  ///-------------------------------------------------------------- 
     2124  StdString CContext::dumpClassAttributes(void) 
     2125  { 
     2126    StdString str; 
     2127    str.append("enabled files=\""); 
     2128    int size = this->enabledFiles.size(); 
     2129    for (int i = 0; i < size; ++i) 
     2130    { 
     2131      str.append(enabledFiles[i]->getId()); 
     2132      str.append(" "); 
     2133    } 
     2134    str.append("\""); 
     2135    return str; 
     2136  } 
    19902137 
    19912138} // namespace xios 
  • XIOS/dev/branch_openmp/src/node/context.hpp

    r1545 r1642  
    55#include "xios_spl.hpp" 
    66//#include "node_type.hpp" 
    7 #include "mpi_std.hpp" 
    87#include "calendar_wrapper.hpp" 
    98 
     
    1211#include "garbage_collector.hpp" 
    1312#include "registry.hpp" 
     13#include "mpi.hpp" 
    1414 
    1515 
     
    9191         void initServer(ep_lib::MPI_Comm intraComm, ep_lib::MPI_Comm interComm, CContext* cxtClient = 0); 
    9292         bool isInitialized(void); 
     93 
     94         StdString dumpClassAttributes(void); 
    9395 
    9496         // Put sever or client into loop state 
     
    143145         void distributeFileOverMemoryBandwith() ; 
    144146          
    145  
    146147         // Send context close definition 
    147148         void sendCloseDefinition(void); 
     
    239240 
    240241         // Context root 
    241          static std::shared_ptr<CContextGroup> *root_ptr; 
    242          #pragma omp threadprivate(root_ptr) 
     242         static std::shared_ptr<CContextGroup> root; 
    243243 
    244244         // Determine context on client or not 
  • XIOS/dev/branch_openmp/src/node/domain.cpp

    r1545 r1642  
    1919#include "client_server_mapping_distributed.hpp" 
    2020 
    21 using namespace ep_lib; 
    22  
    2321#include <algorithm> 
    2422 
     
    3230      , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 
    3331      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    34       , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) 
     32      , isRedistributed_(false), hasPole(false) 
    3533      , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() 
    3634      , globalLocalIndexMap_(), computedWrittenIndex_(false) 
    37           , clients() 
     35      , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) 
     36      , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) 
    3837   { 
    3938   } 
     
    4443      , hasBounds(false), hasArea(false), isCompressible_(false), isUnstructed_(false) 
    4544      , isClientAfterTransformationChecked(false), hasLonLat(false) 
    46       , isRedistributed_(false), hasPole(false), doZoomByIndex_(false) 
     45      , isRedistributed_(false), hasPole(false) 
    4746      , lonvalue(), latvalue(), bounds_lonvalue(), bounds_latvalue() 
    4847      , globalLocalIndexMap_(), computedWrittenIndex_(false) 
    49           , clients() 
     48      , clients(), hasLatInReadFile_(false), hasBoundsLatInReadFile_(false) 
     49      , hasLonInReadFile_(false), hasBoundsLonInReadFile_(false) 
    5050   { 
    5151    } 
     
    5858 
    5959   void CDomain::assignMesh(const StdString meshName, const int nvertex) 
     60   TRY 
    6061   { 
    6162     mesh = CMesh::getMesh(meshName, nvertex); 
    6263   } 
     64   CATCH_DUMP_ATTR 
    6365 
    6466   CDomain* CDomain::createDomain() 
     67   TRY 
    6568   { 
    6669     CDomain* domain = CDomainGroup::get("domain_definition")->createChild(); 
    6770     return domain; 
    6871   } 
    69  
    70    std::map<StdString, ETranformationType> *CDomain::transformationMapList_ptr = 0; 
     72   CATCH 
     73 
     74   std::map<StdString, ETranformationType> CDomain::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     75   bool CDomain::_dummyTransformationMapList = CDomain::initializeTransformationMap(CDomain::transformationMapList_); 
    7176 
    7277   bool CDomain::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     78   TRY 
    7379   { 
    7480     m["zoom_domain"] = TRANS_ZOOM_DOMAIN; 
     
    7884     m["expand_domain"] = TRANS_EXPAND_DOMAIN; 
    7985     m["reorder_domain"] = TRANS_REORDER_DOMAIN; 
    80    } 
    81  
    82    bool CDomain::initializeTransformationMap() 
    83    { 
    84      CDomain::transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
    85      (*CDomain::transformationMapList_ptr)["zoom_domain"] = TRANS_ZOOM_DOMAIN; 
    86      (*CDomain::transformationMapList_ptr)["interpolate_domain"] = TRANS_INTERPOLATE_DOMAIN; 
    87      (*CDomain::transformationMapList_ptr)["generate_rectilinear_domain"] = TRANS_GENERATE_RECTILINEAR_DOMAIN; 
    88      (*CDomain::transformationMapList_ptr)["compute_connectivity_domain"] = TRANS_COMPUTE_CONNECTIVITY_DOMAIN; 
    89      (*CDomain::transformationMapList_ptr)["expand_domain"] = TRANS_EXPAND_DOMAIN; 
    90      (*CDomain::transformationMapList_ptr)["reorder_domain"] = TRANS_REORDER_DOMAIN; 
    91    } 
     86     m["extract_domain"] = TRANS_EXTRACT_DOMAIN; 
     87   } 
     88   CATCH 
    9289 
    9390   const std::set<StdString> & CDomain::getRelFiles(void) const 
     91   TRY 
    9492   { 
    9593      return (this->relFiles); 
    9694   } 
    97  
     95   CATCH 
    9896 
    9997   /*! 
     
    102100   */ 
    103101   int CDomain::getNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom) 
     102   TRY 
    104103   { 
    105104     int writtenSize; 
     
    107106     return numberWrittenIndexes_[writtenSize]; 
    108107   } 
     108   CATCH_DUMP_ATTR 
    109109 
    110110   /*! 
     
    113113   */ 
    114114   int CDomain::getTotalNumberWrittenIndexes(ep_lib::MPI_Comm writtenCom) 
     115   TRY 
    115116   { 
    116117     int writtenSize; 
     
    118119     return totalNumberWrittenIndexes_[writtenSize]; 
    119120   } 
     121   CATCH_DUMP_ATTR 
    120122 
    121123   /*! 
     
    124126   */ 
    125127   int CDomain::getOffsetWrittenIndexes(ep_lib::MPI_Comm writtenCom) 
     128   TRY 
    126129   { 
    127130     int writtenSize; 
     
    129132     return offsetWrittenIndexes_[writtenSize]; 
    130133   } 
     134   CATCH_DUMP_ATTR 
    131135 
    132136   CArray<int, 1>& CDomain::getCompressedIndexToWriteOnServer(ep_lib::MPI_Comm writtenCom) 
     137   TRY 
    133138   { 
    134139     int writtenSize; 
     
    136141     return compressedIndexToWriteOnServer[writtenSize]; 
    137142   } 
     143   CATCH_DUMP_ATTR 
    138144 
    139145   //---------------------------------------------------------------- 
     
    145151    */ 
    146152   std::map<int, StdSize> CDomain::getAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= false*/) 
     153   TRY 
    147154   { 
    148155 
     
    172179       // size estimation for sendIndex (and sendArea which is always smaller or equal) 
    173180       size_t sizeIndexEvent = 2 * sizeof(size_t) + 2 * CArray<int,1>::size(idxCount); 
    174        // if (isCompressible_) 
    175        // { 
    176        //   std::map<int, std::vector<int> >::const_iterator itWritten = indWrittenSrv_.find(rank); 
    177        //   size_t writtenIdxCount = (itWritten != itWrittenIndexEnd) ? itWritten->second.size() : 0; 
    178        //   sizeIndexEvent += CArray<int,1>::size(writtenIdxCount); 
    179        // } 
    180181 
    181182       // size estimation for sendLonLat 
     
    191192     return attributesSizes; 
    192193   } 
     194   CATCH_DUMP_ATTR 
    193195 
    194196   //---------------------------------------------------------------- 
    195197 
    196198   bool CDomain::isEmpty(void) const 
    197    { 
    198       return ((this->zoom_i_index.isEmpty()) || (0 == this->zoom_i_index.numElements())); 
    199  
    200    } 
     199   TRY 
     200   { 
     201     return ((this->i_index.isEmpty()) || (0 == this->i_index.numElements())); 
     202   } 
     203   CATCH 
    201204 
    202205   //---------------------------------------------------------------- 
    203206 
    204207   bool CDomain::IsWritten(const StdString & filename) const 
     208   TRY 
    205209   { 
    206210      return (this->relFiles.find(filename) != this->relFiles.end()); 
    207211   } 
     212   CATCH 
    208213 
    209214   bool CDomain::isWrittenCompressed(const StdString& filename) const 
     215   TRY 
    210216   { 
    211217      return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); 
    212218   } 
     219   CATCH 
    213220 
    214221   //---------------------------------------------------------------- 
    215222 
    216223   bool CDomain::isDistributed(void) const 
     224   TRY 
    217225   { 
    218226      bool distributed =  !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 
     
    222230      return distributed; 
    223231   } 
     232   CATCH 
    224233 
    225234   //---------------------------------------------------------------- 
     
    231240    */ 
    232241   bool CDomain::isCompressible(void) const 
     242   TRY 
    233243   { 
    234244      return isCompressible_; 
    235245   } 
     246   CATCH 
    236247 
    237248   void CDomain::addRelFile(const StdString & filename) 
     249   TRY 
    238250   { 
    239251      this->relFiles.insert(filename); 
    240252   } 
     253   CATCH_DUMP_ATTR 
    241254 
    242255   void CDomain::addRelFileCompressed(const StdString& filename) 
     256   TRY 
    243257   { 
    244258      this->relFilesCompressed.insert(filename); 
    245259   } 
     260   CATCH_DUMP_ATTR 
    246261 
    247262   StdString CDomain::GetName(void)   { return (StdString("domain")); } 
     
    256271   */ 
    257272   bool CDomain::distributionAttributesHaveValue() const 
     273   TRY 
    258274   { 
    259275      bool hasValues = true; 
     
    267283      return hasValues; 
    268284   } 
     285   CATCH 
    269286 
    270287   /*! 
     
    276293   */ 
    277294   void CDomain::redistribute(int nbLocalDomain) 
     295   TRY 
    278296   { 
    279297     if (this->isRedistributed_) return; 
     
    438456     checkDomain(); 
    439457   } 
     458   CATCH_DUMP_ATTR 
    440459 
    441460   /*! 
     
    443462   */ 
    444463   void CDomain::fillInLonLat() 
     464   TRY 
    445465   { 
    446466     switch (type) 
     
    460480     } 
    461481     completeLonLatClient() ; 
    462  
    463    } 
     482   } 
     483   CATCH_DUMP_ATTR 
    464484 
    465485   /*! 
     
    469489   */ 
    470490   void CDomain::fillInRectilinearLonLat() 
    471    { 
    472      if (!lonvalue_rectilinear_read_from_file.isEmpty()) 
     491   TRY 
     492   { 
     493     if (!lonvalue_rectilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty() && lonvalue_1d.isEmpty()) 
    473494     { 
    474495       lonvalue_1d.resize(ni); 
     
    478499       lon_end.setValue(lonvalue_rectilinear_read_from_file(ni_glo-1)); 
    479500     } 
    480      else 
     501     else if (!hasLonInReadFile_) 
    481502     { 
    482503       if (!lonvalue_2d.isEmpty()) lonvalue_2d.free(); 
     
    504525 
    505526 
    506      if (!latvalue_rectilinear_read_from_file.isEmpty()) 
     527     if (!latvalue_rectilinear_read_from_file.isEmpty() && latvalue_2d.isEmpty() && latvalue_1d.isEmpty()) 
    507528     { 
    508529       latvalue_1d.resize(nj); 
     
    512533       lat_end.setValue(latvalue_rectilinear_read_from_file(nj_glo-1)); 
    513534     } 
    514      else 
     535     else if (!hasLatInReadFile_) 
    515536     { 
    516537       if (!latvalue_2d.isEmpty()) latvalue_1d.free(); 
     
    537558     } 
    538559   } 
     560   CATCH_DUMP_ATTR 
    539561 
    540562    /* 
    541       Fill in longitude and latitude of curvilinear domain read from a file 
    542       If there are already longitude and latitude defined by model. We just igonore reading value. 
     563      Fill in 2D longitude and latitude of curvilinear domain read from a file. 
     564      If there are already longitude and latitude defined by model. We just ignore read value. 
    543565    */ 
    544566   void CDomain::fillInCurvilinearLonLat() 
    545    { 
    546      if (!lonvalue_curvilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty()) 
     567   TRY 
     568   { 
     569     if (!lonvalue_curvilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty() && lonvalue_1d.isEmpty()) 
    547570     { 
    548571       lonvalue_2d.resize(ni,nj); 
     
    554577     } 
    555578 
    556      if (!latvalue_curvilinear_read_from_file.isEmpty() && latvalue_2d.isEmpty()) 
     579     if (!latvalue_curvilinear_read_from_file.isEmpty() && latvalue_2d.isEmpty() && latvalue_1d.isEmpty()) 
    557580     { 
    558581       latvalue_2d.resize(ni,nj); 
     
    564587     } 
    565588 
    566      if (!bounds_lonvalue_curvilinear_read_from_file.isEmpty() && bounds_lon_2d.isEmpty()) 
     589     if (!bounds_lonvalue_curvilinear_read_from_file.isEmpty() && bounds_lon_2d.isEmpty() && bounds_lon_1d.isEmpty()) 
    567590     { 
    568591       bounds_lon_2d.resize(nvertex,ni,nj); 
     
    575598     } 
    576599 
    577      if (!bounds_latvalue_curvilinear_read_from_file.isEmpty() && bounds_lat_2d.isEmpty()) 
     600     if (!bounds_latvalue_curvilinear_read_from_file.isEmpty() && bounds_lat_2d.isEmpty() && bounds_lat_1d.isEmpty()) 
    578601     { 
    579602       bounds_lat_2d.resize(nvertex,ni,nj); 
     
    585608       bounds_latvalue_curvilinear_read_from_file.free(); 
    586609     } 
    587  
    588    } 
     610   } 
     611   CATCH_DUMP_ATTR 
    589612 
    590613    /* 
     
    593616    */ 
    594617   void CDomain::fillInUnstructuredLonLat() 
     618   TRY 
    595619   { 
    596620     if (i_index.isEmpty()) 
     
    644668     } 
    645669   } 
     670   CATCH_DUMP_ATTR 
    646671 
    647672  /* 
     
    649674  */ 
    650675   void CDomain::AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat, CArray<double,1>& lon_g, CArray<double,1>& lat_g) 
     676   TRY 
    651677   { 
    652678     CContext* context = CContext::getCurrent(); 
     
    664690     int v ; 
    665691     v=ibegin ; 
    666      ep_lib::MPI_Allgather(&v,1,MPI_INT,ibegin_g,1,MPI_INT,client->intraComm) ; 
     692     ep_lib::MPI_Allgather(&v,1,EP_INT,ibegin_g,1,EP_INT,client->intraComm) ; 
    667693     v=jbegin ; 
    668      ep_lib::MPI_Allgather(&v,1,MPI_INT,jbegin_g,1,MPI_INT,client->intraComm) ; 
     694     ep_lib::MPI_Allgather(&v,1,EP_INT,jbegin_g,1,EP_INT,client->intraComm) ; 
    669695     v=ni ; 
    670      ep_lib::MPI_Allgather(&v,1,MPI_INT,ni_g,1,MPI_INT,client->intraComm) ; 
     696     ep_lib::MPI_Allgather(&v,1,EP_INT,ni_g,1,EP_INT,client->intraComm) ; 
    671697     v=nj ; 
    672      ep_lib::MPI_Allgather(&v,1,MPI_INT,nj_g,1,MPI_INT,client->intraComm) ; 
    673  
    674      ep_lib::MPI_Allgatherv(lon.dataFirst(),ni,MPI_DOUBLE,lon_g.dataFirst(),ni_g, ibegin_g,MPI_DOUBLE,client->intraComm) ; 
    675      ep_lib::MPI_Allgatherv(lat.dataFirst(),nj,MPI_DOUBLE,lat_g.dataFirst(),nj_g, jbegin_g,MPI_DOUBLE,client->intraComm) ; 
     698     ep_lib::MPI_Allgather(&v,1,EP_INT,nj_g,1,EP_INT,client->intraComm) ; 
     699 
     700     ep_lib::MPI_Allgatherv(lon.dataFirst(),ni,EP_DOUBLE,lon_g.dataFirst(),ni_g, ibegin_g,EP_DOUBLE,client->intraComm) ; 
     701     ep_lib::MPI_Allgatherv(lat.dataFirst(),nj,EP_DOUBLE,lat_g.dataFirst(),nj_g, jbegin_g,EP_DOUBLE,client->intraComm) ; 
    676702 
    677703      delete[] ibegin_g ; 
     
    680706      delete[] nj_g ; 
    681707   } 
     708   CATCH_DUMP_ATTR 
    682709 
    683710   void CDomain::fillInRectilinearBoundLonLat(CArray<double,1>& lon, CArray<double,1>& lat, 
    684711                                              CArray<double,2>& boundsLon, CArray<double,2>& boundsLat) 
    685    { 
     712   TRY 
     713  { 
    686714     int i,j,k; 
    687715 
     
    782810      } 
    783811   } 
     812   CATCH_DUMP_ATTR 
    784813 
    785814   /* 
     
    787816   */ 
    788817   void CDomain::checkDomain(void) 
     818   TRY 
    789819   { 
    790820     if (type.isEmpty()) 
     
    877907         for (int i = 0; i < ni; ++i) j_index(i+j*ni) = j+jbegin; 
    878908     } 
    879       
    880      checkZoom(); 
    881    } 
    882  
    883    // Check global zoom of a domain 
    884    // If there is no zoom defined for the domain, zoom will have value of global doamin 
    885    void CDomain::checkZoom(void) 
    886    { 
    887      if (global_zoom_ibegin.isEmpty()) 
    888       global_zoom_ibegin.setValue(0); 
    889      if (global_zoom_ni.isEmpty()) 
    890       global_zoom_ni.setValue(ni_glo); 
    891      if (global_zoom_jbegin.isEmpty()) 
    892       global_zoom_jbegin.setValue(0); 
    893      if (global_zoom_nj.isEmpty()) 
    894       global_zoom_nj.setValue(nj_glo); 
    895     if (zoom_i_index.isEmpty()) zoom_i_index.setValue(i_index.getValue()); 
    896     if (zoom_j_index.isEmpty()) zoom_j_index.setValue(j_index.getValue()); 
    897     if (zoom_ibegin.isEmpty()) zoom_ibegin.setValue(ibegin); 
    898     if (zoom_ni.isEmpty()) zoom_ni.setValue(ni); 
    899     if (zoom_jbegin.isEmpty()) zoom_jbegin.setValue(jbegin); 
    900     if (zoom_nj.isEmpty()) zoom_nj.setValue(nj); 
    901    } 
     909   } 
     910   CATCH_DUMP_ATTR 
    902911 
    903912   size_t CDomain::getGlobalWrittenSize(void) 
    904913   { 
    905       return global_zoom_ni*global_zoom_nj ; 
     914     return ni_glo*nj_glo ; 
    906915   } 
    907916   //---------------------------------------------------------------- 
     
    909918   // Check validity of local domain on using the combination of 3 parameters: ibegin, ni and i_index 
    910919   void CDomain::checkLocalIDomain(void) 
     920   TRY 
    911921   { 
    912922      // If ibegin and ni are provided then we use them to check the validity of local domain 
     
    967977      } 
    968978   } 
     979   CATCH_DUMP_ATTR 
    969980 
    970981   // Check validity of local domain on using the combination of 3 parameters: jbegin, nj and j_index 
    971982   void CDomain::checkLocalJDomain(void) 
     983   TRY 
    972984   { 
    973985    // If jbegin and nj are provided then we use them to check the validity of local domain 
     
    10181030     } 
    10191031   } 
     1032   CATCH_DUMP_ATTR 
    10201033 
    10211034   //---------------------------------------------------------------- 
    10221035 
    10231036   void CDomain::checkMask(void) 
     1037   TRY 
    10241038   { 
    10251039      if (!mask_1d.isEmpty() && !mask_2d.isEmpty()) 
     
    10671081     } 
    10681082   } 
     1083   CATCH_DUMP_ATTR 
    10691084 
    10701085   //---------------------------------------------------------------- 
    10711086 
    10721087   void CDomain::checkDomainData(void) 
     1088   TRY 
    10731089   { 
    10741090      if (data_dim.isEmpty()) 
     
    11101126      } 
    11111127   } 
     1128   CATCH_DUMP_ATTR 
    11121129 
    11131130   //---------------------------------------------------------------- 
    11141131 
    11151132   void CDomain::checkCompression(void) 
    1116    { 
     1133   TRY 
     1134   { 
     1135     int i,j,ind; 
    11171136      if (!data_i_index.isEmpty()) 
    11181137      { 
     
    11351154                   << "'data_j_index' must be defined when 'data_i_index' is set and 'data_dim' is 2."); 
    11361155          } 
     1156          for (int k=0; k<data_i_index.numElements(); ++k) 
     1157          { 
     1158            i = data_i_index(k)+data_ibegin ; 
     1159            j = data_j_index(k)+data_jbegin ; 
     1160            if (i>=0 && i<ni && j>=0 && j<nj) 
     1161            { 
     1162              ind=j*ni+i ; 
     1163              if (!domainMask(ind)) 
     1164              { 
     1165                data_i_index(k) = -1; 
     1166                data_j_index(k) = -1; 
     1167              } 
     1168            } 
     1169            else 
     1170            { 
     1171              data_i_index(k) = -1; 
     1172              data_j_index(k) = -1; 
     1173            } 
     1174          } 
    11371175        } 
    11381176        else // (1 == data_dim) 
     
    11411179          { 
    11421180            data_j_index.resize(data_ni); 
    1143             for (int j = 0; j < data_ni; ++j) data_j_index(j) = 0; 
     1181            data_j_index = 0; 
     1182          } 
     1183          for (int k=0; k<data_i_index.numElements(); ++k) 
     1184          { 
     1185            i=data_i_index(k)+data_ibegin ; 
     1186            if (i>=0 && i < domainMask.size()) 
     1187            { 
     1188              if (!domainMask(i)) data_i_index(k) = -1; 
     1189            } 
     1190            else 
     1191              data_i_index(k) = -1; 
     1192 
     1193            if (!domainMask(i)) data_i_index(k) = -1; 
    11441194          } 
    11451195        } 
     
    11561206          data_i_index.resize(data_ni); 
    11571207          data_j_index.resize(data_ni); 
    1158  
    1159           for (int i = 0; i < data_ni; ++i) 
     1208          data_j_index = 0; 
     1209 
     1210          for (int k = 0; k < data_ni; ++k) 
    11601211          { 
    1161             data_i_index(i) = i; 
    1162             data_j_index(i) = 0; 
     1212            i=k+data_ibegin ; 
     1213            if (i>=0 && i < domainMask.size()) 
     1214            { 
     1215              if (domainMask(i)) 
     1216                data_i_index(k) = k; 
     1217              else 
     1218                data_i_index(k) = -1; 
     1219            } 
     1220            else 
     1221              data_i_index(k) = -1; 
    11631222          } 
    11641223        } 
     
    11691228          data_j_index.resize(dsize); 
    11701229 
    1171           for(int count = 0, j = 0; j < data_nj; ++j) 
     1230          for(int count = 0, kj = 0; kj < data_nj; ++kj) 
    11721231          { 
    1173             for(int i = 0; i < data_ni; ++i, ++count) 
     1232            for(int ki = 0; ki < data_ni; ++ki, ++count) 
    11741233            { 
    1175               data_i_index(count) = i; 
    1176               data_j_index(count) = j; 
     1234              i = ki + data_ibegin; 
     1235              j = kj + data_jbegin; 
     1236              ind=j*ni+i ; 
     1237              if (i>=0 && i<ni && j>=0 && j<nj) 
     1238              { 
     1239                if (domainMask(ind)) 
     1240                { 
     1241                  data_i_index(count) = ki; 
     1242                  data_j_index(count) = kj; 
     1243                } 
     1244                else 
     1245                { 
     1246                  data_i_index(count) = -1; 
     1247                  data_j_index(count) = -1; 
     1248                } 
     1249              } 
     1250              else 
     1251              { 
     1252                data_i_index(count) = -1; 
     1253                data_j_index(count) = -1; 
     1254              } 
    11771255            } 
    11781256          } 
     
    11801258      } 
    11811259   } 
     1260   CATCH_DUMP_ATTR 
    11821261 
    11831262   //---------------------------------------------------------------- 
    11841263   void CDomain::computeLocalMask(void) 
     1264   TRY 
    11851265   { 
    11861266     localMask.resize(i_index.numElements()) ; 
     
    12141294     } 
    12151295   } 
     1296   CATCH_DUMP_ATTR 
    12161297 
    12171298   void CDomain::checkEligibilityForCompressedOutput(void) 
     1299   TRY 
    12181300   { 
    12191301     // We don't check if the mask or the indexes are valid here, just if they have been defined at this point. 
    12201302     isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !data_i_index.isEmpty(); 
    12211303   } 
     1304   CATCH_DUMP_ATTR 
    12221305 
    12231306   //---------------------------------------------------------------- 
    12241307 
    12251308   /* 
    1226      Fill in longitude and latitude value from clients (or models) into internal values lonvalue, latvalue which 
    1227      will be used by XIOS. 
     1309     Fill in longitude, latitude, bounds, and area into internal values (lonvalue, latvalue, bounds_lonvalue, bounds_latvalue, areavalue) 
     1310     which will be used by XIOS. 
    12281311   */ 
    12291312   void CDomain::completeLonLatClient(void) 
     1313   TRY 
    12301314   { 
    12311315     bool lonlatValueExisted = (0 != lonvalue.numElements()) || (0 != latvalue.numElements()); 
    12321316     checkBounds() ; 
     1317     checkArea() ; 
     1318 
    12331319     if (!lonvalue_2d.isEmpty() && !lonlatValueExisted) 
    12341320     { 
     
    13251411       } 
    13261412     } 
    1327    } 
     1413 
     1414     if (!area.isEmpty() && areavalue.isEmpty()) 
     1415     { 
     1416        areavalue.resize(ni*nj); 
     1417       for (int j = 0; j < nj; ++j) 
     1418       { 
     1419         for (int i = 0; i < ni; ++i) 
     1420         { 
     1421           int k = j * ni + i; 
     1422           areavalue(k) = area(i,j); 
     1423         } 
     1424       } 
     1425     } 
     1426   } 
     1427   CATCH_DUMP_ATTR 
    13281428 
    13291429   /* 
     
    13311431   */ 
    13321432   void CDomain::convertLonLatValue(void) 
     1433   TRY 
    13331434   { 
    13341435     bool lonlatValueExisted = (0 != lonvalue.numElements()) || (0 != latvalue.numElements()); 
     
    14281529     } 
    14291530   } 
    1430  
     1531   CATCH_DUMP_ATTR 
    14311532 
    14321533   void CDomain::checkBounds(void) 
     1534   TRY 
    14331535   { 
    14341536     bool hasBoundValues = (0 != bounds_lonvalue.numElements()) || (0 != bounds_latvalue.numElements()); 
     
    14671569               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14681570               << "'bounds_lon_1d' dimension is not compatible with 'nvertex'." << std::endl 
    1469                << "'bounds_lon_1d' dimension is " << bounds_lon_1d.extent(1) 
     1571               << "'bounds_lon_1d' dimension is " << bounds_lon_1d.extent(0) 
    14701572               << " but nvertex is " << nvertex.getValue() << "."); 
    14711573 
     
    14741576               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14751577               << "'bounds_lon_2d' dimension is not compatible with 'nvertex'." << std::endl 
    1476                << "'bounds_lon_2d' dimension is " << bounds_lon_2d.extent(2) 
     1578               << "'bounds_lon_2d' dimension is " << bounds_lon_2d.extent(0) 
    14771579               << " but nvertex is " << nvertex.getValue() << "."); 
    14781580 
     
    14911593               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14921594               << "'bounds_lat_1d' dimension is not compatible with 'nvertex'." << std::endl 
    1493                << "'bounds_lat_1d' dimension is " << bounds_lat_1d.extent(1) 
     1595               << "'bounds_lat_1d' dimension is " << bounds_lat_1d.extent(0) 
    14941596               << " but nvertex is " << nvertex.getValue() << "."); 
    14951597 
     
    14981600               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
    14991601               << "'bounds_lat_2d' dimension is not compatible with 'nvertex'." << std::endl 
    1500                << "'bounds_lat_2d' dimension is " << bounds_lat_2d.extent(2) 
     1602               << "'bounds_lat_2d' dimension is " << bounds_lat_2d.extent(0) 
    15011603               << " but nvertex is " << nvertex.getValue() << "."); 
    15021604 
     
    15221624     } 
    15231625   } 
     1626   CATCH_DUMP_ATTR 
    15241627 
    15251628   void CDomain::checkArea(void) 
     1629   TRY 
    15261630   { 
    15271631     bool hasAreaValue = (!areavalue.isEmpty() && 0 != areavalue.numElements()); 
     
    15371641               << "Area size is " << area.extent(0) << " x " << area.extent(1) << "."); 
    15381642       } 
    1539        if (areavalue.isEmpty()) 
    1540        { 
    1541           areavalue.resize(ni*nj); 
    1542          for (int j = 0; j < nj; ++j) 
    1543          { 
    1544            for (int i = 0; i < ni; ++i) 
    1545            { 
    1546              int k = j * ni + i; 
    1547              areavalue(k) = area(i,j); 
    1548            } 
    1549          } 
    1550        } 
    1551      } 
    1552    } 
     1643//       if (areavalue.isEmpty()) 
     1644//       { 
     1645//          areavalue.resize(ni*nj); 
     1646//         for (int j = 0; j < nj; ++j) 
     1647//         { 
     1648//           for (int i = 0; i < ni; ++i) 
     1649//           { 
     1650//             int k = j * ni + i; 
     1651//             areavalue(k) = area(i,j); 
     1652//           } 
     1653//         } 
     1654//       } 
     1655     } 
     1656   } 
     1657   CATCH_DUMP_ATTR 
    15531658 
    15541659   void CDomain::checkLonLat() 
     1660   TRY 
    15551661   { 
    15561662     if (!hasLonLat) hasLonLat = (!latvalue_1d.isEmpty() && !lonvalue_1d.isEmpty()) || 
     
    16121718     } 
    16131719   } 
     1720   CATCH_DUMP_ATTR 
    16141721 
    16151722   void CDomain::checkAttributesOnClientAfterTransformation() 
     1723   TRY 
    16161724   { 
    16171725     CContext* context=CContext::getCurrent() ; 
     
    16281736     this->isClientAfterTransformationChecked = true; 
    16291737   } 
     1738   CATCH_DUMP_ATTR 
    16301739 
    16311740   //---------------------------------------------------------------- 
     
    16331742   // This function only checks all attributes of current domain 
    16341743   void CDomain::checkAttributesOnClient() 
     1744   TRY 
    16351745   { 
    16361746     if (this->isClientChecked) return; 
     
    16581768      this->isClientChecked = true; 
    16591769   } 
     1770   CATCH_DUMP_ATTR 
    16601771 
    16611772   // Send all checked attributes to server 
    16621773   void CDomain::sendCheckedAttributes() 
     1774   TRY 
    16631775   { 
    16641776     if (!this->isClientChecked) checkAttributesOnClient(); 
     
    16731785     this->isChecked = true; 
    16741786   } 
     1787   CATCH_DUMP_ATTR 
    16751788 
    16761789   void CDomain::checkAttributes(void) 
     1790   TRY 
    16771791   { 
    16781792      if (this->isChecked) return; 
     
    17041818      this->isChecked = true; 
    17051819   } 
     1820   CATCH_DUMP_ATTR 
    17061821 
    17071822  /*! 
     
    17121827  */ 
    17131828  void CDomain::computeConnectedClients() 
     1829  TRY 
    17141830  { 
    17151831    CContext* context=CContext::getCurrent() ; 
     
    17341850        if (indSrv_.find(nbServer) == indSrv_.end()) 
    17351851        { 
    1736           int i,j,i_ind,j_ind, nbIndex, nbIndexZoom; 
    1737           int global_zoom_iend=global_zoom_ibegin+global_zoom_ni-1; 
    1738           int global_zoom_jend=global_zoom_jbegin+global_zoom_nj-1; 
    1739  
    1740            // Precompute number of index 
    1741            int globalIndexCountZoom = 0; 
    1742            nbIndex = i_index.numElements(); 
    1743  
    1744            if (doZoomByIndex_) 
    1745            { 
    1746              globalIndexCountZoom = zoom_i_index.numElements(); 
    1747            } 
    1748            else 
    1749            { 
    1750              for (i = 0; i < nbIndex; ++i) 
    1751              { 
    1752                i_ind=i_index(i); 
    1753                j_ind=j_index(i); 
    1754  
    1755                if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    1756                { 
    1757                   ++globalIndexCountZoom; 
    1758                } 
    1759              } 
    1760            } 
    1761  
    1762            // Fill in index 
    1763            CArray<size_t,1> globalIndexDomainZoom(globalIndexCountZoom); 
    1764            CArray<size_t,1> localIndexDomainZoom(globalIndexCountZoom); 
    1765            CArray<size_t,1> globalIndexDomain(nbIndex); 
    1766            size_t globalIndex; 
    1767            int globalIndexCount = 0; 
    1768  
    1769            for (i = 0; i < nbIndex; ++i) 
    1770            { 
    1771              i_ind=i_index(i); 
    1772              j_ind=j_index(i); 
    1773              globalIndex = i_ind + j_ind * ni_glo; 
    1774              globalIndexDomain(i) = globalIndex; 
    1775            } 
    1776  
    1777            if (globalLocalIndexMap_.empty()) 
    1778            { 
    1779              for (i = 0; i < nbIndex; ++i) 
    1780                globalLocalIndexMap_[globalIndexDomain(i)] = i; 
    1781            } 
    1782  
    1783            globalIndexCountZoom = 0; 
    1784            if (doZoomByIndex_) 
    1785            { 
    1786              int nbIndexZoom = zoom_i_index.numElements(); 
    1787  
    1788              for (i = 0; i < nbIndexZoom; ++i) 
    1789              { 
    1790                i_ind=zoom_i_index(i); 
    1791                j_ind=zoom_j_index(i); 
    1792                globalIndex = i_ind + j_ind * ni_glo; 
    1793                globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 
    1794                ++globalIndexCountZoom; 
    1795              } 
    1796            } 
    1797            else 
    1798            { 
    1799              int global_zoom_iend=global_zoom_ibegin+global_zoom_ni-1; 
    1800              int global_zoom_jend=global_zoom_jbegin+global_zoom_nj-1; 
    1801              for (i = 0; i < nbIndex; ++i) 
    1802              { 
    1803                i_ind=i_index(i); 
    1804                j_ind=j_index(i); 
    1805                globalIndex = i_ind + j_ind * ni_glo; 
    1806                if (i_ind >= global_zoom_ibegin && i_ind <= global_zoom_iend && j_ind >= global_zoom_jbegin && j_ind <= global_zoom_jend) 
    1807                { 
    1808                   globalIndexDomainZoom(globalIndexCountZoom) = globalIndex; 
    1809                   ++globalIndexCountZoom; 
    1810                } 
    1811              } 
    1812  
    1813              int iend = ibegin + ni -1; 
    1814              int jend = jbegin + nj -1; 
    1815              zoom_ibegin = global_zoom_ibegin > ibegin ? global_zoom_ibegin.getValue() : ibegin; 
    1816              int zoom_iend  = global_zoom_iend < iend ? zoom_iend : iend ; 
    1817              zoom_ni     = zoom_iend-zoom_ibegin+1 ; 
    1818  
    1819              zoom_jbegin = global_zoom_jbegin > jbegin ? global_zoom_jbegin.getValue() : jbegin ; 
    1820              int zoom_jend   = global_zoom_jend < jend ? zoom_jend : jend; 
    1821              zoom_nj     = zoom_jend-zoom_jbegin+1; 
    1822            } 
    1823  
    1824            size_t globalSizeIndex = 1, indexBegin, indexEnd; 
    1825            int range, clientSize = client->clientSize; 
    1826            std::vector<int> nGlobDomain(2); 
    1827            nGlobDomain[0] = this->ni_glo; 
    1828            nGlobDomain[1] = this->nj_glo; 
    1829            for (int i = 0; i < nGlobDomain.size(); ++i) globalSizeIndex *= nGlobDomain[i]; 
    1830            indexBegin = 0; 
    1831            if (globalSizeIndex <= clientSize) 
    1832            { 
    1833              indexBegin = rank%globalSizeIndex; 
    1834              indexEnd = indexBegin; 
    1835            } 
    1836            else 
    1837            { 
    1838              for (int i = 0; i < clientSize; ++i) 
    1839              { 
    1840                range = globalSizeIndex / clientSize; 
    1841                if (i < (globalSizeIndex%clientSize)) ++range; 
    1842                if (i == client->clientRank) break; 
    1843                indexBegin += range; 
    1844              } 
    1845              indexEnd = indexBegin + range - 1; 
    1846            } 
    1847  
    1848            // Even if servers have no index, they must received something from client 
    1849            // We only use several client to send "empty" message to these servers 
    1850            CServerDistributionDescription serverDescription(nGlobDomain, nbServer); 
    1851            std::vector<int> serverZeroIndex; 
    1852            if (isUnstructed_) serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t&,size_t&>(indexBegin, indexEnd), 0); 
    1853            else serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t&,size_t&>(indexBegin, indexEnd), 1); 
    1854  
    1855            std::list<int> serverZeroIndexLeader; 
    1856            std::list<int> serverZeroIndexNotLeader; 
    1857            CContextClient::computeLeader(client->clientRank, client->clientSize, serverZeroIndex.size(), serverZeroIndexLeader, serverZeroIndexNotLeader); 
    1858            for (std::list<int>::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) 
    1859               *it = serverZeroIndex[*it]; 
    1860  
    1861            CClientServerMapping* clientServerMap = new CClientServerMappingDistributed(serverDescription.getGlobalIndexRange(), 
    1862                  client->intraComm); 
    1863            clientServerMap->computeServerIndexMapping(globalIndexDomain, nbServer); 
    1864            CClientServerMapping::GlobalIndexMap& globalIndexDomainOnServer = clientServerMap->getGlobalIndexOnServer(); 
    1865  
    1866            CClientServerMapping::GlobalIndexMap::const_iterator it  = globalIndexDomainOnServer.begin(), 
     1852          int i,j,i_ind,j_ind, nbIndex=i_index.numElements(); 
     1853          int globalIndexCount = i_index.numElements(); 
     1854          // Fill in index 
     1855          CArray<size_t,1> globalIndexDomain(nbIndex); 
     1856          size_t globalIndex; 
     1857 
     1858          for (i = 0; i < nbIndex; ++i) 
     1859          { 
     1860            i_ind=i_index(i); 
     1861            j_ind=j_index(i); 
     1862            globalIndex = i_ind + j_ind * ni_glo; 
     1863            globalIndexDomain(i) = globalIndex; 
     1864          } 
     1865 
     1866          if (globalLocalIndexMap_.empty()) 
     1867          { 
     1868            for (i = 0; i < nbIndex; ++i) 
     1869              globalLocalIndexMap_[globalIndexDomain(i)] = i; 
     1870          } 
     1871 
     1872          size_t globalSizeIndex = 1, indexBegin, indexEnd; 
     1873          int range, clientSize = client->clientSize; 
     1874          std::vector<int> nGlobDomain(2); 
     1875          nGlobDomain[0] = this->ni_glo; 
     1876          nGlobDomain[1] = this->nj_glo; 
     1877          for (int i = 0; i < nGlobDomain.size(); ++i) globalSizeIndex *= nGlobDomain[i]; 
     1878          indexBegin = 0; 
     1879          if (globalSizeIndex <= clientSize) 
     1880          { 
     1881            indexBegin = rank%globalSizeIndex; 
     1882            indexEnd = indexBegin; 
     1883          } 
     1884          else 
     1885          { 
     1886            for (int i = 0; i < clientSize; ++i) 
     1887            { 
     1888              range = globalSizeIndex / clientSize; 
     1889              if (i < (globalSizeIndex%clientSize)) ++range; 
     1890              if (i == client->clientRank) break; 
     1891              indexBegin += range; 
     1892            } 
     1893            indexEnd = indexBegin + range - 1; 
     1894          } 
     1895 
     1896          // Even if servers have no index, they must received something from client 
     1897          // We only use several client to send "empty" message to these servers 
     1898          CServerDistributionDescription serverDescription(nGlobDomain, nbServer); 
     1899          std::vector<int> serverZeroIndex; 
     1900          if (isUnstructed_) serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t&,size_t&>(indexBegin, indexEnd), 0); 
     1901          else serverZeroIndex = serverDescription.computeServerGlobalIndexInRange(std::make_pair<size_t&,size_t&>(indexBegin, indexEnd), 1); 
     1902 
     1903          std::list<int> serverZeroIndexLeader; 
     1904          std::list<int> serverZeroIndexNotLeader; 
     1905          CContextClient::computeLeader(client->clientRank, client->clientSize, serverZeroIndex.size(), serverZeroIndexLeader, serverZeroIndexNotLeader); 
     1906          for (std::list<int>::iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) 
     1907            *it = serverZeroIndex[*it]; 
     1908 
     1909          CClientServerMapping* clientServerMap = new CClientServerMappingDistributed(serverDescription.getGlobalIndexRange(), client->intraComm); 
     1910          clientServerMap->computeServerIndexMapping(globalIndexDomain, nbServer); 
     1911          CClientServerMapping::GlobalIndexMap& globalIndexDomainOnServer = clientServerMap->getGlobalIndexOnServer(); 
     1912 
     1913          CClientServerMapping::GlobalIndexMap::const_iterator it  = globalIndexDomainOnServer.begin(), 
    18671914                 ite = globalIndexDomainOnServer.end(); 
    1868            indSrv_[nbServer].swap(globalIndexDomainOnServer); 
    1869            connectedServerRank_[nbServer].clear(); 
    1870            for (it = indSrv_[nbServer].begin(); it != ite; ++it) 
    1871              connectedServerRank_[nbServer].push_back(it->first); 
    1872  
    1873            for (std::list<int>::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) 
    1874               connectedServerRank_[nbServer].push_back(*it); 
    1875  
    1876            // Even if a client has no index, it must connect to at least one server and 
    1877            // send an "empty" data to this server 
    1878            if (connectedServerRank_[nbServer].empty()) 
    1879               connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
    1880  
    1881            nbSenders[nbServer] = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
    1882            delete clientServerMap; 
     1915          indSrv_[nbServer].swap(globalIndexDomainOnServer); 
     1916          connectedServerRank_[nbServer].clear(); 
     1917          for (it = indSrv_[nbServer].begin(); it != ite; ++it) 
     1918            connectedServerRank_[nbServer].push_back(it->first); 
     1919 
     1920          for (std::list<int>::const_iterator it = serverZeroIndexLeader.begin(); it != serverZeroIndexLeader.end(); ++it) 
     1921            connectedServerRank_[nbServer].push_back(*it); 
     1922 
     1923          // Even if a client has no index, it must connect to at least one server and 
     1924          // send an "empty" data to this server 
     1925          if (connectedServerRank_[nbServer].empty()) 
     1926            connectedServerRank_[nbServer].push_back(client->clientRank % client->serverSize); 
     1927 
     1928          // Now check if all servers have data to receive. If not, master client will send empty data. 
     1929          // This ensures that all servers will participate in collective calls upon receiving even if they have no date to receive. 
     1930          std::vector<int> counts (clientSize); 
     1931          std::vector<int> displs (clientSize); 
     1932          displs[0] = 0; 
     1933          int localCount = connectedServerRank_[nbServer].size() ; 
     1934          ep_lib::MPI_Gather(&localCount, 1, EP_INT, &counts[0], 1, EP_INT, 0, client->intraComm) ; 
     1935          for (int i = 0; i < clientSize-1; ++i) 
     1936          { 
     1937            displs[i+1] = displs[i] + counts[i]; 
     1938          } 
     1939          std::vector<int> allConnectedServers(displs[clientSize-1]+counts[clientSize-1]); 
     1940          ep_lib::MPI_Gatherv(&(connectedServerRank_[nbServer])[0], localCount, EP_INT, &allConnectedServers[0], &counts[0], &displs[0], EP_INT, 0, client->intraComm); 
     1941 
     1942          if ((allConnectedServers.size() != nbServer) && (rank == 0)) 
     1943          { 
     1944            std::vector<bool> isSrvConnected (nbServer, false); 
     1945            for (int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] = true; 
     1946            for (int i = 0; i < nbServer; ++i) 
     1947            { 
     1948              if (!isSrvConnected[i]) connectedServerRank_[nbServer].push_back(i); 
     1949            } 
     1950          } 
     1951          nbSenders[nbServer] = clientServerMap->computeConnectedClients(client->serverSize, client->clientSize, client->intraComm, connectedServerRank_[nbServer]); 
     1952          delete clientServerMap; 
    18831953        } 
    18841954      } 
    18851955    } 
    18861956  } 
     1957  CATCH_DUMP_ATTR 
    18871958 
    18881959   /*! 
     
    18921963   */ 
    18931964   void CDomain::computeWrittenIndex() 
     1965   TRY 
    18941966   {   
    18951967      if (computedWrittenIndex_) return; 
     
    19001972 
    19011973      std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); 
    1902       nBegin[0]       = zoom_ibegin;  nBegin[1] = zoom_jbegin; 
    1903       nSize[0]        = zoom_ni;      nSize[1]  = zoom_nj; 
     1974      nBegin[0]       = ibegin;  nBegin[1] = jbegin; 
     1975      nSize[0]        = ni;      nSize[1]  = nj; 
    19041976      nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; 
    19051977      nGlob[0]        = ni_glo;   nGlob[1] = nj_glo; 
     
    19131985                                       itSrve = writtenGlobalIndex.end(), itSrv; 
    19141986 
    1915 //      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
    1916 //      { 
    1917 //        indGlo = *itSrv; 
    1918 //        if (ite != globalLocalIndexMap_.find(indGlo)) 
    1919 //        { 
    1920 //          ++nbWritten; 
    1921 //        } 
    1922 //      } 
    1923  
    1924 //      localIndexToWriteOnServer.resize(nbWritten); 
    19251987      localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 
    1926  
    19271988      nbWritten = 0; 
    19281989      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 
     
    19321993        { 
    19331994          localIndexToWriteOnServer(nbWritten) = globalLocalIndexMap_[indGlo]; 
    1934           ++nbWritten; 
    19351995        } 
    19361996        else 
    19371997        { 
    1938           localIndexToWriteOnServer(nbWritten) = 0; 
    1939           ++nbWritten; 
    1940         } 
    1941       } 
    1942    } 
     1998          localIndexToWriteOnServer(nbWritten) = -1; 
     1999        } 
     2000        ++nbWritten; 
     2001      } 
     2002   } 
     2003   CATCH_DUMP_ATTR 
    19432004 
    19442005  void CDomain::computeWrittenCompressedIndex(ep_lib::MPI_Comm writtenComm) 
     2006  TRY 
    19452007  { 
    19462008    int writtenCommSize; 
     
    19562018 
    19572019      std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2); 
    1958       nBegin[0]       = zoom_ibegin;  nBegin[1] = zoom_jbegin; 
    1959       nSize[0]        = zoom_ni;      nSize[1]  = zoom_nj; 
     2020      nBegin[0]       = ibegin;  nBegin[1] = jbegin; 
     2021      nSize[0]        = ni;      nSize[1]  = nj; 
    19602022      nBeginGlobal[0] = 0; nBeginGlobal[1] = 0; 
    19612023      nGlob[0]        = ni_glo;   nGlob[1] = nj_glo; 
     
    20022064      { 
    20032065              
    2004         ep_lib::MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); 
    2005         ep_lib::MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm); 
     2066        ep_lib::MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, EP_INT, EP_SUM, writtenComm); 
     2067        ep_lib::MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, EP_INT, EP_SUM, writtenComm); 
    20062068        offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize]; 
    20072069      } 
     
    20102072      } 
    20112073  } 
     2074  CATCH_DUMP_ATTR 
    20122075 
    20132076  /*! 
     
    20162079  */ 
    20172080  void CDomain::sendAttributes() 
     2081  TRY 
    20182082  { 
    20192083    sendDistributionAttributes(); 
    20202084    sendIndex();        
    2021     sendMask(); 
    20222085    sendLonLat(); 
    20232086    sendArea();     
    20242087    sendDataIndex(); 
    20252088  } 
    2026  
     2089  CATCH 
    20272090  /*! 
    2028     Send global index and zoom index from client to connected client(s) 
    2029     zoom index can be smaller than global index 
     2091    Send global index from client to connected client(s) 
    20302092  */ 
    20312093  void CDomain::sendIndex() 
     2094  TRY 
    20322095  { 
    20332096    int ns, n, i, j, ind, nv, idx; 
     
    20412104 
    20422105      list<CMessage> list_msgsIndex; 
    2043       list<CArray<int,1> > list_indZoom, list_writtenInd, list_indGlob; 
     2106      list<CArray<int,1> > list_indGlob; 
    20442107 
    20452108      std::unordered_map<int, vector<size_t> >::const_iterator itIndex, iteIndex; 
     
    20722135    } 
    20732136  } 
     2137  CATCH_DUMP_ATTR 
    20742138 
    20752139  /*! 
     
    20792143  */ 
    20802144  void CDomain::sendDistributionAttributes(void) 
     2145  TRY 
    20812146  { 
    20822147    std::list<CContextClient*>::iterator it; 
     
    21152180          msg << isUnstructed_; 
    21162181          msg << ni_srv << ibegin_srv << nj_srv << jbegin_srv; 
    2117           msg << global_zoom_ni.getValue() << global_zoom_ibegin.getValue() << global_zoom_nj.getValue() << global_zoom_jbegin.getValue();         
     2182          msg << ni_glo.getValue() << nj_glo.getValue(); 
    21182183          msg << isCompressible_; 
    21192184 
     
    21252190    } 
    21262191  } 
    2127  
    2128   /*! 
    2129     Send mask index from client to connected(s) clients     
    2130   */ 
    2131   void CDomain::sendMask() 
    2132   { 
    2133     int ns, n, i, j, ind, nv, idx; 
    2134     std::list<CContextClient*>::iterator it; 
    2135     for (it=clients.begin(); it!=clients.end(); ++it) 
    2136     { 
    2137       CContextClient* client = *it; 
    2138       int serverSize = client->serverSize; 
    2139  
    2140       // send area for each connected server 
    2141       CEventClient eventMask(getType(), EVENT_ID_MASK); 
    2142  
    2143       list<CMessage> list_msgsMask; 
    2144       list<CArray<bool,1> > list_mask; 
    2145  
    2146       std::unordered_map<int, vector<size_t> >::const_iterator it, iteMap; 
    2147       iteMap = indSrv_[serverSize].end(); 
    2148       for (int k = 0; k < connectedServerRank_[serverSize].size(); ++k) 
    2149       { 
    2150         int nbData = 0; 
    2151         int rank = connectedServerRank_[serverSize][k]; 
    2152         it = indSrv_[serverSize].find(rank); 
    2153         if (iteMap != it) 
    2154           nbData = it->second.size(); 
    2155         list_mask.push_back(CArray<bool,1>(nbData)); 
    2156  
    2157         const std::vector<size_t>& temp = it->second; 
    2158         for (n = 0; n < nbData; ++n) 
    2159         { 
    2160           idx = static_cast<int>(it->second[n]); 
    2161           list_mask.back()(n) = domainMask(globalLocalIndexMap_[idx]); 
    2162         } 
    2163  
    2164         list_msgsMask.push_back(CMessage()); 
    2165         list_msgsMask.back() << this->getId() << list_mask.back(); 
    2166         eventMask.push(rank, nbSenders[serverSize][rank], list_msgsMask.back()); 
    2167       } 
    2168       client->sendEvent(eventMask); 
    2169     } 
    2170   } 
     2192  CATCH_DUMP_ATTR 
    21712193 
    21722194  /*! 
     
    21742196  */ 
    21752197  void CDomain::sendArea() 
     2198  TRY 
    21762199  { 
    21772200    if (!hasArea) return; 
     
    22172240    } 
    22182241  } 
     2242  CATCH_DUMP_ATTR 
    22192243 
    22202244  /*! 
     
    22242248  */ 
    22252249  void CDomain::sendLonLat() 
     2250  TRY 
    22262251  { 
    22272252    if (!hasLonLat) return; 
     
    23122337    } 
    23132338  } 
     2339  CATCH_DUMP_ATTR 
    23142340 
    23152341  /*! 
     
    23202346  */ 
    23212347  void CDomain::sendDataIndex() 
     2348  TRY 
    23222349  { 
    23232350    int ns, n, i, j, ind, nv, idx; 
     
    23882415    } 
    23892416  } 
     2417  CATCH 
    23902418   
    23912419  bool CDomain::dispatchEvent(CEventServer& event) 
     2420  TRY 
    23922421  { 
    23932422    if (SuperClass::dispatchEvent(event)) return true; 
     
    24022431        case EVENT_ID_INDEX: 
    24032432          recvIndex(event); 
    2404           return true; 
    2405           break; 
    2406         case EVENT_ID_MASK: 
    2407           recvMask(event); 
    24082433          return true; 
    24092434          break; 
     
    24312456    } 
    24322457  } 
     2458  CATCH 
    24332459 
    24342460  /*! 
     
    24372463  */ 
    24382464  void CDomain::recvIndex(CEventServer& event) 
     2465  TRY 
    24392466  { 
    24402467    string domainId; 
     
    24502477    get(domainId)->recvIndex(rankBuffers); 
    24512478  } 
     2479  CATCH 
    24522480 
    24532481  /*! 
     
    24572485  */ 
    24582486  void CDomain::recvIndex(std::map<int, CBufferIn*>& rankBuffers) 
     2487  TRY 
    24592488  { 
    24602489    int nbReceived = rankBuffers.size(), i, ind, index, type_int, iIndex, jIndex; 
     
    24952524           jIndex = (jIndex < 0) ? 0 : jIndex; 
    24962525           nbIndLoc = iIndex + ni * jIndex; 
    2497            if (nbIndLoc < nbIndexGlobMax) 
    2498            { 
    2499              i_index(nbIndLoc) = index % ni_glo; 
    2500              j_index(nbIndLoc) = index / ni_glo; 
    2501              globalLocalIndexMap_[index] = nbIndLoc;   
    2502              ++nbIndGlob; 
    2503            } 
    2504            // i_index(nbIndGlob) = index % ni_glo; 
    2505            // j_index(nbIndGlob) = index / ni_glo; 
    2506            // globalLocalIndexMap_[index] = nbIndGlob;   
    2507            // ++nbIndGlob; 
     2526           i_index(nbIndGlob) = index % ni_glo; 
     2527           j_index(nbIndGlob) = index / ni_glo; 
     2528           globalLocalIndexMap_[index] = nbIndGlob; 
     2529           ++nbIndGlob; 
    25082530         }  
    25092531      }  
     
    25202542      j_index.resizeAndPreserve(nbIndGlob); 
    25212543    } 
     2544 
     2545    domainMask.resize(0); // Mask is not defined anymore on servers 
    25222546  } 
     2547  CATCH 
    25232548 
    25242549  /*! 
     
    25272552  */ 
    25282553  void CDomain::recvDistributionAttributes(CEventServer& event) 
     2554  TRY 
    25292555  { 
    25302556    CBufferIn* buffer=event.subEvents.begin()->buffer; 
     
    25332559    get(domainId)->recvDistributionAttributes(*buffer); 
    25342560  } 
     2561  CATCH 
    25352562 
    25362563  /*! 
    2537     Receive attributes from client(s): zoom info and begin and n of each server 
     2564    Receive attributes from client(s) 
    25382565    \param[in] rank rank of client source 
    25392566    \param[in] buffer message containing attributes info 
    25402567  */ 
    25412568  void CDomain::recvDistributionAttributes(CBufferIn& buffer) 
     2569  TRY 
    25422570  { 
    25432571    int ni_tmp, ibegin_tmp, nj_tmp, jbegin_tmp; 
    2544     int global_zoom_ni_tmp, global_zoom_ibegin_tmp, global_zoom_nj_tmp, global_zoom_jbegin_tmp; 
     2572    int ni_glo_tmp, nj_glo_tmp; 
    25452573    buffer >> isUnstructed_ >> ni_tmp >> ibegin_tmp >> nj_tmp >> jbegin_tmp 
    2546            >> global_zoom_ni_tmp >> global_zoom_ibegin_tmp >> global_zoom_nj_tmp >> global_zoom_jbegin_tmp            
     2574           >> ni_glo_tmp >> nj_glo_tmp 
    25472575           >> isCompressible_; 
     2576 
    25482577    ni.setValue(ni_tmp); 
    25492578    ibegin.setValue(ibegin_tmp); 
    25502579    nj.setValue(nj_tmp); 
    25512580    jbegin.setValue(jbegin_tmp); 
    2552  
    2553     global_zoom_ni.setValue(global_zoom_ni_tmp); 
    2554     global_zoom_ibegin.setValue(global_zoom_ibegin_tmp); 
    2555     global_zoom_nj.setValue(global_zoom_nj_tmp); 
    2556     global_zoom_jbegin.setValue(global_zoom_jbegin_tmp); 
    2557  
    2558     int iend = ibegin + ni  - 1; 
    2559     int jend = jbegin + nj  - 1; 
    2560     int zoom_iend_glob = global_zoom_ibegin + global_zoom_ni - 1; 
    2561     int zoom_jend_glob = global_zoom_jbegin + global_zoom_nj - 1; 
    2562  
    2563     zoom_ibegin.setValue(global_zoom_ibegin > ibegin ? global_zoom_ibegin.getValue() : ibegin); 
    2564     int zoom_iend = zoom_iend_glob < iend ? zoom_iend_glob : iend ; 
    2565     zoom_ni.setValue(zoom_iend-zoom_ibegin+1); 
    2566  
    2567     zoom_jbegin.setValue(global_zoom_jbegin > jbegin ? global_zoom_jbegin.getValue() : jbegin); 
    2568     int zoom_jend = zoom_jend_glob < jend ? zoom_jend_glob : jend ; 
    2569     zoom_nj.setValue(zoom_jend-zoom_jbegin+1); 
    2570  
    2571     if (zoom_ni<=0 || zoom_nj<=0) 
    2572     { 
    2573       zoom_ni=0 ; zoom_ibegin=global_zoom_ibegin ; //=0; zoom_iend=0 ;  
    2574       zoom_nj=0 ; zoom_jbegin=global_zoom_jbegin ; //=0; zoom_jend=0 ; 
    2575     } 
     2581    ni_glo.setValue(ni_glo_tmp); 
     2582    nj_glo.setValue(nj_glo_tmp); 
    25762583 
    25772584  } 
    2578  
    2579   /*! 
    2580     Receive area event from clients(s) 
    2581     \param[in] event event contain info about rank and associated area 
    2582   */ 
    2583   void CDomain::recvMask(CEventServer& event) 
    2584   { 
    2585     string domainId; 
    2586     std::map<int, CBufferIn*> rankBuffers; 
    2587  
    2588     list<CEventServer::SSubEvent>::iterator it; 
    2589     for (it = event.subEvents.begin(); it != event.subEvents.end(); ++it) 
    2590     {       
    2591       CBufferIn* buffer = it->buffer; 
    2592       *buffer >> domainId; 
    2593       rankBuffers[it->rank] = buffer;      
    2594     } 
    2595     get(domainId)->recvMask(rankBuffers); 
    2596   } 
    2597  
    2598  
    2599   /*! 
    2600     Receive mask information from client(s) 
    2601     \param[in] rankBuffers rank of sending client and the corresponding receive buffer   
    2602   */ 
    2603   void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers) 
    2604   { 
    2605     int nbReceived = rankBuffers.size(), i, ind, index, lInd; 
    2606     if (nbReceived != recvClientRanks_.size()) 
    2607       ERROR("void CDomain::recvMask(std::map<int, CBufferIn*>& rankBuffers)", 
    2608            << "The number of sending clients is not correct." 
    2609            << "Expected number: " << recvClientRanks_.size() << " but received " << nbReceived); 
    2610  
    2611     vector<CArray<bool,1> > recvMaskValue(nbReceived);       
    2612     for (i = 0; i < recvClientRanks_.size(); ++i) 
    2613     { 
    2614       int rank = recvClientRanks_[i]; 
    2615       CBufferIn& buffer = *(rankBuffers[rank]);       
    2616       buffer >> recvMaskValue[i]; 
    2617     } 
    2618  
    2619     int nbMaskInd = 0; 
    2620     for (i = 0; i < nbReceived; ++i) 
    2621     { 
    2622       nbMaskInd += recvMaskValue[i].numElements(); 
    2623     } 
    2624    
    2625     if (nbMaskInd != globalLocalIndexMap_.size()) 
    2626       info (0) << "If domain " << this->getDomainOutputName() <<" does not have overlapped regions between processes " 
    2627                << "something must be wrong with mask index "<< std::endl; 
    2628  
    2629     nbMaskInd = globalLocalIndexMap_.size(); 
    2630     mask_1d.resize(nbMaskInd); 
    2631     domainMask.resize(nbMaskInd); 
    2632     mask_1d = false; 
    2633      
    2634     for (i = 0; i < nbReceived; ++i) 
    2635     { 
    2636       CArray<int,1>& tmpInd = indGlob_[recvClientRanks_[i]]; 
    2637       CArray<bool,1>& tmp = recvMaskValue[i]; 
    2638       for (ind = 0; ind < tmp.numElements(); ++ind) 
    2639       { 
    2640         lInd = globalLocalIndexMap_[size_t(tmpInd(ind))]; 
    2641         if (!mask_1d(lInd)) // Only rewrite mask_1d if it's not true 
    2642           mask_1d(lInd) = tmp(ind); 
    2643       } 
    2644     } 
    2645     domainMask=mask_1d ; 
    2646   } 
    2647  
     2585 CATCH_DUMP_ATTR 
    26482586  /*! 
    26492587    Receive longitude event from clients(s) 
     
    26512589  */ 
    26522590  void CDomain::recvLon(CEventServer& event) 
     2591  TRY 
    26532592  { 
    26542593    string domainId; 
     
    26642603    get(domainId)->recvLon(rankBuffers); 
    26652604  } 
     2605  CATCH 
    26662606 
    26672607  /*! 
     
    26702610  */ 
    26712611  void CDomain::recvLon(std::map<int, CBufferIn*>& rankBuffers) 
     2612  TRY 
    26722613  { 
    26732614    int nbReceived = rankBuffers.size(), i, ind, index, iindex, jindex, lInd; 
     
    27292670    } 
    27302671  } 
     2672  CATCH_DUMP_ATTR 
    27312673 
    27322674  /*! 
     
    27352677  */ 
    27362678  void CDomain::recvLat(CEventServer& event) 
     2679  TRY 
    27372680  { 
    27382681    string domainId; 
     
    27482691    get(domainId)->recvLat(rankBuffers); 
    27492692  } 
     2693  CATCH 
    27502694 
    27512695  /*! 
     
    27542698  */ 
    27552699  void CDomain::recvLat(std::map<int, CBufferIn*>& rankBuffers) 
     2700  TRY 
    27562701  { 
    27572702    int nbReceived = rankBuffers.size(), i, ind, index, iindex, jindex, lInd; 
     
    28152760    } 
    28162761  } 
     2762  CATCH_DUMP_ATTR 
    28172763 
    28182764  /*! 
     
    28212767  */ 
    28222768  void CDomain::recvArea(CEventServer& event) 
     2769  TRY 
    28232770  { 
    28242771    string domainId; 
     
    28342781    get(domainId)->recvArea(rankBuffers); 
    28352782  } 
     2783  CATCH 
    28362784 
    28372785  /*! 
     
    28402788  */ 
    28412789  void CDomain::recvArea(std::map<int, CBufferIn*>& rankBuffers) 
     2790  TRY 
    28422791  { 
    28432792    int nbReceived = rankBuffers.size(), i, ind, index, lInd; 
     
    28852834    } 
    28862835  } 
     2836  CATCH_DUMP_ATTR 
    28872837 
    28882838  /*! 
     
    28942844  */ 
    28952845  bool CDomain::isEqual(CDomain* obj) 
     2846  TRY 
    28962847  { 
    28972848    vector<StdString> excludedAttr; 
     
    29162867    return objEqual; 
    29172868  } 
     2869  CATCH_DUMP_ATTR 
    29182870 
    29192871  /*! 
     
    29222874  */ 
    29232875  void CDomain::recvDataIndex(CEventServer& event) 
     2876  TRY 
    29242877  { 
    29252878    string domainId; 
     
    29352888    get(domainId)->recvDataIndex(rankBuffers); 
    29362889  } 
     2890  CATCH 
    29372891 
    29382892  /*! 
     
    29462900  */ 
    29472901  void CDomain::recvDataIndex(std::map<int, CBufferIn*>& rankBuffers) 
     2902  TRY 
    29482903  { 
    29492904    int nbReceived = rankBuffers.size(), i, ind, index, indexI, indexJ, type_int, lInd;     
     
    29822937         dataIIndex(lInd) = (-1 == dataIIndex(lInd)) ? tmpI(ind) : dataIIndex(lInd); // Only fill in dataIndex if there is no data 
    29832938         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);   
    2984  
    2985          if (!domainMask(lInd))   // Include mask info into data index on the RECEIVE getServerDimensionSizes     
    2986          { 
    2987            dataIIndex(lInd) = dataJIndex(lInd) = -1; 
    2988          } 
    29892939      }  
    29902940    } 
     
    30172967    data_jbegin.setValue(0); 
    30182968  } 
     2969  CATCH_DUMP_ATTR 
    30192970 
    30202971  CTransformation<CDomain>* CDomain::addTransformation(ETranformationType transType, const StdString& id) 
     2972  TRY 
    30212973  { 
    30222974    transformationMap_.push_back(std::make_pair(transType, CTransformation<CDomain>::createTransformation(transType,id))); 
    30232975    return transformationMap_.back().second; 
    30242976  } 
     2977  CATCH_DUMP_ATTR 
    30252978 
    30262979  /*! 
     
    30292982  */ 
    30302983  bool CDomain::hasTransformation() 
     2984  TRY 
    30312985  { 
    30322986    return (!transformationMap_.empty()); 
    30332987  } 
     2988  CATCH_DUMP_ATTR 
    30342989 
    30352990  /*! 
     
    30382993  */ 
    30392994  void CDomain::setTransformations(const TransMapTypes& domTrans) 
     2995  TRY 
    30402996  { 
    30412997    transformationMap_ = domTrans; 
    30422998  } 
     2999  CATCH_DUMP_ATTR 
    30433000 
    30443001  /*! 
     
    30473004  */ 
    30483005  CDomain::TransMapTypes CDomain::getAllTransformations(void) 
     3006  TRY 
    30493007  { 
    30503008    return transformationMap_; 
    30513009  } 
     3010  CATCH_DUMP_ATTR 
    30523011 
    30533012  void CDomain::duplicateTransformation(CDomain* src) 
     3013  TRY 
    30543014  { 
    30553015    if (src->hasTransformation()) 
     
    30583018    } 
    30593019  } 
     3020  CATCH_DUMP_ATTR 
    30603021 
    30613022  /*! 
     
    30633024   */ 
    30643025  void CDomain::solveInheritanceTransformation() 
     3026  TRY 
    30653027  { 
    30663028    if (hasTransformation() || !hasDirectDomainReference()) 
     
    30793041        refDomains[i]->setTransformations(domain->getAllTransformations()); 
    30803042  } 
     3043  CATCH_DUMP_ATTR 
    30813044 
    30823045  void CDomain::setContextClient(CContextClient* contextClient) 
     3046  TRY 
    30833047  { 
    30843048    if (clientsSet.find(contextClient)==clientsSet.end()) 
     
    30883052    } 
    30893053  } 
     3054  CATCH_DUMP_ATTR 
    30903055 
    30913056  /*! 
     
    30953060  */ 
    30963061  void CDomain::parse(xml::CXMLNode & node) 
     3062  TRY 
    30973063  { 
    30983064    SuperClass::parse(node); 
     
    31083074 
    31093075        nodeElementName = node.getElementName(); 
    3110         if(transformationMapList_ptr == 0) initializeTransformationMap(); 
    3111  
    3112         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_ptr->end(), it; 
    3113  
    3114         it = transformationMapList_ptr->find(nodeElementName); 
     3076        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
     3077        it = transformationMapList_.find(nodeElementName); 
    31153078        if (ite != it) 
    31163079        { 
     
    31283091    } 
    31293092  } 
     3093  CATCH_DUMP_ATTR 
    31303094   //---------------------------------------------------------------- 
    31313095 
  • XIOS/dev/branch_openmp/src/node/domain.hpp

    r1545 r1642  
    1717#include "transformation_enum.hpp" 
    1818#include "server_distribution_description.hpp" 
    19 #include "mpi_std.hpp" 
    2019#include "mesh.hpp" 
    2120 
     
    5049         { 
    5150           EVENT_ID_INDEX, EVENT_ID_LON, EVENT_ID_LAT,  
    52            EVENT_ID_AREA, EVENT_ID_MASK, 
     51           EVENT_ID_AREA, 
    5352           EVENT_ID_DATA_INDEX, EVENT_ID_SERVER_ATTRIBUT 
    5453         } ; 
     
    143142         CArray<double, 1> areavalue; 
    144143 
    145          CArray<size_t,1> localIndexToWriteOnServer;          
     144         CArray<int,1> localIndexToWriteOnServer; 
    146145 
    147146         CArray<bool, 1> domainMask; // mask_1d, mask_2d -> domainMask 
     
    152151         bool hasLonLat; 
    153152         bool hasPole ; 
     153         bool hasLatInReadFile_ ; // specify if latitude is defined on read file, so it can be read later when grid distribution will be defined 
     154         bool hasBoundsLatInReadFile_ ; // specify if latitude boundarues are defined on read file, so it can be read later when grid distribution will be defined 
     155         bool hasLonInReadFile_ ; // specify if longitude is defined on read file, so it can be read later when grid distribution will be defined 
     156         bool hasBoundsLonInReadFile_ ; // specify if longitude boundaries are defined on read file, so it can be read later when grid distribution will be defined 
    154157 
    155158         void computeLocalMask(void) ; 
     
    166169         void checkArea(void); 
    167170         void checkLonLat(); 
    168          void checkZoom(void); 
    169171 
    170172         void setTransformations(const TransMapTypes&);          
     
    173175         void sendIndex(); 
    174176         void sendDistributionAttributes(); 
    175          void sendMask(); 
    176177         void sendArea(); 
    177178         void sendLonLat();          
     
    184185         static void recvDistributionAttributes(CEventServer& event); 
    185186         static void recvIndex(CEventServer& event); 
    186          static void recvIndexZoom(CEventServer& event); 
    187          static void recvMask(CEventServer& event);          
    188187         static void recvLon(CEventServer& event); 
    189188         static void recvLat(CEventServer& event); 
     
    192191         void recvDistributionAttributes(CBufferIn& buffer);                   
    193192         void recvIndex(std::map<int, CBufferIn*>& rankBuffers);          
    194          void recvMask(std::map<int, CBufferIn*>& rankBuffers); 
    195193         void recvLon(std::map<int, CBufferIn*>& rankBuffers); 
    196194         void recvLat(std::map<int, CBufferIn*>& rankBuffers); 
     
    201199         void computeConnectedClients();     
    202200 
    203        private: 
     201       private:          
    204202 
    205203/** Clients that have to send a domain. There can be multiple clients in case of secondary server, otherwise only one client. */ 
     
    207205         std::set<CContextClient*> clientsSet; 
    208206 
    209          bool doZoomByIndex_; 
    210207         bool isChecked, computedWrittenIndex_; 
    211208         std::set<StdString> relFiles, relFilesCompressed; 
     
    234231       private: 
    235232         static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    236          static bool initializeTransformationMap(); 
    237          static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
    238          #pragma omp threadprivate(transformationMapList_ptr) 
     233         static std::map<StdString, ETranformationType> transformationMapList_; 
    239234         static bool _dummyTransformationMapList; 
    240          #pragma omp threadprivate(_dummyTransformationMapList) 
    241235 
    242236         DECLARE_REF_FUNC(Domain,domain) 
  • XIOS/dev/branch_openmp/src/node/duplicate_scalar_to_axis.hpp

    r1460 r1642  
    6060      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CReduceAxisToAxis 
    6463 
  • XIOS/dev/branch_openmp/src/node/expand_domain.hpp

    r1331 r1642  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CExpandDomain 
    6463 
  • XIOS/dev/branch_openmp/src/node/extract_axis_to_scalar.hpp

    r1331 r1642  
    6060      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CExtractAxisToScalar 
    6463 
  • XIOS/dev/branch_openmp/src/node/extract_domain_to_axis.hpp

    r1331 r1642  
    6060      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CExtractDomainToAxis 
    6463 
  • XIOS/dev/branch_openmp/src/node/field.cpp

    r1545 r1642  
    7171 
    7272   void CField::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 
     73   TRY 
    7374   { 
    7475      this->vVariableGroup = newVVariableGroup; 
    7576   } 
     77   CATCH 
    7678 
    7779   CVariableGroup* CField::getVirtualVariableGroup(void) const 
     80   TRY 
    7881   { 
    7982      return this->vVariableGroup; 
    8083   } 
     84   CATCH 
    8185 
    8286   std::vector<CVariable*> CField::getAllVariables(void) const 
     87   TRY 
    8388   { 
    8489      return this->vVariableGroup->getAllChildren(); 
    8590   } 
     91   CATCH 
    8692 
    8793   void CField::solveDescInheritance(bool apply, const CAttributeMap* const parent) 
     94   TRY 
    8895   { 
    8996      SuperClassAttribute::setAttributes(parent, apply); 
    9097      this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 
    9198   } 
     99   CATCH_DUMP_ATTR 
    92100 
    93101  //---------------------------------------------------------------- 
    94102 
    95103  bool CField::dispatchEvent(CEventServer& event) 
     104  TRY 
    96105  { 
    97106    if (SuperClass::dispatchEvent(event)) return true; 
     
    131140    } 
    132141  } 
     142  CATCH 
    133143 
    134144  void CField::sendUpdateData(const CArray<double,1>& data) 
     145  TRY 
    135146  { 
    136147    CTimer::get("Field : send data").resume(); 
     
    189200    CTimer::get("Field : send data").suspend(); 
    190201  } 
     202  CATCH_DUMP_ATTR 
    191203 
    192204  void CField::recvUpdateData(CEventServer& event) 
     205  TRY 
    193206  { 
    194207    std::map<int,CBufferIn*> rankBuffers; 
     
    207220    CTimer::get("Field : recv data").suspend(); 
    208221  } 
     222  CATCH 
    209223 
    210224  void  CField::recvUpdateData(std::map<int,CBufferIn*>& rankBuffers) 
     225  TRY 
    211226  { 
    212227    CContext* context = CContext::getCurrent(); 
     
    249264    recvDataSrv.reset() ; 
    250265  } 
     266  CATCH_DUMP_ATTR 
    251267 
    252268  void CField::writeUpdateData(const CArray<double,1>& data) 
     269  TRY 
    253270  { 
    254271    CContext* context = CContext::getCurrent(); 
     
    277294    } 
    278295  } 
     296  CATCH_DUMP_ATTR 
    279297 
    280298  void CField::writeField(void) 
     299  TRY 
    281300  { 
    282301    if (!getRelFile()->isEmptyZone()) 
     
    290309    } 
    291310  } 
     311  CATCH_DUMP_ATTR 
    292312 
    293313  /* 
     
    299319  */ 
    300320  bool CField::sendReadDataRequest(const CDate& tsDataRequested) 
     321  TRY 
    301322  { 
    302323    CContext* context = CContext::getCurrent(); 
     
    330351    return !isEOF; 
    331352  } 
     353  CATCH_DUMP_ATTR 
    332354 
    333355  /*! 
     
    336358  */ 
    337359  bool CField::sendReadDataRequestIfNeeded(void) 
     360  TRY 
    338361  { 
    339362    const CDate& currentDate = CContext::getCurrent()->getCalendar()->getCurrentDate(); 
     
    343366    while (currentDate >= lastDataRequestedFromServer) 
    344367    { 
    345       #pragma omp critical (_output) 
    346       { 
    347         info(20) << "currentDate : " << currentDate << endl ; 
    348         info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 
    349         info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; 
    350         info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
    351       } 
     368      info(20) << "currentDate : " << currentDate << endl ; 
     369      info(20) << "lastDataRequestedFromServer : " << lastDataRequestedFromServer << endl ; 
     370      info(20) << "file->output_freq.getValue() : " << file->output_freq.getValue() << endl ; 
     371      info(20) << "lastDataRequestedFromServer + file->output_freq.getValue() : " << lastDataRequestedFromServer + file->output_freq << endl ; 
    352372 
    353373      dataRequested |= sendReadDataRequest(lastDataRequestedFromServer + file->output_freq); 
     
    356376    return dataRequested; 
    357377  } 
     378  CATCH_DUMP_ATTR 
    358379 
    359380  void CField::recvReadDataRequest(CEventServer& event) 
     381  TRY 
    360382  { 
    361383    CBufferIn* buffer = event.subEvents.begin()->buffer; 
     
    364386    get(fieldId)->recvReadDataRequest(); 
    365387  } 
     388  CATCH 
    366389 
    367390  /*! 
     
    372395  */ 
    373396  void CField::recvReadDataRequest(void) 
     397  TRY 
    374398  { 
    375399    CContext* context = CContext::getCurrent(); 
     
    452476    } 
    453477  } 
     478  CATCH_DUMP_ATTR 
    454479 
    455480  /*! 
     
    459484  */ 
    460485  CField::EReadField CField::readField(void) 
     486  TRY 
    461487  { 
    462488    CContext* context = CContext::getCurrent(); 
     
    505531    if (!nstepMaxRead) 
    506532    { 
    507        MPI_Allreduce(&nstepMax, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); 
     533       #ifdef _usingMPI 
     534       MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); 
     535       #elif _usingEP 
     536       ep_lib::MPI_Allreduce(&nstepMax, &nstepMax, 1, EP_INT, EP_MAX, context->server->intraComm); 
     537       #endif 
    508538       nstepMaxRead = true; 
    509539    } 
     
    511541    return readState; 
    512542  } 
     543  CATCH_DUMP_ATTR 
    513544 
    514545  /* 
     
    519550  */ 
    520551  void CField::recvReadDataReady(CEventServer& event) 
     552  TRY 
    521553  { 
    522554    string fieldId; 
     
    534566    get(fieldId)->recvReadDataReady(ranks, buffers); 
    535567  } 
     568  CATCH 
    536569 
    537570  /*! 
     
    541574  */ 
    542575  void CField::recvReadDataReady(vector<int> ranks, vector<CBufferIn*> buffers) 
     576  TRY 
    543577  { 
    544578    CContext* context = CContext::getCurrent(); 
     
    577611      serverSourceFilter->streamDataFromServer(lastDataReceivedFromServer, data); 
    578612  } 
     613  CATCH_DUMP_ATTR 
    579614 
    580615  void CField::checkForLateDataFromServer(void) 
     616  TRY 
    581617  { 
    582618    CContext* context = CContext::getCurrent(); 
     
    610646    } 
    611647  } 
     648  CATCH_DUMP_ATTR 
    612649 
    613650  void CField::checkIfMustAutoTrigger(void) 
     651  TRY 
    614652  { 
    615653    mustAutoTrigger = serverSourceFilter ? serverSourceFilter->mustAutoTrigger() : false; 
    616654  } 
     655  CATCH_DUMP_ATTR 
    617656 
    618657  void CField::autoTriggerIfNeeded(void) 
     658  TRY 
    619659  { 
    620660    if (mustAutoTrigger) 
    621661      serverSourceFilter->trigger(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    622662  } 
     663  CATCH_DUMP_ATTR 
    623664 
    624665   //---------------------------------------------------------------- 
    625666 
    626667   void CField::setRelFile(CFile* _file) 
     668   TRY 
    627669   { 
    628670      this->file = _file; 
    629671      hasOutputFile = true; 
    630672   } 
     673   CATCH_DUMP_ATTR 
    631674 
    632675   //---------------------------------------------------------------- 
     
    639682 
    640683   CGrid* CField::getRelGrid(void) const 
     684   TRY 
    641685   { 
    642686      return this->grid; 
    643687   } 
     688   CATCH 
    644689 
    645690   //---------------------------------------------------------------- 
    646691 
    647692   CFile* CField::getRelFile(void) const 
     693   TRY 
    648694   { 
    649695      return this->file; 
    650696   } 
     697   CATCH 
    651698 
    652699   int CField::getNStep(void) const 
     700   TRY 
    653701   { 
    654702      return this->nstep; 
    655703   } 
     704   CATCH 
    656705 
    657706   func::CFunctor::ETimeType CField::getOperationTimeType() const 
     707   TRY 
    658708   { 
    659709     return operationTimeType; 
    660710   } 
     711   CATCH 
    661712 
    662713   //---------------------------------------------------------------- 
    663714 
    664715   void CField::incrementNStep(void) 
     716   TRY 
    665717   { 
    666718      this->nstep++; 
    667719   } 
     720   CATCH_DUMP_ATTR 
    668721 
    669722   void CField::resetNStep(int nstep /*= 0*/) 
     723   TRY 
    670724   { 
    671725      this->nstep = nstep; 
    672726   } 
     727   CATCH_DUMP_ATTR 
    673728 
    674729   void CField::resetNStepMax(void) 
     730   TRY 
    675731   { 
    676732      this->nstepMax = 0; 
    677733      nstepMaxRead = false; 
    678734   } 
     735   CATCH_DUMP_ATTR 
    679736 
    680737   //---------------------------------------------------------------- 
    681738 
    682739   bool CField::isActive(bool atCurrentTimestep /*= false*/) const 
     740   TRY 
    683741   { 
    684742      if (clientSourceFilter) 
     
    692750      return false; 
    693751   } 
     752   CATCH 
    694753 
    695754   //---------------------------------------------------------------- 
    696755 
    697756   bool CField::wasWritten() const 
     757   TRY 
    698758   { 
    699759     return written; 
    700760   } 
     761   CATCH 
    701762 
    702763   void CField::setWritten() 
     764   TRY 
    703765   { 
    704766     written = true; 
    705767   } 
     768   CATCH_DUMP_ATTR 
    706769 
    707770   //---------------------------------------------------------------- 
    708771 
    709772   bool CField::getUseCompressedOutput() const 
     773   TRY 
    710774   { 
    711775     return useCompressedOutput; 
    712776   } 
     777   CATCH 
    713778 
    714779   void CField::setUseCompressedOutput() 
     780   TRY 
    715781   { 
    716782     useCompressedOutput = true; 
    717783   } 
     784   CATCH_DUMP_ATTR 
    718785 
    719786   //---------------------------------------------------------------- 
    720787 
    721788   std::shared_ptr<COutputPin> CField::getInstantDataFilter() 
     789   TRY 
    722790   { 
    723791     return instantDataFilter; 
    724792   } 
     793   CATCH_DUMP_ATTR 
    725794 
    726795   //---------------------------------------------------------------- 
     
    731800   */ 
    732801   void CField::buildGridTransformationGraph() 
     802   TRY 
    733803   { 
    734804     CContext* context = CContext::getCurrent(); 
     
    741811     } 
    742812   } 
     813   CATCH_DUMP_ATTR 
    743814 
    744815   /*! 
     
    746817   */ 
    747818   void CField::generateNewTransformationGridDest() 
     819   TRY 
    748820   { 
    749821     CContext* context = CContext::getCurrent(); 
     
    800872     } 
    801873   } 
     874   CATCH_DUMP_ATTR 
    802875 
    803876   void CField::updateRef(CGrid* grid) 
     877   TRY 
    804878   { 
    805879     if (!grid_ref.isEmpty()) grid_ref.setValue(grid->getId()); 
     
    823897     } 
    824898   } 
     899   CATCH_DUMP_ATTR 
    825900    
    826901   /*! 
     
    829904   */ 
    830905   void CField::solveAllEnabledFieldsAndTransform() 
     906   TRY 
    831907   { 
    832908     CContext* context = CContext::getCurrent(); 
     
    865941     } 
    866942   } 
     943   CATCH_DUMP_ATTR 
    867944 
    868945   void CField::checkGridOfEnabledFields() 
     946   TRY 
    869947   { 
    870948     if (!isGridChecked) 
     
    874952     } 
    875953   } 
     954   CATCH_DUMP_ATTR 
    876955 
    877956   void CField::sendGridComponentOfEnabledFields() 
     957   TRY 
    878958   { 
    879959      solveGridDomainAxisRef(true); 
    880960      // solveCheckMaskIndex(true); 
    881961   } 
     962   CATCH_DUMP_ATTR 
    882963 
    883964   void CField::sendGridOfEnabledFields() 
     965   TRY 
    884966   { 
    885967      // solveGridDomainAxisRef(true); 
    886968      solveCheckMaskIndex(true); 
    887969   }    
     970   CATCH_DUMP_ATTR 
    888971 
    889972   void CField::solveOnlyReferenceEnabledField(bool doSending2Server) 
     973   TRY 
    890974   { 
    891975     CContext* context = CContext::getCurrent(); 
     
    913997     } 
    914998   } 
    915       
     999   CATCH_DUMP_ATTR 
     1000 
    9161001   void CField::solveAllReferenceEnabledField(bool doSending2Server) 
     1002   TRY 
    9171003   { 
    9181004     CContext* context = CContext::getCurrent(); 
     
    9221008     { 
    9231009        areAllReferenceSolved = true; 
    924  
     1010        
    9251011        if (context->hasClient && !context->hasServer) 
    9261012        { 
     
    9431029     solveCheckMaskIndex(doSending2Server); 
    9441030   } 
     1031   CATCH_DUMP_ATTR 
    9451032 
    9461033   std::map<int, StdSize> CField::getGridAttributesBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) 
     1034   TRY 
    9471035   { 
    9481036     return grid->getAttributesBufferSize(client, bufferForWriting); 
    9491037   } 
     1038   CATCH_DUMP_ATTR 
    9501039 
    9511040   std::map<int, StdSize> CField::getGridDataBufferSize(CContextClient* client, bool bufferForWriting /*= "false"*/) 
     1041   TRY 
    9521042   { 
    9531043     return grid->getDataBufferSize(client, getId(), bufferForWriting); 
    9541044   } 
     1045   CATCH_DUMP_ATTR 
    9551046 
    9561047   size_t CField::getGlobalWrittenSize() 
     1048   TRY 
    9571049   { 
    9581050     return grid->getGlobalWrittenSize(); 
    9591051   } 
     1052   CATCH_DUMP_ATTR 
    9601053 
    9611054   //---------------------------------------------------------------- 
    9621055 
    9631056   void CField::solveServerOperation(void) 
     1057   TRY 
    9641058   { 
    9651059      CContext* context = CContext::getCurrent(); 
     
    10041098      operationTimeType = functor->timeType(); 
    10051099   } 
     1100   CATCH_DUMP_ATTR 
    10061101 
    10071102   //---------------------------------------------------------------- 
     
    10161111    */ 
    10171112   void CField::buildFilterGraph(CGarbageCollector& gc, bool enableOutput) 
     1113   TRY 
    10181114   {      
    10191115    if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 
     
    10301126     { 
    10311127        if (!instantDataFilter) 
    1032           instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true)); 
     1128          instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false)); 
    10331129 
    10341130 
     
    10461142     { 
    10471143       if (!instantDataFilter) 
    1048          instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true)); 
     1144         instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, false)); 
    10491145 
    10501146             // If the field data is to be read by the client or/and written to a file 
     
    10921188         { 
    10931189           checkTimeAttributes(); 
    1094            instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true, 
     1190           instantDataFilter = serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 
    10951191                                                                                                       detectMissingValues, defaultValue)); 
    10961192         } 
     
    10981194         { 
    10991195            if (check_if_active.isEmpty()) check_if_active = false;  
    1100             instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 
     1196            instantDataFilter = clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, true, NoneDu, false, 
    11011197                                                                                                        detectMissingValues, defaultValue)); 
    11021198         } 
     
    11211217     } 
    11221218   } 
     1219   CATCH_DUMP_ATTR 
    11231220 
    11241221   /*! 
     
    11301227    */ 
    11311228   std::shared_ptr<COutputPin> CField::getFieldReference(CGarbageCollector& gc) 
     1229   TRY 
    11321230   { 
    11331231     if (instantDataFilter || field_ref.isEmpty()) 
     
    11531251     return filters.second; 
    11541252   } 
     1253   CATCH_DUMP_ATTR 
    11551254 
    11561255   /*! 
     
    11641263    */ 
    11651264   std::shared_ptr<COutputPin> CField::getSelfReference(CGarbageCollector& gc) 
     1265   TRY 
    11661266   { 
    11671267     if (instantDataFilter || !hasExpression()) 
     
    11791279         { 
    11801280           checkTimeAttributes(); 
    1181            serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true, 
     1281           serverSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, false, freq_offset, true, 
    11821282                                                                                   detectMissingValues, defaultValue)); 
    11831283         } 
     
    11961296         { 
    11971297           if (check_if_active.isEmpty()) check_if_active = false; 
    1198            clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, NoneDu, false, 
     1298           clientSourceFilter = std::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, true, NoneDu, false, 
    11991299                                                                                   detectMissingValues, defaultValue)); 
    12001300         } 
     
    12061306     return selfReferenceFilter; 
    12071307   } 
     1308   CATCH_DUMP_ATTR 
    12081309 
    12091310   /*! 
     
    12171318    */ 
    12181319   std::shared_ptr<COutputPin> CField::getTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) 
     1320   TRY 
    12191321   { 
    12201322     std::map<CDuration, std::shared_ptr<COutputPin> >::iterator it = temporalDataFilters.find(outFreq); 
     
    12401342     return it->second; 
    12411343   } 
     1344   CATCH_DUMP_ATTR 
    12421345 
    12431346  /*! 
     
    12511354    
    12521355   std::shared_ptr<COutputPin> CField::getSelfTemporalDataFilter(CGarbageCollector& gc, CDuration outFreq) 
     1356   TRY 
    12531357   { 
    12541358     if (instantDataFilter || !hasExpression()) 
     
    12811385     } 
    12821386  } 
     1387   CATCH_DUMP_ATTR 
    12831388 
    12841389   //---------------------------------------------------------------- 
     
    12991404 
    13001405   void CField::solveGridReference(void) 
     1406   TRY 
    13011407   { 
    13021408      if (grid_ref.isEmpty() && domain_ref.isEmpty() && axis_ref.isEmpty() && scalar_ref.isEmpty()) 
     
    13821488      } 
    13831489   } 
     1490   CATCH_DUMP_ATTR 
    13841491 
    13851492   void CField::solveGridDomainAxisRef(bool checkAtt) 
     1493   TRY 
    13861494   { 
    13871495     grid->solveDomainAxisRef(checkAtt); 
    13881496   } 
     1497   CATCH_DUMP_ATTR 
    13891498 
    13901499   void CField::solveCheckMaskIndex(bool doSendingIndex) 
     1500   TRY 
    13911501   { 
    13921502     grid->checkMaskIndex(doSendingIndex); 
    13931503   } 
     1504   CATCH_DUMP_ATTR 
    13941505 
    13951506   void CField::solveTransformedGrid() 
     1507   TRY 
    13961508   { 
    13971509     if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
     
    14421554     } 
    14431555   } 
     1556   CATCH_DUMP_ATTR 
    14441557 
    14451558   void CField::solveGenerateGrid() 
     1559   TRY 
    14461560   { 
    14471561     if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 
     
    14501564       grid->completeGrid(); 
    14511565   } 
     1566   CATCH_DUMP_ATTR 
    14521567 
    14531568   void CField::solveGridDomainAxisBaseRef() 
     1569   TRY 
    14541570   { 
    14551571     grid->solveDomainAxisRef(false); 
    14561572     grid->solveDomainAxisBaseRef(); 
    14571573   } 
     1574   CATCH_DUMP_ATTR 
    14581575 
    14591576   ///------------------------------------------------------------------- 
     
    14611578   template <> 
    14621579   void CGroupTemplate<CField, CFieldGroup, CFieldAttributes>::solveRefInheritance(void) 
     1580   TRY 
    14631581   { 
    14641582      if (this->group_ref.isEmpty()) return; 
     
    14721590      CFieldGroup* group = CFieldGroup::get(gref); 
    14731591      CFieldGroup* owner = CFieldGroup::get(boost::polymorphic_downcast<CFieldGroup*>(this)); 
    1474  
     1592      owner->setAttributes(group); // inherite of attributes of group reference 
     1593       
    14751594      std::vector<CField*> allChildren  = group->getAllChildren(); 
    14761595      std::vector<CField*>::iterator it = allChildren.begin(), end = allChildren.end(); 
     
    14831602      } 
    14841603   } 
     1604   CATCH_DUMP_ATTR 
    14851605 
    14861606   void CField::scaleFactorAddOffset(double scaleFactor, double addOffset) 
     1607   TRY 
    14871608   { 
    14881609     recvDataSrv = (recvDataSrv - addOffset) / scaleFactor; 
    14891610   } 
     1611   CATCH_DUMP_ATTR 
    14901612 
    14911613   void CField::invertScaleFactorAddOffset(double scaleFactor, double addOffset) 
     1614   TRY 
    14921615   { 
    14931616     recvDataSrv = recvDataSrv * scaleFactor + addOffset; 
    14941617   } 
     1618   CATCH_DUMP_ATTR 
    14951619 
    14961620   void CField::outputField(CArray<double,1>& fieldOut) 
     1621   TRY 
    14971622   {  
    14981623      CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 
     
    15031628      } 
    15041629   } 
     1630   CATCH_DUMP_ATTR 
    15051631 
    15061632   void CField::inputField(CArray<double,1>& fieldIn) 
     1633   TRY 
    15071634   { 
    15081635      CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 
     
    15121639        recvDataSrv(outIndexClient(idx)) = fieldIn(outIndexServer(idx)); 
    15131640      } 
    1514  
    1515    } 
     1641   } 
     1642   CATCH_DUMP_ATTR 
    15161643 
    15171644   void CField::outputCompressedField(CArray<double,1>& fieldOut) 
     1645   TRY 
    15181646   { 
    15191647      CArray<size_t,1>& outIndexClient = grid->localIndexToWriteOnClient; 
     
    15241652      } 
    15251653   } 
     1654   CATCH_DUMP_ATTR 
    15261655 
    15271656   ///------------------------------------------------------------------- 
    15281657 
    15291658   void CField::parse(xml::CXMLNode& node) 
     1659   TRY 
    15301660   { 
    15311661      string newContent ; 
     
    15421672      if (node.getContent(newContent)) content=newContent ; 
    15431673    } 
     1674   CATCH_DUMP_ATTR 
    15441675 
    15451676   /*! 
     
    15491680   */ 
    15501681   const std::vector<StdString>& CField::getRefDomainAxisIds() 
     1682   TRY 
    15511683   { 
    15521684     CGrid* cgPtr = getRelGrid(); 
     
    15771709     return (domAxisScalarIds_); 
    15781710   } 
     1711   CATCH_DUMP_ATTR 
    15791712 
    15801713   CVariable* CField::addVariable(const string& id) 
     1714   TRY 
    15811715   { 
    15821716     return vVariableGroup->createChild(id); 
    15831717   } 
     1718   CATCH 
    15841719 
    15851720   CVariableGroup* CField::addVariableGroup(const string& id) 
     1721   TRY 
    15861722   { 
    15871723     return vVariableGroup->createChildGroup(id); 
    15881724   } 
     1725   CATCH 
    15891726 
    15901727   void CField::setContextClient(CContextClient* contextClient) 
     1728   TRY 
    15911729   { 
    15921730     CContext* context = CContext::getCurrent(); 
     
    16041742     } 
    16051743   } 
     1744   CATCH_DUMP_ATTR 
    16061745 
    16071746   CContextClient* CField::getContextClient() 
     1747   TRY 
    16081748   { 
    16091749     return client; 
    16101750   } 
     1751   CATCH 
    16111752 
    16121753   void CField::sendAddAllVariables(CContextClient* client) 
     1754   TRY 
    16131755   { 
    16141756     std::vector<CVariable*> allVar = getAllVariables(); 
     
    16231765     } 
    16241766   } 
    1625  
     1767   CATCH_DUMP_ATTR 
    16261768 
    16271769   /*! 
     
    16311773     
    16321774   void CField::sendAllAttributesToServer(CContextClient* client) 
     1775   TRY 
    16331776   { 
    16341777     if (grid_ref.isEmpty()) 
     
    16401783     else SuperClass::sendAllAttributesToServer(client) ; 
    16411784   } 
     1785   CATCH_DUMP_ATTR 
    16421786     
    16431787   void CField::sendAddVariable(const string& id, CContextClient* client) 
     1788   TRY 
    16441789   { 
    16451790      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 
    16461791   } 
     1792   CATCH_DUMP_ATTR 
    16471793 
    16481794   void CField::sendAddVariableGroup(const string& id, CContextClient* client) 
     1795   TRY 
    16491796   { 
    16501797      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 
    16511798   } 
     1799   CATCH_DUMP_ATTR 
    16521800 
    16531801   void CField::recvAddVariable(CEventServer& event) 
     1802   TRY 
    16541803   { 
    16551804 
     
    16591808      get(id)->recvAddVariable(*buffer); 
    16601809   } 
     1810   CATCH 
    16611811 
    16621812   void CField::recvAddVariable(CBufferIn& buffer) 
     1813   TRY 
    16631814   { 
    16641815      string id; 
     
    16661817      addVariable(id); 
    16671818   } 
     1819   CATCH_DUMP_ATTR 
    16681820 
    16691821   void CField::recvAddVariableGroup(CEventServer& event) 
     1822   TRY 
    16701823   { 
    16711824 
     
    16751828      get(id)->recvAddVariableGroup(*buffer); 
    16761829   } 
     1830   CATCH 
    16771831 
    16781832   void CField::recvAddVariableGroup(CBufferIn& buffer) 
     1833   TRY 
    16791834   { 
    16801835      string id; 
     
    16821837      addVariableGroup(id); 
    16831838   } 
     1839   CATCH_DUMP_ATTR 
    16841840 
    16851841   /*! 
     
    16871843    */ 
    16881844   void CField::checkTimeAttributes(CDuration* freqOp) 
     1845   TRY 
    16891846   { 
    16901847     bool isFieldRead  = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read; 
     
    17081865       freq_offset.setValue(isFieldRead ? NoneDu : (freq_op.getValue() - TimeStep)); 
    17091866   } 
     1867   CATCH_DUMP_ATTR 
    17101868 
    17111869   /*! 
     
    17141872    */ 
    17151873   const string& CField::getExpression(void) 
     1874   TRY 
    17161875   { 
    17171876     if (!expr.isEmpty() && content.empty()) 
     
    17231882     return content; 
    17241883   } 
     1884   CATCH_DUMP_ATTR 
    17251885 
    17261886   bool CField::hasExpression(void) const 
     1887   TRY 
    17271888   { 
    17281889     return (!expr.isEmpty() || !content.empty()); 
    17291890   } 
    1730  
     1891   CATCH 
     1892 
     1893   bool CField::hasGridMask(void) const 
     1894   TRY 
     1895   { 
     1896     return (this->grid->hasMask()); 
     1897   } 
     1898   CATCH 
    17311899 
    17321900   DEFINE_REF_FUNC(Field,field) 
  • XIOS/dev/branch_openmp/src/node/field.hpp

    r1545 r1642  
    209209        bool hasExpression(void) const; 
    210210 
     211        bool hasGridMask(void) const; 
     212 
    211213      public: 
    212214         /// Propriétés privées /// 
  • XIOS/dev/branch_openmp/src/node/field_impl.hpp

    r1460 r1642  
    1717  template <int N> 
    1818  void CField::setData(const CArray<double, N>& _data) 
     19  TRY 
    1920  { 
    2021    if (clientSourceFilter) 
     
    2728            << "Impossible to receive data from the model for a field [ id = " << getId() << " ] with a reference or an arithmetic operation."); 
    2829  } 
     30  CATCH_DUMP_ATTR 
    2931 
    3032  template <int N> 
    3133  void CField::getData(CArray<double, N>& _data) const 
     34  TRY 
    3235  { 
    3336    if (storeFilter) 
     
    4548    } 
    4649  } 
     50  CATCH 
    4751} // namespace xios 
    4852 
  • XIOS/dev/branch_openmp/src/node/file.cpp

    r1556 r1642  
    2525   CFile::CFile(void) 
    2626      : CObjectTemplate<CFile>(), CFileAttributes() 
    27       , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL) 
     27      , vFieldGroup(), data_out(), enabledFields(), fileComm(EP_COMM_NULL) 
    2828      , isOpen(false), read_client(0), checkRead(false), allZoneEmpty(false) 
    2929   { 
     
    3434   CFile::CFile(const StdString & id) 
    3535      : CObjectTemplate<CFile>(id), CFileAttributes() 
    36       , vFieldGroup(), data_out(), enabledFields(), fileComm(MPI_COMM_NULL) 
     36      , vFieldGroup(), data_out(), enabledFields(), fileComm(EP_COMM_NULL) 
    3737      , isOpen(false), read_client(0), checkRead(false), allZoneEmpty(false) 
    3838    { 
     
    5353 
    5454   const StdString CFile::getFileOutputName(void) const 
     55   TRY 
    5556   { 
    5657     return (name.isEmpty() ? getId() : name) + (name_suffix.isEmpty() ? StdString("") :  name_suffix.getValue()); 
    5758   } 
     59   CATCH 
    5860 
    5961   //---------------------------------------------------------------- 
     
    6567   */ 
    6668   std::shared_ptr<CDataOutput> CFile::getDataOutput(void) const 
     69   TRY 
    6770   { 
    6871      return data_out; 
    6972   } 
     73   CATCH 
    7074 
    7175   /*! 
     
    7680   */ 
    7781   std::shared_ptr<CDataInput> CFile::getDataInput(void) const 
     82   TRY 
    7883   { 
    7984      return data_in; 
    8085   } 
     86   CATCH 
    8187 
    8288   /*! 
     
    8894   */ 
    8995   CFieldGroup* CFile::getVirtualFieldGroup(void) const 
     96   TRY 
    9097   { 
    9198      return (this->vFieldGroup); 
    9299   } 
     100   CATCH 
    93101 
    94102   /*! 
     
    100108   */ 
    101109   CVariableGroup* CFile::getVirtualVariableGroup(void) const 
     110   TRY 
    102111   { 
    103112      return (this->vVariableGroup); 
    104113   } 
     114   CATCH 
    105115 
    106116   //! Get all fields of a file 
    107117   std::vector<CField*> CFile::getAllFields(void) const 
     118   TRY 
    108119   { 
    109120      return (this->vFieldGroup->getAllChildren()); 
    110121   } 
     122   CATCH 
    111123 
    112124   //! Get all variables of a file 
    113125   std::vector<CVariable*> CFile::getAllVariables(void) const 
     126   TRY 
    114127   { 
    115128      return (this->vVariableGroup->getAllChildren()); 
    116129   } 
     130   CATCH 
    117131 
    118132   //---------------------------------------------------------------- 
     
    129143                                                int default_level, 
    130144                                                bool default_enabled) 
     145   TRY 
    131146   { 
    132147      if (!this->enabledFields.empty()) 
     
    145160         { 
    146161            if (! (*it)->enabled.getValue()) continue; 
    147 //            { it--; this->enabledFields.erase(it+1); continue; } 
    148162         } 
    149163         else // Si l'attribut 'enabled' n'est pas dfini ... 
    150164         { 
    151165            if (!default_enabled) continue; 
    152 //            { it--; this->enabledFields.erase(it+1); continue; } 
    153166         } 
    154167 
     
    156169         { 
    157170            if ((*it)->level.getValue() > _outputlevel) continue; 
    158 //            { it--; this->enabledFields.erase(it+1); continue; } 
    159171         } 
    160172         else // Si l'attribut 'level' n'est pas dfini ... 
    161173         { 
    162174            if (default_level > _outputlevel) continue; 
    163 //            { it--; this->enabledFields.erase(it+1); continue; } 
    164175         } 
    165176 
    166 //         CField* field_tmp=(*it).get(); 
    167 //         shared_ptr<CField> sptfield=*it; 
    168 //         field_tmp->refObject.push_back(sptfield); 
    169177         newEnabledFields.push_back(*it); 
    170          // Le champ est finalement actif, on y ajoute sa propre reference. 
    171 //         (*it)->refObject.push_back(*it); 
    172178         // Le champ est finalement actif, on y ajoute la rfrence au champ de base. 
    173179         (*it)->setRelFile(CFile::get(this)); 
     
    177183      return (this->enabledFields); 
    178184   } 
     185   CATCH_DUMP_ATTR 
    179186 
    180187   //---------------------------------------------------------------- 
    181188   //! Change virtual field group to a new one 
    182189   void CFile::setVirtualFieldGroup(CFieldGroup* newVFieldGroup) 
     190   TRY 
    183191   { 
    184192      this->vFieldGroup = newVFieldGroup; 
    185193   } 
     194   CATCH_DUMP_ATTR 
    186195 
    187196   //! Change virtual variable group to new one 
    188197   void CFile::setVirtualVariableGroup(CVariableGroup* newVVariableGroup) 
     198   TRY 
    189199   { 
    190200      this->vVariableGroup = newVVariableGroup; 
    191201   } 
     202   CATCH_DUMP_ATTR 
    192203 
    193204   //---------------------------------------------------------------- 
    194205   bool CFile::isSyncTime(void) 
     206   TRY 
    195207   { 
    196208     CContext* context = CContext::getCurrent(); 
     
    206218      return false; 
    207219    } 
     220    CATCH_DUMP_ATTR 
    208221 
    209222   //! Initialize a file in order to write into it 
    210223   void CFile::initWrite(void) 
     224   TRY 
    211225   { 
    212226      CContext* context = CContext::getCurrent(); 
     
    261275      if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; 
    262276    } 
     277    CATCH_DUMP_ATTR 
    263278 
    264279    //! Initialize a file in order to write into it 
    265280    void CFile::initRead(void) 
     281    TRY 
    266282    { 
    267283      if (checkRead) return; 
     
    269285      checkRead = true; 
    270286    } 
     287    CATCH_DUMP_ATTR 
    271288 
    272289    /*! 
     
    274291    */ 
    275292    void CFile::createSubComFile() 
     293    TRY 
    276294    { 
    277295      CContext* context = CContext::getCurrent(); 
     
    292310      if (allZoneEmpty) ep_lib::MPI_Comm_free(&fileComm); 
    293311    } 
     312    CATCH_DUMP_ATTR 
    294313 
    295314    /* 
     
    299318    */ 
    300319    void CFile::checkWriteFile(void) 
     320    TRY 
    301321    { 
    302322      CContext* context = CContext::getCurrent(); 
     
    315335      } 
    316336    } 
     337    CATCH_DUMP_ATTR 
    317338 
    318339    /* 
     
    323344    */ 
    324345    void CFile::checkReadFile(void) 
     346    TRY 
    325347    { 
    326348      CContext* context = CContext::getCurrent(); 
     
    340362      } 
    341363    } 
     364    CATCH_DUMP_ATTR 
    342365 
    343366    /*! 
     
    346369    */ 
    347370    bool CFile::isEmptyZone() 
     371    TRY 
    348372    { 
    349373      return allZoneEmpty; 
    350374    } 
     375    CATCH_DUMP_ATTR 
    351376 
    352377    /*! 
     
    357382    */ 
    358383   bool CFile::checkSync(void) 
     384   TRY 
    359385   { 
    360386     CContext* context = CContext::getCurrent(); 
     
    371397      return false; 
    372398    } 
     399   CATCH_DUMP_ATTR 
    373400 
    374401    /*! 
     
    379406    */ 
    380407    bool CFile::checkSplit(void) 
     408    TRY 
    381409    { 
    382410      CContext* context = CContext::getCurrent(); 
     
    402430      return false; 
    403431    } 
     432    CATCH_DUMP_ATTR 
    404433 
    405434   /*! 
     
    408437   */ 
    409438   void CFile::createHeader(void) 
     439   TRY 
    410440   { 
    411441      CContext* context = CContext::getCurrent(); 
     
    594624      } 
    595625   } 
     626   CATCH_DUMP_ATTR 
    596627 
    597628  /*! 
     
    599630  */ 
    600631  void CFile::openInReadMode() 
     632  TRY 
    601633  { 
    602634    CContext* context = CContext::getCurrent(); 
     
    675707    } 
    676708  } 
     709  CATCH_DUMP_ATTR 
    677710 
    678711   //! Close file 
    679712   void CFile::close(void) 
     713   TRY 
    680714   { 
    681715     if (!allZoneEmpty) 
     
    688722        isOpen = false; 
    689723       } 
    690       //if (fileComm != MPI_COMM_NULL) MPI_Comm_free(&fileComm); 
    691    } 
     724      if (fileComm != EP_COMM_NULL) ep_lib::MPI_Comm_free(&fileComm); 
     725   } 
     726   CATCH_DUMP_ATTR 
     727 
    692728   //---------------------------------------------------------------- 
    693729 
    694730   void CFile::readAttributesOfEnabledFieldsInReadMode() 
     731   TRY 
    695732   { 
    696733     if (enabledFields.empty()) return; 
     
    713750 
    714751        // Read necessary value from file 
    715         #pragma omp critical (_func) 
    716752        this->data_in->readFieldAttributesValues(enabledFields[idx]); 
    717753 
     
    723759     close(); 
    724760   } 
    725  
     761   CATCH_DUMP_ATTR 
    726762 
    727763   /*! 
     
    730766   */ 
    731767   void CFile::parse(xml::CXMLNode & node) 
     768   TRY 
    732769   { 
    733770      SuperClass::parse(node); 
     
    742779        node.goToParentElement(); 
    743780      } 
    744  
    745    } 
     781   } 
     782   CATCH_DUMP_ATTR 
     783 
    746784   //---------------------------------------------------------------- 
    747785 
     
    751789   */ 
    752790   StdString CFile::toString(void) const 
     791   TRY 
    753792   { 
    754793      StdOStringStream oss; 
     
    763802      return (oss.str()); 
    764803   } 
     804   CATCH 
    765805 
    766806   //---------------------------------------------------------------- 
     
    773813   */ 
    774814   void CFile::solveDescInheritance(bool apply, const CAttributeMap * const parent) 
     815   TRY 
    775816   { 
    776817      SuperClassAttribute::setAttributes(parent,apply); 
     
    778819      this->getVirtualVariableGroup()->solveDescInheritance(apply, NULL); 
    779820   } 
     821   CATCH_DUMP_ATTR 
    780822 
    781823   //---------------------------------------------------------------- 
     
    790832   */ 
    791833   void CFile::solveOnlyRefOfEnabledFields(bool sendToServer) 
     834   TRY 
    792835   { 
    793836     int size = this->enabledFields.size(); 
     
    797840     } 
    798841   } 
     842   CATCH_DUMP_ATTR 
    799843 
    800844   void CFile::checkGridOfEnabledFields() 
     845   TRY 
    801846   {  
    802847     int size = this->enabledFields.size(); 
     
    806851     } 
    807852   } 
     853   CATCH_DUMP_ATTR 
    808854 
    809855   void CFile::sendGridComponentOfEnabledFields() 
     856   TRY 
    810857   {  
    811858     int size = this->enabledFields.size(); 
     
    815862     } 
    816863   } 
     864   CATCH_DUMP_ATTR 
    817865 
    818866   /*! 
     
    821869   */ 
    822870   void CFile::sortEnabledFieldsForUgrid() 
     871   TRY 
    823872   { 
    824873     int size = this->enabledFields.size(); 
     
    869918     } 
    870919   } 
     920   CATCH_DUMP_ATTR 
    871921 
    872922   void CFile::sendGridOfEnabledFields() 
     923   TRY 
    873924   {  
    874925     int size = this->enabledFields.size(); 
     
    878929     } 
    879930   } 
     931   CATCH_DUMP_ATTR 
    880932 
    881933   void CFile::generateNewTransformationGridDest() 
     934   TRY 
    882935   { 
    883936     int size = this->enabledFields.size(); 
     
    887940     } 
    888941   } 
     942   CATCH_DUMP_ATTR 
    889943 
    890944   /*! 
     
    897951   */ 
    898952   void CFile::solveAllRefOfEnabledFieldsAndTransform(bool sendToServer) 
     953   TRY 
    899954   { 
    900955     int size = this->enabledFields.size(); 
    901956     for (int i = 0; i < size; ++i) 
    902      { 
    903        this->enabledFields[i]->solveAllEnabledFieldsAndTransform(); 
    904      } 
    905    } 
     957     {        
     958      this->enabledFields[i]->solveAllEnabledFieldsAndTransform(); 
     959     } 
     960   } 
     961   CATCH_DUMP_ATTR 
    906962 
    907963   /*! 
     
    911967    */ 
    912968   void CFile::buildFilterGraphOfEnabledFields(CGarbageCollector& gc) 
     969   TRY 
    913970   { 
    914971     int size = this->enabledFields.size(); 
     
    918975     } 
    919976   } 
     977   CATCH_DUMP_ATTR 
    920978 
    921979   /*! 
     
    923981    */ 
    924982   void CFile::postProcessFilterGraph() 
     983   TRY 
    925984   { 
    926985     int size = this->enabledFields.size(); 
     
    930989     } 
    931990   } 
     991   CATCH_DUMP_ATTR 
    932992 
    933993   /*! 
     
    935995   */ 
    936996   void CFile::prefetchEnabledReadModeFields(void) 
     997   TRY 
    937998   { 
    938999     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     
    9431004       this->enabledFields[i]->sendReadDataRequest(CContext::getCurrent()->getCalendar()->getCurrentDate()); 
    9441005   } 
     1006   CATCH_DUMP_ATTR 
    9451007 
    9461008   /*! 
     
    9501012   */ 
    9511013   void CFile::doPreTimestepOperationsForEnabledReadModeFields(void) 
     1014   TRY 
    9521015   { 
    9531016     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     
    9611024     } 
    9621025   } 
     1026   CATCH_DUMP_ATTR 
    9631027 
    9641028   /*! 
     
    9671031   */ 
    9681032   void CFile::doPostTimestepOperationsForEnabledReadModeFields(void) 
     1033   TRY 
    9691034   { 
    9701035     if (mode.isEmpty() || mode.getValue() != mode_attr::read) 
     
    9771042     } 
    9781043   } 
     1044   CATCH_DUMP_ATTR 
    9791045 
    9801046   void CFile::solveFieldRefInheritance(bool apply) 
     1047   TRY 
    9811048   { 
    9821049      // Rsolution des hritages par rfrence de chacun des champs contenus dans le fichier. 
     
    9851052         allF[i]->solveRefInheritance(apply); 
    9861053   } 
     1054   CATCH_DUMP_ATTR 
    9871055 
    9881056   //---------------------------------------------------------------- 
     
    9971065   */ 
    9981066   CField* CFile::addField(const string& id) 
     1067   TRY 
    9991068   { 
    10001069     return vFieldGroup->createChild(id); 
    10011070   } 
     1071   CATCH_DUMP_ATTR 
    10021072 
    10031073   /*! 
     
    10091079   */ 
    10101080   CFieldGroup* CFile::addFieldGroup(const string& id) 
     1081   TRY 
    10111082   { 
    10121083     return vFieldGroup->createChildGroup(id); 
    10131084   } 
     1085   CATCH_DUMP_ATTR 
    10141086 
    10151087   /*! 
     
    10241096   */ 
    10251097   CVariable* CFile::addVariable(const string& id) 
     1098   TRY 
    10261099   { 
    10271100     return vVariableGroup->createChild(id); 
    10281101   } 
     1102   CATCH_DUMP_ATTR 
    10291103 
    10301104   /*! 
     
    10361110   */ 
    10371111   CVariableGroup* CFile::addVariableGroup(const string& id) 
     1112   TRY 
    10381113   { 
    10391114     return vVariableGroup->createChildGroup(id); 
    10401115   } 
     1116   CATCH_DUMP_ATTR 
    10411117 
    10421118   void CFile::setContextClient(CContextClient* newContextClient) 
     1119   TRY 
    10431120   { 
    10441121     client = newContextClient; 
     
    10491126     } 
    10501127   } 
     1128   CATCH_DUMP_ATTR 
    10511129 
    10521130   CContextClient* CFile::getContextClient() 
     1131   TRY 
    10531132   { 
    10541133     return client; 
    10551134   } 
     1135   CATCH_DUMP_ATTR 
    10561136 
    10571137   void CFile::setReadContextClient(CContextClient* readContextclient) 
     1138   TRY 
    10581139   { 
    10591140     read_client = readContextclient; 
    10601141   } 
     1142   CATCH_DUMP_ATTR 
    10611143 
    10621144   CContextClient* CFile::getReadContextClient() 
     1145   TRY 
    10631146   { 
    10641147     return read_client; 
    10651148   } 
     1149   CATCH_DUMP_ATTR 
    10661150 
    10671151   /*! 
     
    10701154   */ 
    10711155   void CFile::sendAddField(const string& id, CContextClient* client) 
     1156   TRY 
    10721157   { 
    10731158      sendAddItem(id, EVENT_ID_ADD_FIELD, client); 
    10741159   } 
     1160   CATCH_DUMP_ATTR 
    10751161 
    10761162   /*! 
     
    10791165   */ 
    10801166   void CFile::sendAddFieldGroup(const string& id, CContextClient* client) 
     1167   TRY 
    10811168   { 
    10821169      sendAddItem(id, (int)EVENT_ID_ADD_FIELD_GROUP, client); 
    10831170   } 
     1171   CATCH_DUMP_ATTR 
    10841172 
    10851173   /*! 
     
    10881176   */ 
    10891177   void CFile::recvAddField(CEventServer& event) 
     1178   TRY 
    10901179   { 
    10911180 
     
    10951184      get(id)->recvAddField(*buffer); 
    10961185   } 
     1186   CATCH 
    10971187 
    10981188   /*! 
     
    11011191   */ 
    11021192   void CFile::recvAddField(CBufferIn& buffer) 
     1193   TRY 
    11031194   { 
    11041195      string id; 
     
    11061197      addField(id); 
    11071198   } 
     1199   CATCH_DUMP_ATTR 
    11081200 
    11091201   /*! 
     
    11121204   */ 
    11131205   void CFile::recvAddFieldGroup(CEventServer& event) 
     1206   TRY 
    11141207   { 
    11151208 
     
    11191212      get(id)->recvAddFieldGroup(*buffer); 
    11201213   } 
     1214   CATCH 
    11211215 
    11221216   /*! 
     
    11251219   */ 
    11261220   void CFile::recvAddFieldGroup(CBufferIn& buffer) 
     1221   TRY 
    11271222   { 
    11281223      string id; 
     
    11301225      addFieldGroup(id); 
    11311226   } 
     1227   CATCH_DUMP_ATTR 
    11321228 
    11331229   /*! 
     
    11381234   */ 
    11391235   void CFile::sendAddAllVariables(CContextClient* client) 
     1236   TRY 
    11401237   { 
    11411238     std::vector<CVariable*> allVar = getAllVariables(); 
     
    11501247     } 
    11511248   } 
     1249   CATCH_DUMP_ATTR 
    11521250 
    11531251   /*! 
     
    11571255   */ 
    11581256   void CFile::sendAddVariableGroup(const string& id, CContextClient* client) 
     1257   TRY 
    11591258   { 
    11601259      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE_GROUP, client); 
    11611260   } 
     1261   CATCH_DUMP_ATTR 
    11621262 
    11631263   /* 
     
    11671267   */ 
    11681268   void CFile::sendAddVariable(const string& id, CContextClient* client) 
     1269   TRY 
    11691270   { 
    11701271      sendAddItem(id, (int)EVENT_ID_ADD_VARIABLE, client); 
    11711272   } 
     1273   CATCH_DUMP_ATTR 
    11721274 
    11731275   /*! 
     
    11761278   */ 
    11771279   void CFile::recvAddVariable(CEventServer& event) 
    1178    { 
    1179  
     1280   TRY 
     1281   { 
    11801282      CBufferIn* buffer = event.subEvents.begin()->buffer; 
    11811283      string id; 
     
    11831285      get(id)->recvAddVariable(*buffer); 
    11841286   } 
     1287   CATCH 
    11851288 
    11861289   /*! 
     
    11891292   */ 
    11901293   void CFile::recvAddVariable(CBufferIn& buffer) 
     1294   TRY 
    11911295   { 
    11921296      string id; 
     
    11941298      addVariable(id); 
    11951299   } 
     1300   CATCH_DUMP_ATTR 
    11961301 
    11971302   /*! 
     
    12001305   */ 
    12011306   void CFile::recvAddVariableGroup(CEventServer& event) 
     1307   TRY 
    12021308   { 
    12031309 
     
    12071313      get(id)->recvAddVariableGroup(*buffer); 
    12081314   } 
     1315   CATCH 
    12091316 
    12101317   /*! 
     
    12131320   */ 
    12141321   void CFile::recvAddVariableGroup(CBufferIn& buffer) 
     1322   TRY 
    12151323   { 
    12161324      string id; 
     
    12181326      addVariableGroup(id); 
    12191327   } 
     1328   CATCH_DUMP_ATTR 
    12201329 
    12211330   /*! 
     
    12271336   */ 
    12281337   void CFile::sendEnabledFields(CContextClient* client) 
     1338   TRY 
    12291339   { 
    12301340     size_t size = this->enabledFields.size(); 
     
    12381348     } 
    12391349   } 
    1240  
     1350   CATCH_DUMP_ATTR 
    12411351 
    12421352   /*! 
     
    12481358   */ 
    12491359   bool CFile::dispatchEvent(CEventServer& event) 
     1360   TRY 
    12501361   { 
    12511362      if (SuperClass::dispatchEvent(event)) return true; 
     
    12791390      } 
    12801391   } 
    1281  
    1282  
    1283  
     1392   CATCH 
     1393 
     1394   ///-------------------------------------------------------------- 
     1395   /*! 
     1396   */ 
     1397   StdString CFile::dumpClassAttributes(void) 
     1398   { 
     1399     StdString str; 
     1400     CContext* context = CContext::getCurrent(); 
     1401     str.append("context=\""); 
     1402     str.append(context->getId()); 
     1403     str.append("\""); 
     1404     str.append(" enabled fields=\""); 
     1405     int size = this->enabledFields.size(); 
     1406     for (int i = 0; i < size; ++i) 
     1407     { 
     1408       str.append(this->enabledFields[i]->getId()); 
     1409       str.append(" "); 
     1410     } 
     1411     str.append("\""); 
     1412     return str; 
     1413   } 
    12841414 
    12851415   ///--------------------------------------------------------------- 
  • XIOS/dev/branch_openmp/src/node/file.hpp

    r1545 r1642  
    44/// XIOS headers /// 
    55#include "xios_spl.hpp" 
    6 #include "mpi_std.hpp" 
    76#include "field.hpp" 
    87#include "data_output.hpp" 
     
    1312#include "attribute_enum_impl.hpp" 
    1413#include "context_client.hpp" 
    15  
     14#include "mpi.hpp" 
    1615 
    1716namespace xios { 
     
    8281                                                int default_level = 1, 
    8382                                                bool default_enabled = true); 
     83 
     84         StdString dumpClassAttributes(void); 
    8485 
    8586      public : 
  • XIOS/dev/branch_openmp/src/node/generate_rectilinear_domain.hpp

    r1331 r1642  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CGenerateRectilinearDomain 
    6463 
  • XIOS/dev/branch_openmp/src/node/grid.cpp

    r1545 r1642  
    8282 
    8383   StdSize CGrid::getDimension(void) 
     84   TRY 
    8485   { 
    8586      return getGlobalDimension().size(); 
    8687   } 
     88   CATCH_DUMP_ATTR 
    8789 
    8890   //--------------------------------------------------------------- 
    8991 
    9092   StdSize CGrid::getDataSize(void) const 
     93   TRY 
    9194   { 
    9295     StdSize retvalue = 1; 
     
    98101     return retvalue; 
    99102   } 
     103   CATCH 
    100104 
    101105   /*! 
     
    106110    */ 
    107111   std::map<int, StdSize> CGrid::getAttributesBufferSize(CContextClient* client, bool bufferForWriting) 
     112   TRY 
    108113   { 
    109114     std::map<int, StdSize> attributesSizes = getMinimumBufferSizeForAttributes(client); 
     
    147152     return attributesSizes; 
    148153  } 
     154   CATCH_DUMP_ATTR 
    149155 
    150156   /*! 
     
    156162    */ 
    157163   std::map<int, StdSize> CGrid::getDataBufferSize(CContextClient* client, const std::string& id /*= ""*/, bool bufferForWriting /*= "false"*/) 
     164   TRY 
    158165   {      
    159166     // The record index is sometimes sent along with the data but we always 
     
    180187     return dataSizes; 
    181188   } 
     189   CATCH_DUMP_ATTR 
    182190 
    183191   size_t CGrid::getGlobalWrittenSize(void) 
     192   TRY 
    184193   { 
    185194         std::vector<CDomain*> domainP = this->getDomains(); 
     
    191200     return globalGridSize ; 
    192201   } 
    193     
     202   CATCH_DUMP_ATTR 
    194203    
    195204   void CGrid::checkAttributesAfterTransformation() 
     205   TRY 
    196206   { 
    197207      setAxisList(); 
     
    228238      } 
    229239   } 
     240   CATCH_DUMP_ATTR 
    230241 
    231242   //--------------------------------------------------------------- 
     
    237248    */ 
    238249   bool CGrid::isCompressible(void) const 
     250   TRY 
    239251   { 
    240252      return isCompressible_; 
    241253   } 
     254   CATCH 
    242255 
    243256   //--------------------------------------------------------------- 
    244257 
    245258   void CGrid::addRelFileCompressed(const StdString& filename) 
     259   TRY 
    246260   { 
    247261      this->relFilesCompressed.insert(filename); 
    248262   } 
     263   CATCH_DUMP_ATTR 
    249264 
    250265   bool CGrid::isWrittenCompressed(const StdString& filename) const 
     266   TRY 
    251267   { 
    252268      return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); 
    253269   } 
     270   CATCH 
    254271 
    255272   //--------------------------------------------------------------- 
     
    258275   */ 
    259276   void CGrid::solveDomainAxisRef(bool areAttributesChecked) 
     277   TRY 
    260278   { 
    261279     if (this->isDomainAxisChecked) return; 
     
    266284     this->isDomainAxisChecked = areAttributesChecked; 
    267285   } 
     286   CATCH_DUMP_ATTR 
    268287 
    269288   /* 
     
    272291   */ 
    273292   void CGrid::solveDomainAxisBaseRef() 
     293   TRY 
    274294   { 
    275295     if (this->hasDomainAxisBaseRef_) return; 
     
    297317     this->hasDomainAxisBaseRef_ = true; 
    298318   } 
     319   CATCH_DUMP_ATTR 
    299320 
    300321   void CGrid::checkEligibilityForCompressedOutput() 
     322   TRY 
    301323   { 
    302324     // We don't check if the mask is valid here, just if a mask has been defined at this point. 
    303325     isCompressible_ = !mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty(); 
    304326   } 
     327   CATCH_DUMP_ATTR 
    305328 
    306329   void CGrid::checkMaskIndex(bool doSendingIndex) 
     330   TRY 
    307331   { 
    308332     CContext* context = CContext::getCurrent(); 
     
    339363      this->isChecked = true; 
    340364   } 
     365   CATCH_DUMP_ATTR 
     366   bool CGrid::hasMask() const 
     367   TRY 
     368   { 
     369     return (!mask_1d.isEmpty() || !mask_2d.isEmpty() || !mask_3d.isEmpty() || 
     370             !mask_4d.isEmpty() || !mask_5d.isEmpty() || !mask_6d.isEmpty() || !mask_7d.isEmpty()); 
     371   } 
     372   CATCH 
    341373 
    342374   /* 
     
    344376   */ 
    345377   void CGrid::createMask(void) 
     378   TRY 
    346379   { 
    347380      using namespace std; 
     
    381414      } 
    382415   } 
     416   CATCH_DUMP_ATTR 
    383417 
    384418   /* 
     
    386420   */ 
    387421   void CGrid::checkMask(void) 
     422   TRY 
    388423   { 
    389424      using namespace std; 
     
    423458      } 
    424459   } 
    425  
    426  
    427 /*! 
    428   A grid can have multiple dimension, so can its mask in the form of multi-dimension array. 
    429 It's not a good idea to store all multi-dimension arrays corresponding to each mask. 
    430 One of the ways is to convert this array into 1-dimension one and every process is taken place on it. 
    431   \param [in] multi-dimension array grid mask 
    432 */ 
    433  
    434   void CGrid::getLocalMask(CArray<bool,1>& localMask) 
    435   { 
    436       std::vector<CDomain*> domainP = this->getDomains(); 
    437       std::vector<CAxis*> axisP = this->getAxis(); 
    438       int dim = domainP.size() * 2 + axisP.size(); 
    439  
    440       switch (dim) 
    441       { 
    442         case 0: 
    443           getLocalMask(mask_0d, localMask); 
    444           break; 
    445         case 1: 
    446           getLocalMask(mask_1d, localMask); 
    447           break; 
    448         case 2: 
    449           getLocalMask(mask_2d, localMask); 
    450           break; 
    451         case 3: 
    452           getLocalMask(mask_3d, localMask); 
    453           break; 
    454         case 4: 
    455           getLocalMask(mask_4d, localMask); 
    456           break; 
    457         case 5: 
    458           getLocalMask(mask_5d, localMask); 
    459           break; 
    460         case 6: 
    461           getLocalMask(mask_6d, localMask); 
    462           break; 
    463         case 7: 
    464           getLocalMask(mask_7d, localMask); 
    465           break; 
    466         default: 
    467           break; 
    468       } 
    469   } 
    470        
     460   CATCH_DUMP_ATTR 
     461 
    471462   /* 
    472463     Modify value of mask in a certain index 
     
    476467   */ 
    477468   void CGrid::modifyMask(const CArray<int,1>& indexToModify, bool modifyValue) 
     469   TRY 
    478470   { 
    479471      using namespace std; 
     
    511503      } 
    512504   } 
     505   CATCH_DUMP_ATTR 
    513506 
    514507   /* 
     
    518511   */ 
    519512   void CGrid::modifyMaskSize(const std::vector<int>& newDimensionSize, bool newValue) 
     513   TRY 
    520514   {       
    521515      std::vector<CDomain*> domainP = this->getDomains(); 
     
    552546      } 
    553547   } 
     548   CATCH_DUMP_ATTR 
    554549 
    555550   //--------------------------------------------------------------- 
    556551 
    557552   void CGrid::solveDomainRef(bool sendAtt) 
     553   TRY 
    558554   { 
    559555      setDomainList(); 
     
    568564      } 
    569565   } 
     566   CATCH_DUMP_ATTR 
    570567 
    571568   //--------------------------------------------------------------- 
    572569 
    573570   void CGrid::solveAxisRef(bool sendAtt) 
     571   TRY 
    574572   { 
    575573      setAxisList(); 
     
    599597      } 
    600598   } 
     599   CATCH_DUMP_ATTR 
    601600 
    602601   //--------------------------------------------------------------- 
    603602 
    604603   void CGrid::solveScalarRef(bool sendAtt) 
     604   TRY 
    605605   { 
    606606      setScalarList(); 
     
    616616      } 
    617617   } 
     618   CATCH_DUMP_ATTR 
    618619 
    619620   /*! 
     
    621622   */ 
    622623   void CGrid::computeWrittenIndex() 
     624   TRY 
    623625   {       
    624626      if (computedWrittenIndex_) return; 
     
    659661        { 
    660662          CContextServer* server = CContext::getCurrent()->server;       
    661           MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
    662           MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 
     663          ep_lib::MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, EP_INT, EP_SUM, server->intraComm); 
     664          ep_lib::MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, EP_INT, EP_SUM, server->intraComm); 
    663665          offsetWrittenIndexes_ -= numberWrittenIndexes_; 
    664666        } 
     
    680682      } 
    681683   } 
     684   CATCH_DUMP_ATTR 
    682685 
    683686   //--------------------------------------------------------------- 
     
    690693   */ 
    691694   void CGrid::computeClientIndex() 
     695   TRY 
    692696   { 
    693697     CContext* context = CContext::getCurrent(); 
    694698 
    695      CContextClient* client = context->client;  // Here it's not important which contextClient to recuperate 
     699     CContextClient* client = context->client; 
    696700     int rank = client->clientRank; 
    697701 
    698702     clientDistribution_ = new CDistributionClient(rank, this); 
    699703     // Get local data index on client 
    700      storeIndex_client.resize(clientDistribution_->getLocalDataIndexOnClient().size()); 
    701      int nbStoreIndex = storeIndex_client.numElements(); 
     704     int nbStoreIndex = clientDistribution_->getLocalDataIndexOnClient().size(); 
     705     int nbStoreGridMask = clientDistribution_->getLocalMaskIndexOnClient().size(); 
     706     // nbStoreGridMask = nbStoreIndex if grid mask is defined, and 0 otherwise 
     707     storeIndex_client.resize(nbStoreIndex); 
     708     storeMask_client.resize(nbStoreGridMask); 
    702709     for (int idx = 0; idx < nbStoreIndex; ++idx) storeIndex_client(idx) = (clientDistribution_->getLocalDataIndexOnClient())[idx]; 
     710     for (int idx = 0; idx < nbStoreGridMask; ++idx) storeMask_client(idx) = (clientDistribution_->getLocalMaskIndexOnClient())[idx]; 
    703711 
    704712     if (0 == serverDistribution_) isDataDistributed_= clientDistribution_->isDataDistributed(); 
     
    746754      } 
    747755   } 
     756   CATCH_DUMP_ATTR 
    748757 
    749758   /*! 
     
    751760   */ 
    752761   void CGrid::computeConnectedClients() 
     762   TRY 
    753763   { 
    754764     CContext* context = CContext::getCurrent(); 
     
    840850          connectedServerRank_[receiverSize].push_back(client->clientRank % client->serverSize); 
    841851 
     852         // Now check if all servers have data to receive. If not, master client will send empty data. 
     853         // This ensures that all servers will participate in collective calls upon receiving even if they have no date to receive. 
     854         std::vector<int> counts (client->clientSize); 
     855         std::vector<int> displs (client->clientSize); 
     856         displs[0] = 0; 
     857         int localCount = connectedServerRank_[receiverSize].size() ; 
     858         ep_lib::MPI_Gather(&localCount, 1, EP_INT, &counts[0], 1, EP_INT, 0, client->intraComm) ; 
     859         for (int i = 0; i < client->clientSize-1; ++i) 
     860         { 
     861           displs[i+1] = displs[i] + counts[i]; 
     862         } 
     863         std::vector<int> allConnectedServers(displs[client->clientSize-1]+counts[client->clientSize-1]); 
     864         ep_lib::MPI_Gatherv(&(connectedServerRank_[receiverSize])[0], localCount, EP_INT, &allConnectedServers[0], &counts[0], &displs[0], EP_INT, 0, client->intraComm); 
     865 
     866         if ((allConnectedServers.size() != receiverSize) && (client->clientRank == 0)) 
     867         { 
     868           std::vector<bool> isSrvConnected (receiverSize, false); 
     869           for (int i = 0; i < allConnectedServers.size(); ++i) isSrvConnected[allConnectedServers[i]] = true; 
     870           for (int i = 0; i < receiverSize; ++i) 
     871           { 
     872             if (!isSrvConnected[i]) connectedServerRank_[receiverSize].push_back(i); 
     873           } 
     874         } 
     875 
    842876         nbSenders[receiverSize] = clientServerMap_->computeConnectedClients(receiverSize, client->clientSize, client->intraComm, connectedServerRank_[receiverSize]); 
    843877       } 
    844878     } 
    845879   } 
     880   CATCH_DUMP_ATTR 
    846881 
    847882   /*! 
     
    853888   */ 
    854889   void CGrid::computeIndex(void) 
     890   TRY 
    855891   { 
    856892     CContext* context = CContext::getCurrent(); 
     
    879915     } 
    880916   } 
     917   CATCH_DUMP_ATTR 
    881918 
    882919   /*! 
     
    892929                                     const CContextClient* client, 
    893930                                     CClientServerMapping::GlobalIndexMap& globalIndexOnServer) 
     931   TRY 
    894932   { 
    895933     int serverSize = client->serverSize; 
     
    10581096    } 
    10591097   } 
    1060    //---------------------------------------------------------------- 
     1098   CATCH_DUMP_ATTR 
     1099//---------------------------------------------------------------- 
    10611100 
    10621101   CGrid* CGrid::createGrid(CDomain* domain) 
     1102   TRY 
    10631103   { 
    10641104      std::vector<CDomain*> vecDom(1, domain); 
     
    10671107      return createGrid(vecDom, vecAxis); 
    10681108   } 
     1109   CATCH 
    10691110 
    10701111   CGrid* CGrid::createGrid(CDomain* domain, CAxis* axis) 
    1071    { 
     1112   TRY 
     1113  { 
    10721114      std::vector<CDomain*> vecDom(1, domain); 
    10731115      std::vector<CAxis*> vecAxis(1, axis); 
     
    10751117      return createGrid(vecDom, vecAxis); 
    10761118   } 
     1119   CATCH 
    10771120 
    10781121   CGrid* CGrid::createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 
    10791122                            const CArray<int,1>& axisDomainOrder) 
     1123   TRY 
    10801124   { 
    10811125     std::vector<CScalar*> vecScalar; 
    10821126     return createGrid(generateId(domains, axis, vecScalar, axisDomainOrder), domains, axis, vecScalar, axisDomainOrder); 
    10831127   } 
     1128   CATCH 
    10841129 
    10851130   CGrid* CGrid::createGrid(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 
    10861131                            const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder) 
     1132   TRY 
    10871133   { 
    10881134     return createGrid(generateId(domains, axis, scalars, axisDomainOrder), domains, axis, scalars, axisDomainOrder); 
    10891135   } 
     1136   CATCH 
    10901137 
    10911138   CGrid* CGrid::createGrid(StdString id, const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 
    10921139                            const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder) 
     1140   TRY 
    10931141   { 
    10941142      if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) 
     
    11321180      return grid; 
    11331181   } 
     1182   CATCH 
    11341183 
    11351184   CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc) 
     1185   TRY 
    11361186   { 
    11371187     std::vector<CDomain*> domainSrcTmp = gridSrc->getDomains(), domainSrc; 
     
    11731223      return grid; 
    11741224   } 
     1225   CATCH 
    11751226 
    11761227   StdString CGrid::generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 
    11771228                               const std::vector<CScalar*>& scalars, const CArray<int,1>& axisDomainOrder) 
     1229   TRY 
    11781230   { 
    11791231      if (axisDomainOrder.numElements() > 0 && axisDomainOrder.numElements() != (domains.size() + axis.size() + scalars.size())) 
     
    12161268      return id.str(); 
    12171269   } 
     1270   CATCH 
    12181271 
    12191272   StdString CGrid::generateId(const CGrid* gridSrc, const CGrid* gridDest) 
     1273   TRY 
    12201274   { 
    12211275     StdString idSrc  = gridSrc->getId(); 
     
    12271281     return id.str(); 
    12281282   } 
     1283   CATCH 
    12291284 
    12301285   //---------------------------------------------------------------- 
    12311286 
    12321287   CDomainGroup* CGrid::getVirtualDomainGroup() const 
     1288   TRY 
    12331289   { 
    12341290     return this->vDomainGroup_; 
    12351291   } 
     1292   CATCH 
    12361293 
    12371294   CAxisGroup* CGrid::getVirtualAxisGroup() const 
     1295   TRY 
    12381296   { 
    12391297     return this->vAxisGroup_; 
    12401298   } 
     1299   CATCH 
    12411300 
    12421301   CScalarGroup* CGrid::getVirtualScalarGroup() const 
     1302   TRY 
    12431303   { 
    12441304     return this->vScalarGroup_; 
    12451305   } 
     1306   CATCH 
    12461307 
    12471308/* 
     
    12791340 
    12801341   void CGrid::storeField_arr(const double* const data, CArray<double, 1>& stored) const 
     1342   TRY 
    12811343   { 
    12821344      const StdSize size = storeIndex_client.numElements(); 
     
    12851347      for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)]; 
    12861348   } 
     1349   CATCH 
    12871350 
    12881351   void CGrid::restoreField_arr(const CArray<double, 1>& stored, double* const data) const 
     1352   TRY 
    12891353   { 
    12901354      const StdSize size = storeIndex_client.numElements(); 
     
    12921356      for(StdSize i = 0; i < size; i++) data[storeIndex_client(i)] = stored(i); 
    12931357   } 
     1358   CATCH 
     1359 
     1360   void CGrid::maskField_arr(const double* const data, CArray<double, 1>& stored) const 
     1361   { 
     1362      const StdSize size = storeIndex_client.numElements(); 
     1363      stored.resize(size); 
     1364      const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
     1365 
     1366      if (storeMask_client.numElements() != 0) 
     1367        for(StdSize i = 0; i < size; i++) stored(i) = (storeMask_client(i)) ? data[storeIndex_client(i)] : nanValue; 
     1368      else 
     1369        for(StdSize i = 0; i < size; i++) stored(i) = data[storeIndex_client(i)]; 
     1370   } 
    12941371 
    12951372   void CGrid::uncompressField_arr(const double* const data, CArray<double, 1>& out) const 
     1373   TRY 
    12961374   { 
    12971375      const std::vector<int>& localMaskedDataIndex = clientDistribution_->getLocalMaskedDataIndexOnClient(); 
    12981376      const int size = localMaskedDataIndex.size(); 
    1299        
    13001377      for(int i = 0; i < size; ++i) out(localMaskedDataIndex[i]) = data[i]; 
    13011378   } 
    1302  
     1379   CATCH 
    13031380 
    13041381  void CGrid::computeClientIndexScalarGrid() 
     1382  TRY 
    13051383  { 
    13061384    CContext* context = CContext::getCurrent();     
    1307 //    int nbSrvPools = (context->hasServer) ? (context->hasClient ? context->clientPrimServer.size() : 1) : 1; // This should be changed soon 
    1308 //    for (int p = 0; p < nbSrvPools; ++p) 
    1309     { 
    1310 //      CContextClient* client = (context->hasServer) ? (context->hasClient ? context->clientPrimServer[p] : context->client) 
    1311 //                                                    : context->client; 
     1385    { 
    13121386      CContextClient* client = context->client; 
    13131387 
     
    13401414    } 
    13411415  } 
     1416  CATCH_DUMP_ATTR 
    13421417 
    13431418  void CGrid::computeConnectedClientsScalarGrid() 
     1419  TRY 
    13441420  { 
    13451421    CContext* context = CContext::getCurrent();     
     
    13861462    } 
    13871463  } 
     1464  CATCH_DUMP_ATTR 
    13881465 
    13891466  void CGrid::sendIndexScalarGrid() 
     1467  TRY 
    13901468  { 
    13911469    CContext* context = CContext::getCurrent(); 
     
    14511529    } 
    14521530  } 
     1531  CATCH_DUMP_ATTR 
    14531532 
    14541533  void CGrid::sendIndex(void) 
     1534  TRY 
    14551535  { 
    14561536    CContext* context = CContext::getCurrent(); 
     
    15721652    } 
    15731653  } 
     1654  CATCH_DUMP_ATTR 
    15741655 
    15751656  void CGrid::recvIndex(CEventServer& event) 
     1657  TRY 
    15761658  { 
    15771659    string gridId; 
     
    15891671    get(gridId)->recvIndex(ranks, buffers); 
    15901672  } 
     1673  CATCH 
    15911674 
    15921675  void CGrid::recvIndex(vector<int> ranks, vector<CBufferIn*> buffers) 
     1676  TRY 
    15931677  { 
    15941678    CContext* context = CContext::getCurrent(); 
     
    16311715          std::vector<CDomain*> domainList = getDomains(); 
    16321716          std::vector<CAxis*> axisList = getAxis(); 
    1633           std::vector<int> nZoomBegin(ssize), nZoomSize(ssize), nGlob(ssize), nZoomBeginGlobal(ssize), nGlobElement(numElement); 
    1634           std::vector<CArray<int,1> > globalZoomIndex(numElement); 
     1717          std::vector<int> nBegin(ssize), nSize(ssize), nGlob(ssize), nBeginGlobal(ssize), nGlobElement(numElement); 
     1718          std::vector<CArray<int,1> > globalIndex(numElement); 
    16351719          for (int i = 0; i < numElement; ++i) 
    16361720          { 
     
    16381722            if (2 == axis_domain_order(i)) //domain 
    16391723            { 
    1640               nZoomBegin[indexMap[i]] = domainList[domainId]->zoom_ibegin; 
    1641               nZoomSize[indexMap[i]]  = domainList[domainId]->zoom_ni; 
    1642               nZoomBeginGlobal[indexMap[i]] = domainList[domainId]->global_zoom_ibegin;               
     1724              nBegin[indexMap[i]] = domainList[domainId]->ibegin; 
     1725              nSize[indexMap[i]]  = domainList[domainId]->ni; 
     1726              nBeginGlobal[indexMap[i]] = 0; 
    16431727              nGlob[indexMap[i]] = domainList[domainId]->ni_glo; 
    16441728 
    1645               nZoomBegin[indexMap[i] + 1] = domainList[domainId]->zoom_jbegin; 
    1646               nZoomSize[indexMap[i] + 1] = domainList[domainId]->zoom_nj; 
    1647               nZoomBeginGlobal[indexMap[i] + 1] = domainList[domainId]->global_zoom_jbegin;               
     1729              nBegin[indexMap[i] + 1] = domainList[domainId]->jbegin; 
     1730              nSize[indexMap[i] + 1] = domainList[domainId]->nj; 
     1731              nBeginGlobal[indexMap[i] + 1] = 0; 
    16481732              nGlob[indexMap[i] + 1] = domainList[domainId]->nj_glo; 
    16491733 
    16501734              { 
    16511735                int count = 0; 
    1652                 globalZoomIndex[i].resize(nZoomSize[indexMap[i]]*nZoomSize[indexMap[i]+1]); 
    1653                 for (int jdx = 0; jdx < nZoomSize[indexMap[i]+1]; ++jdx) 
    1654                   for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx)                 
     1736                globalIndex[i].resize(nSize[indexMap[i]]*nSize[indexMap[i]+1]); 
     1737                for (int jdx = 0; jdx < nSize[indexMap[i]+1]; ++jdx) 
     1738                  for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) 
    16551739                  { 
    1656                     globalZoomIndex[i](count) = (nZoomBegin[indexMap[i]] + idx) + (nZoomBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; 
     1740                    globalIndex[i](count) = (nBegin[indexMap[i]] + idx) + (nBegin[indexMap[i]+1] + jdx) * nGlob[indexMap[i]]; 
    16571741                    ++count; 
    16581742                  } 
     
    16631747            else if (1 == axis_domain_order(i)) // axis 
    16641748            { 
    1665               nZoomBegin[indexMap[i]] = axisList[axisId]->zoom_begin; 
    1666               nZoomSize[indexMap[i]]  = axisList[axisId]->zoom_n; 
    1667               nZoomBeginGlobal[indexMap[i]] = axisList[axisId]->global_zoom_begin;               
     1749              nBegin[indexMap[i]] = axisList[axisId]->begin; 
     1750              nSize[indexMap[i]]  = axisList[axisId]->n; 
     1751              nBeginGlobal[indexMap[i]] = 0; 
    16681752              nGlob[indexMap[i]] = axisList[axisId]->n_glo;      
    1669               if (axisList[axisId]->zoomByIndex()) 
    1670               { 
    1671                 globalZoomIndex[i].reference(axisList[axisId]->zoom_index);                 
    1672               } 
    1673               else 
    1674               { 
    1675                 globalZoomIndex[i].resize(nZoomSize[indexMap[i]]); 
    1676                 for (int idx = 0; idx < nZoomSize[indexMap[i]]; ++idx) 
    1677                   globalZoomIndex[i](idx) = nZoomBegin[indexMap[i]] + idx; 
    1678               } 
     1753              globalIndex[i].resize(nSize[indexMap[i]]); 
     1754              for (int idx = 0; idx < nSize[indexMap[i]]; ++idx) 
     1755                globalIndex[i](idx) = nBegin[indexMap[i]] + idx; 
    16791756 
    16801757              ++axisId; 
     
    16821759            else // scalar 
    16831760            {  
    1684               nZoomBegin[indexMap[i]] = 0; 
    1685               nZoomSize[indexMap[i]]  = 1; 
    1686               nZoomBeginGlobal[indexMap[i]] = 0;               
     1761              nBegin[indexMap[i]] = 0; 
     1762              nSize[indexMap[i]]  = 1; 
     1763              nBeginGlobal[indexMap[i]] = 0; 
    16871764              nGlob[indexMap[i]] = 1; 
    1688               globalZoomIndex[i].resize(1); 
    1689               globalZoomIndex[i](0) = 0; 
     1765              globalIndex[i].resize(1); 
     1766              globalIndex[i](0) = 0; 
    16901767              ++scalarId; 
    16911768            } 
     
    16931770          dataSize = 1; 
    16941771 
    1695           for (int i = 0; i < nZoomSize.size(); ++i) 
    1696             dataSize *= nZoomSize[i]; 
     1772          for (int i = 0; i < nSize.size(); ++i) 
     1773            dataSize *= nSize[i]; 
    16971774          serverDistribution_ = new CDistributionServer(server->intraCommRank,  
    1698                                                         globalZoomIndex, axis_domain_order, 
    1699                                                         nZoomBegin, nZoomSize, nZoomBeginGlobal, nGlob); 
     1775                                                        globalIndex, axis_domain_order, 
     1776                                                        nBegin, nSize, nBeginGlobal, nGlob); 
    17001777        } 
    17011778 
     
    17601837          nGlob.push_back(1);   
    17611838        } 
    1762  
    1763         modifyMaskSize(nSize, false); 
    1764  
    1765         // These below codes are reserved for future 
    1766         CDistributionServer srvDist(server->intraCommRank, nBegin, nSize, nBeginGlobal, nGlob);  
    1767         map<int, CArray<size_t, 1> >::iterator itb = outGlobalIndexFromClient.begin(), 
    1768                                                ite = outGlobalIndexFromClient.end(), it;   
    1769         const CDistributionServer::GlobalLocalMap&  globalLocalMask = srvDist.getGlobalLocalIndex(); 
    1770         CDistributionServer::GlobalLocalMap::const_iterator itSrv; 
    1771         size_t nb = 0; 
    1772         for (it = itb; it != ite; ++it) 
    1773         { 
    1774           CArray<size_t,1>& globalInd = it->second; 
    1775           for (size_t idx = 0; idx < globalInd.numElements(); ++idx) 
    1776           { 
    1777             if (globalLocalMask.end() != globalLocalMask.find(globalInd(idx))) ++nb; 
    1778           } 
    1779         } 
    1780          
    1781         CArray<int,1> indexToModify(nb); 
    1782         nb = 0;     
    1783         for (it = itb; it != ite; ++it) 
    1784         { 
    1785           CArray<size_t,1>& globalInd = it->second; 
    1786           for (size_t idx = 0; idx < globalInd.numElements(); ++idx) 
    1787           { 
    1788             itSrv = globalLocalMask.find(globalInd(idx)); 
    1789             if (globalLocalMask.end() != itSrv)  
    1790             { 
    1791               indexToModify(nb) = itSrv->second; 
    1792               ++nb; 
    1793             } 
    1794           } 
    1795         } 
    1796  
    1797         modifyMask(indexToModify, true); 
    17981839      } 
    17991840 
     
    18031844    } 
    18041845  } 
     1846  CATCH_DUMP_ATTR 
    18051847 
    18061848  /* 
     
    18181860                                        const std::vector<CScalar*> scalars, 
    18191861                                        const CArray<int,1>& axisDomainOrder) 
    1820   { 
     1862  TRY 
     1863 { 
    18211864 //   globalDim.resize(domains.size()*2+axis.size()+scalars.size()); 
    18221865    globalDim.resize(domains.size()*2+axis.size()); 
     
    18581901    return positionDimensionDistributed; 
    18591902  } 
     1903  CATCH_DUMP_ATTR 
    18601904 
    18611905  // Retrieve the global dimension of grid 
    18621906  std::vector<int> CGrid::getGlobalDimension() 
     1907  TRY 
    18631908  { 
    18641909    std::vector<int> globalDim; 
     
    18671912    return globalDim; 
    18681913  } 
     1914  CATCH_DUMP_ATTR 
    18691915 
    18701916  // Retrieve dimension on which we do distribution (Very often, it should be 2nd dimension) 
    18711917  int CGrid::getDistributedDimension() 
     1918  TRY 
    18721919  { 
    18731920    std::vector<int> globalDim; 
    18741921    return computeGridGlobalDimension(globalDim, getDomains(), getAxis(), getScalars(), axis_domain_order);     
    18751922  } 
     1923  CATCH_DUMP_ATTR 
    18761924 
    18771925  bool CGrid::isScalarGrid() const 
     1926  TRY 
    18781927  { 
    18791928    return (axisList_.empty() && domList_.empty()); 
    18801929  } 
     1930  CATCH 
    18811931 
    18821932  /*! 
     
    18861936  */ 
    18871937  bool CGrid::doGridHaveDataToWrite() 
     1938  TRY 
    18881939  { 
    18891940     return (0 != writtenDataSize_); 
    18901941  } 
     1942  CATCH_DUMP_ATTR 
    18911943 
    18921944  /*! 
     
    18971949  */ 
    18981950  size_t CGrid::getWrittenDataSize() const 
     1951  TRY 
    18991952  { 
    19001953    return writtenDataSize_; 
    19011954  } 
     1955  CATCH 
    19021956 
    19031957  /*! 
     
    19061960  */ 
    19071961  int CGrid::getNumberWrittenIndexes() const 
     1962  TRY 
    19081963  { 
    19091964    return numberWrittenIndexes_; 
    19101965  } 
     1966  CATCH 
    19111967 
    19121968  /*! 
     
    19151971  */ 
    19161972  int CGrid::getTotalNumberWrittenIndexes() const 
     1973  TRY 
    19171974  { 
    19181975    return totalNumberWrittenIndexes_; 
    19191976  } 
     1977  CATCH 
    19201978 
    19211979  /*! 
     
    19241982  */ 
    19251983  int CGrid::getOffsetWrittenIndexes() const 
     1984  TRY 
    19261985  { 
    19271986    return offsetWrittenIndexes_; 
    19281987  } 
     1988  CATCH 
    19291989 
    19301990  CDistributionServer* CGrid::getDistributionServer() 
     1991  TRY 
    19311992  { 
    19321993    return serverDistribution_; 
    19331994  } 
     1995  CATCH_DUMP_ATTR 
    19341996 
    19351997  CDistributionClient* CGrid::getDistributionClient() 
     1998  TRY 
    19361999  { 
    19372000    return clientDistribution_; 
    19382001  } 
     2002  CATCH_DUMP_ATTR 
    19392003 
    19402004  bool CGrid::doGridHaveDataDistributed(CContextClient* client) 
     2005  TRY 
    19412006  { 
    19422007    if (isScalarGrid()) return false; 
     
    19482013      return isDataDistributed_;     
    19492014  } 
     2015  CATCH_DUMP_ATTR 
    19502016 
    19512017   /*! 
     
    19572023   */ 
    19582024  bool CGrid::dispatchEvent(CEventServer& event) 
     2025  TRY 
    19592026  { 
    19602027 
     
    19902057    } 
    19912058  } 
     2059  CATCH 
    19922060 
    19932061   ///--------------------------------------------------------------- 
    19942062 
    19952063   CDomain* CGrid::addDomain(const std::string& id) 
     2064   TRY 
    19962065   { 
    19972066     order_.push_back(2); 
     
    20002069     return vDomainGroup_->createChild(id); 
    20012070   } 
     2071   CATCH_DUMP_ATTR 
    20022072 
    20032073   CAxis* CGrid::addAxis(const std::string& id) 
     2074   TRY 
    20042075   { 
    20052076     order_.push_back(1); 
     
    20082079     return vAxisGroup_->createChild(id); 
    20092080   } 
     2081   CATCH_DUMP_ATTR 
    20102082 
    20112083   CScalar* CGrid::addScalar(const std::string& id) 
     2084   TRY 
    20122085   { 
    20132086     order_.push_back(0); 
     
    20162089     return vScalarGroup_->createChild(id); 
    20172090   } 
     2091   CATCH_DUMP_ATTR 
    20182092 
    20192093   //! Change virtual field group to a new one 
    20202094   void CGrid::setVirtualDomainGroup(CDomainGroup* newVDomainGroup) 
     2095   TRY 
    20212096   { 
    20222097      this->vDomainGroup_ = newVDomainGroup; 
    20232098   } 
     2099   CATCH_DUMP_ATTR 
    20242100 
    20252101   //! Change virtual variable group to new one 
    20262102   void CGrid::setVirtualAxisGroup(CAxisGroup* newVAxisGroup) 
     2103   TRY 
    20272104   { 
    20282105      this->vAxisGroup_ = newVAxisGroup; 
    20292106   } 
     2107   CATCH_DUMP_ATTR 
    20302108 
    20312109   //! Change virtual variable group to new one 
    20322110   void CGrid::setVirtualScalarGroup(CScalarGroup* newVScalarGroup) 
     2111   TRY 
    20332112   { 
    20342113      this->vScalarGroup_ = newVScalarGroup; 
    20352114   } 
     2115   CATCH_DUMP_ATTR 
    20362116 
    20372117   /*! 
     
    20402120   */ 
    20412121   void CGrid::sendAddDomain(const string& id) 
    2042    { 
     2122   TRY 
     2123  { 
    20432124      sendAddItem(id, (int)EVENT_ID_ADD_DOMAIN); 
    20442125   } 
     2126   CATCH_DUMP_ATTR 
    20452127 
    20462128   /*! 
     
    20492131   */ 
    20502132   void CGrid::sendAddAxis(const string& id) 
     2133   TRY 
    20512134   { 
    20522135      sendAddItem(id, (int)EVENT_ID_ADD_AXIS); 
    20532136   } 
     2137   CATCH_DUMP_ATTR 
    20542138 
    20552139   /*! 
     
    20582142   */ 
    20592143   void CGrid::sendAddScalar(const string& id) 
     2144   TRY 
    20602145   { 
    20612146      sendAddItem(id, (int)EVENT_ID_ADD_SCALAR); 
    20622147   } 
     2148   CATCH_DUMP_ATTR 
    20632149 
    20642150   /*! 
     
    20672153   */ 
    20682154   void CGrid::recvAddDomain(CEventServer& event) 
     2155   TRY 
    20692156   { 
    20702157 
     
    20742161      get(id)->recvAddDomain(*buffer); 
    20752162   } 
     2163   CATCH 
    20762164 
    20772165   /*! 
     
    20802168   */ 
    20812169   void CGrid::recvAddDomain(CBufferIn& buffer) 
     2170   TRY 
    20822171   { 
    20832172      string id; 
     
    20852174      addDomain(id); 
    20862175   } 
     2176   CATCH_DUMP_ATTR 
    20872177 
    20882178   /*! 
     
    20912181   */ 
    20922182   void CGrid::recvAddAxis(CEventServer& event) 
     2183   TRY 
    20932184   { 
    20942185 
     
    20982189      get(id)->recvAddAxis(*buffer); 
    20992190   } 
     2191   CATCH 
    21002192 
    21012193   /*! 
     
    21042196   */ 
    21052197   void CGrid::recvAddAxis(CBufferIn& buffer) 
     2198   TRY 
    21062199   { 
    21072200      string id; 
     
    21092202      addAxis(id); 
    21102203   } 
     2204   CATCH_DUMP_ATTR 
    21112205 
    21122206   /*! 
     
    21152209   */ 
    21162210   void CGrid::recvAddScalar(CEventServer& event) 
     2211   TRY 
    21172212   { 
    21182213 
     
    21222217      get(id)->recvAddScalar(*buffer); 
    21232218   } 
     2219   CATCH 
    21242220 
    21252221   /*! 
     
    21282224   */ 
    21292225   void CGrid::recvAddScalar(CBufferIn& buffer) 
     2226   TRY 
    21302227   { 
    21312228      string id; 
     
    21332230      addScalar(id); 
    21342231   } 
     2232   CATCH_DUMP_ATTR 
    21352233 
    21362234  /*! 
     
    21412239  */ 
    21422240  void CGrid::solveDomainAxisRefInheritance(bool apply) 
     2241  TRY 
    21432242  { 
    21442243    CContext* context = CContext::getCurrent(); 
     
    21812280    } 
    21822281  } 
     2282  CATCH_DUMP_ATTR 
    21832283 
    21842284  bool CGrid::isTransformed() 
     2285  TRY 
    21852286  { 
    21862287    return isTransformed_; 
    21872288  } 
     2289  CATCH_DUMP_ATTR 
    21882290 
    21892291  void CGrid::setTransformed() 
     2292  TRY 
    21902293  { 
    21912294    isTransformed_ = true; 
    21922295  } 
     2296  CATCH_DUMP_ATTR 
    21932297 
    21942298  CGridTransformation* CGrid::getTransformations() 
     2299  TRY 
    21952300  { 
    21962301    return transformations_; 
    21972302  } 
     2303  CATCH_DUMP_ATTR 
    21982304 
    21992305  void CGrid::addTransGridSource(CGrid* gridSrc) 
     2306  TRY 
    22002307  { 
    22012308    if (gridSrc_.end() == gridSrc_.find(gridSrc)) 
    22022309      gridSrc_.insert(make_pair(gridSrc,make_pair(false,""))); 
    22032310  } 
     2311  CATCH_DUMP_ATTR 
    22042312 
    22052313  std::map<CGrid*,std::pair<bool,StdString> >& CGrid::getTransGridSource() 
     2314  TRY 
    22062315  { 
    22072316    return gridSrc_; 
    22082317  } 
     2318  CATCH_DUMP_ATTR 
    22092319 
    22102320  /*! 
     
    22132323  */ 
    22142324  void CGrid::completeGrid(CGrid* transformGridSrc) 
     2325  TRY 
    22152326  { 
    22162327    if (0 != transformGridSrc) 
     
    22312342    gridGenerate.completeGrid(); 
    22322343  } 
     2344  CATCH_DUMP_ATTR 
    22332345 
    22342346  bool CGrid::isGenerated() 
     2347  TRY 
    22352348  { 
    22362349    return isGenerated_; 
    22372350  } 
     2351  CATCH 
    22382352 
    22392353  void CGrid::setGenerated() 
     2354  TRY 
    22402355  { 
    22412356    isGenerated_ = true; 
    22422357  } 
     2358  CATCH_DUMP_ATTR 
    22432359 
    22442360  void CGrid::transformGrid(CGrid* transformGridSrc) 
     2361  TRY 
    22452362  { 
    22462363    if (!transformGridSrc) 
     
    22682385    transformGridSrc->checkMaskIndex(false); 
    22692386  } 
     2387  CATCH_DUMP_ATTR 
    22702388 
    22712389  bool CGrid::hasTransform() 
     2390  TRY 
    22722391  { 
    22732392    if (hasTransform_) return hasTransform_; 
     
    22832402    return hasTransform_; 
    22842403  } 
     2404  CATCH_DUMP_ATTR 
    22852405 
    22862406  /*! 
     
    22892409  */ 
    22902410  std::vector<CDomain*> CGrid::getDomains() 
     2411  TRY 
    22912412  { 
    22922413    std::vector<CDomain*> domList; 
     
    22972418    return domList; 
    22982419  } 
     2420  CATCH_DUMP_ATTR 
    22992421 
    23002422  /*! 
     
    23032425  */ 
    23042426  std::vector<CAxis*> CGrid::getAxis() 
     2427  TRY 
    23052428  { 
    23062429    std::vector<CAxis*> aList; 
     
    23102433    return aList; 
    23112434  } 
     2435  CATCH_DUMP_ATTR 
    23122436 
    23132437  /*! 
     
    23162440  */ 
    23172441  std::vector<CScalar*> CGrid::getScalars() 
     2442  TRY 
    23182443  { 
    23192444    std::vector<CScalar*> sList; 
     
    23232448    return sList; 
    23242449  } 
     2450  CATCH_DUMP_ATTR 
    23252451 
    23262452  /*! 
     
    23292455  */ 
    23302456  CDomain* CGrid::getDomain(int domainIndex) 
     2457  TRY 
    23312458  { 
    23322459    std::vector<CDomain*> domainListP = this->getDomains(); 
     
    23462473    return domainListP[domainIndex]; 
    23472474  } 
     2475  CATCH_DUMP_ATTR 
    23482476 
    23492477  /*! 
     
    23522480  */ 
    23532481  CAxis* CGrid::getAxis(int axisIndex) 
     2482  TRY 
    23542483  { 
    23552484    std::vector<CAxis*> axisListP = this->getAxis(); 
     
    23692498    return axisListP[axisIndex]; 
    23702499  } 
     2500  CATCH_DUMP_ATTR 
    23712501 
    23722502  /*! 
     
    23752505  */ 
    23762506  CScalar* CGrid::getScalar(int scalarIndex) 
     2507  TRY 
    23772508  { 
    23782509    std::vector<CScalar*> scalarListP = this->getScalars(); 
     
    23922523    return scalarListP[scalarIndex]; 
    23932524  } 
     2525  CATCH_DUMP_ATTR 
    23942526 
    23952527  /*! 
     
    23982530  */ 
    23992531  void CGrid::setDomainList(const std::vector<CDomain*> domains) 
     2532  TRY 
    24002533  { 
    24012534    if (isDomListSet) return; 
     
    24182551      isDomListSet = true; 
    24192552    } 
    2420  
    2421   } 
     2553  } 
     2554  CATCH_DUMP_ATTR 
    24222555 
    24232556  /*! 
     
    24262559  */ 
    24272560  void CGrid::setAxisList(const std::vector<CAxis*> axis) 
     2561  TRY 
    24282562  { 
    24292563    if (isAxisListSet) return; 
     
    24472581    } 
    24482582  } 
     2583  CATCH_DUMP_ATTR 
    24492584 
    24502585  /*! 
     
    24532588  */ 
    24542589  void CGrid::setScalarList(const std::vector<CScalar*> scalars) 
     2590  TRY 
    24552591  { 
    24562592    if (isScalarListSet) return; 
     
    24742610    } 
    24752611  } 
     2612  CATCH_DUMP_ATTR 
    24762613 
    24772614  /*! 
     
    24802617  */ 
    24812618  std::vector<StdString> CGrid::getDomainList() 
     2619  TRY 
    24822620  { 
    24832621    setDomainList(); 
    24842622    return domList_; 
    24852623  } 
     2624  CATCH 
    24862625 
    24872626  /*! 
     
    24902629  */ 
    24912630  std::vector<StdString> CGrid::getAxisList() 
     2631  TRY 
    24922632  { 
    24932633    setAxisList(); 
    24942634    return axisList_; 
    24952635  } 
     2636  CATCH 
    24962637 
    24972638  /*! 
     
    25002641  */ 
    25012642  std::vector<StdString> CGrid::getScalarList() 
     2643  TRY 
    25022644  { 
    25032645    setScalarList(); 
    25042646    return scalarList_; 
    25052647  } 
     2648  CATCH 
    25062649 
    25072650  /*! 
     
    25092652  */ 
    25102653  void CGrid::sendAllDomains() 
     2654  TRY 
    25112655  { 
    25122656    std::vector<CDomain*> domList = this->getVirtualDomainGroup()->getAllChildren(); 
     
    25182662    } 
    25192663  } 
     2664  CATCH_DUMP_ATTR 
    25202665 
    25212666  /*! 
     
    25232668  */ 
    25242669  void CGrid::sendAllAxis() 
     2670  TRY 
    25252671  { 
    25262672    std::vector<CAxis*> aList = this->getVirtualAxisGroup()->getAllChildren(); 
     
    25332679    } 
    25342680  } 
     2681  CATCH_DUMP_ATTR 
    25352682 
    25362683  /*! 
     
    25382685  */ 
    25392686  void CGrid::sendAllScalars() 
     2687  TRY 
    25402688  { 
    25412689    std::vector<CScalar*> sList = this->getVirtualScalarGroup()->getAllChildren(); 
     
    25482696    } 
    25492697  } 
     2698  CATCH_DUMP_ATTR 
    25502699 
    25512700  void CGrid::setContextClient(CContextClient* contextClient) 
     2701  TRY 
    25522702  { 
    25532703    if (clientsSet.find(contextClient)==clientsSet.end()) 
     
    25612711        this->getAxis()[i]->setContextClient(contextClient); 
    25622712  } 
     2713  CATCH_DUMP_ATTR 
    25632714 
    25642715  /*! 
     
    25662717  */ 
    25672718  void CGrid::parse(xml::CXMLNode& node) 
     2719  TRY 
    25682720  { 
    25692721    SuperClass::parse(node); 
     
    26062758    setScalarList(); 
    26072759   } 
     2760  CATCH_DUMP_ATTR 
     2761 
    26082762} // namespace xios 
  • XIOS/dev/branch_openmp/src/node/grid.hpp

    r1545 r1642  
    1919namespace xios { 
    2020 
    21    /// ////////////////////// Dᅵᅵclarations ////////////////////// /// 
     21   /// ////////////////////// Declarations ////////////////////// /// 
    2222 
    2323   class CGridGroup; 
     
    9191         StdSize  getDataSize(void) const; 
    9292 
    93          /// Entrᅵᅵes-sorties de champs 
     93         /// Entrees-sorties de champs 
    9494         template <int n> 
    9595         void inputField(const CArray<double,n>& field, CArray<double,1>& stored) const; 
     96         template <int n> 
     97         void maskField(const CArray<double,n>& field, CArray<double,1>& stored) const; 
    9698         template <int n> 
    9799         void outputField(const CArray<double,1>& stored, CArray<double,n>& field) const;   
     
    203205         bool hasTransform(); 
    204206         size_t getGlobalWrittenSize(void) ; 
    205          void getLocalMask(CArray<bool,1>& localMask) ; 
    206          template<int N> 
    207          void getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask) ; 
    208207      public: 
    209208         CArray<int, 1> storeIndex_client; 
     209         CArray<bool, 1> storeMask_client; 
    210210 
    211211/** Map containing indexes that will be sent in sendIndex(). */ 
     
    247247         CArray<size_t,1> indexFromClients; 
    248248 
     249         bool hasMask(void) const; 
    249250         void checkMask(void); 
    250251         void createMask(void); 
     
    273274        void restoreField_arr(const CArray<double, 1>& stored, double* const data) const; 
    274275        void uncompressField_arr(const double* const data, CArray<double, 1>& outData) const; 
     276        void maskField_arr(const double* const data, CArray<double, 1>& stored) const; 
    275277 
    276278        void setVirtualDomainGroup(CDomainGroup* newVDomainGroup); 
     
    372374   template <int n> 
    373375   void CGrid::inputField(const CArray<double,n>& field, CArray<double,1>& stored) const 
     376   TRY 
    374377   { 
    375378//#ifdef __XIOS_DEBUG 
     
    383386      this->storeField_arr(field.dataFirst(), stored); 
    384387   } 
     388   CATCH 
     389 
     390   template <int n> 
     391   void CGrid::maskField(const CArray<double,n>& field, CArray<double,1>& stored) const 
     392   { 
     393//#ifdef __XIOS_DEBUG 
     394      if (this->getDataSize() != field.numElements()) 
     395         ERROR("void CGrid::inputField(const  CArray<double,n>& field, CArray<double,1>& stored) const", 
     396                << "[ Awaiting data of size = " << this->getDataSize() << ", " 
     397                << "Received data size = "      << field.numElements() << " ] " 
     398                << "The data array does not have the right size! " 
     399                << "Grid = " << this->getId()) 
     400//#endif 
     401      this->maskField_arr(field.dataFirst(), stored); 
     402   } 
    385403 
    386404   template <int n> 
    387405   void CGrid::outputField(const CArray<double,1>& stored, CArray<double,n>& field) const 
     406   TRY 
    388407   { 
    389408//#ifdef __XIOS_DEBUG 
     
    397416      this->restoreField_arr(stored, field.dataFirst()); 
    398417   } 
     418   CATCH 
    399419 
    400420   /*! 
     
    406426   template <int N> 
    407427   void CGrid::uncompressField(const CArray<double,N>& data, CArray<double,1>& outData) const 
     428   TRY 
    408429   {       
    409430     uncompressField_arr(data.dataFirst(), outData); 
    410431   } 
     432   CATCH 
    411433 
    412434   template<int N> 
     
    416438                             const CArray<int,1>& axisDomainOrder, 
    417439                             bool createMask) 
     440   TRY 
    418441   { 
    419442     int idx = 0; 
     
    510533      ++idx; 
    511534    } 
    512  
    513    } 
     535   } 
     536   CATCH_DUMP_ATTR 
    514537 
    515538   template<int N> 
     
    517540                                  const std::vector<int>& eachDimSize, 
    518541                                  bool newValue) 
     542   TRY 
    519543   { 
    520544      if (N != eachDimSize.size()) 
     
    531555      gridMask = newValue; 
    532556   } 
     557   CATCH_DUMP_ATTR 
    533558                                  
    534559 
     
    540565   template<int N> 
    541566   void CGrid::modifyGridMask(CArray<bool,N>& gridMask, const CArray<int,1>& indexToModify, bool valueToModify) 
     567   TRY 
    542568   {      
    543569     int num = indexToModify.numElements(); 
     
    547573     } 
    548574   } 
     575   CATCH_DUMP_ATTR 
     576 
    549577   ///-------------------------------------------------------------- 
    550578 
    551579 
    552 /*! 
    553   A grid can have multiple dimension, so can its mask in the form of multi-dimension array. 
    554 It's not a good idea to store all multi-dimension arrays corresponding to each mask. 
    555 One of the ways is to convert this array into 1-dimension one and every process is taken place on it. 
    556   \param [in] multi-dimension array grid mask 
    557 */ 
    558 template<int N> 
    559 void CGrid::getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask) 
    560 { 
    561   if (gridMask.isEmpty()) return ; 
    562   int dim = gridMask.dimensions(); 
    563   std::vector<int> dimensionSizes(dim); 
    564   for (int i = 0; i < dim; ++i) dimensionSizes[i] = gridMask.extent(i); 
    565  
    566   std::vector<int> idxLoop(dim,0); 
    567   int ssize = gridMask.numElements(), idx = 0; 
    568   localMask.resize(ssize); 
    569   while (idx < ssize) 
    570   { 
    571     for (int i = 0; i < dim-1; ++i) 
    572     { 
    573       if (idxLoop[i] == dimensionSizes[i]) 
    574       { 
    575         idxLoop[i] = 0; 
    576         ++idxLoop[i+1]; 
    577       } 
    578     } 
    579  
    580     int maskIndex = idxLoop[0]; 
    581     int mulDim = 1; 
    582     for (int k = 1; k < dim; ++k) 
    583     { 
    584       mulDim *= dimensionSizes[k-1]; 
    585       maskIndex += idxLoop[k]*mulDim; 
    586     } 
    587     localMask(maskIndex) = *(gridMask.dataFirst()+maskIndex); 
    588  
    589     ++idxLoop[0]; 
    590     ++idx; 
    591   } 
    592 } 
    593580 
    594581   // Declare/Define CGridGroup and CGridDefinition 
  • XIOS/dev/branch_openmp/src/node/interpolate_axis.hpp

    r1331 r1642  
    6262      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6363      static bool _dummyRegistered; 
    64       #pragma omp threadprivate(_dummyRegistered) 
    6564  }; // class CInterpolateAxis 
    6665 
  • XIOS/dev/branch_openmp/src/node/interpolate_domain.cpp

    r1460 r1642  
    6565    if (this->read_write_convention.isEmpty()) this->read_write_convention.setValue(read_write_convention_attr::fortran); 
    6666 
     67 
    6768  } 
    6869 
  • XIOS/dev/branch_openmp/src/node/interpolate_domain.hpp

    r1331 r1642  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CInterpolateDomain 
    6463 
  • XIOS/dev/branch_openmp/src/node/inverse_axis.hpp

    r1331 r1642  
    5959      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6060      static bool _dummyRegistered; 
    61       #pragma omp threadprivate(_dummyRegistered) 
    6261 
    6362  }; // class CInverseAxis 
  • XIOS/dev/branch_openmp/src/node/mesh.cpp

    r1545 r1642  
    66 
    77#include "mesh.hpp" 
    8 using namespace ep_lib; 
    98#include <boost/functional/hash.hpp> 
     9//#include <unordered_map> 
    1010 
    1111namespace xios { 
     
    3333  } 
    3434 
    35   std::map <StdString, CMesh> *CMesh::meshList_ptr = 0; 
    36   std::map <StdString, vector<int> > *CMesh::domainList_ptr = 0; 
     35  std::map <StdString, CMesh> CMesh::meshList = std::map <StdString, CMesh>(); 
     36  std::map <StdString, vector<int> > CMesh::domainList = std::map <StdString, vector<int> >(); 
    3737 
    3838///--------------------------------------------------------------- 
     
    4545  CMesh* CMesh::getMesh (StdString meshName, int nvertex) 
    4646  { 
    47     if(CMesh::domainList_ptr == NULL) CMesh::domainList_ptr = new std::map <StdString, vector<int> >(); 
    48     if(CMesh::meshList_ptr == NULL)   CMesh::meshList_ptr   = new std::map <StdString, CMesh>(); 
    49  
    50     CMesh::domainList_ptr->at(meshName).push_back(nvertex); 
    51  
    52     if ( CMesh::meshList_ptr->begin() != CMesh::meshList_ptr->end() ) 
    53     { 
    54       for (std::map<StdString, CMesh>::iterator it=CMesh::meshList_ptr->begin(); it!=CMesh::meshList_ptr->end(); ++it) 
     47    CMesh::domainList[meshName].push_back(nvertex); 
     48 
     49    if ( CMesh::meshList.begin() != CMesh::meshList.end() ) 
     50    { 
     51      for (std::map<StdString, CMesh>::iterator it=CMesh::meshList.begin(); it!=CMesh::meshList.end(); ++it) 
    5552      { 
    5653        if (it->first == meshName) 
    57           return &meshList_ptr->at(meshName); 
     54          return &meshList[meshName]; 
    5855        else 
    5956        { 
    6057          CMesh newMesh; 
    61           CMesh::meshList_ptr->insert( make_pair(meshName, newMesh) ); 
    62           return &meshList_ptr->at(meshName); 
     58          CMesh::meshList.insert( make_pair(meshName, newMesh) ); 
     59          return &meshList[meshName]; 
    6360        } 
    6461      } 
     
    6764    { 
    6865      CMesh newMesh; 
    69       CMesh::meshList_ptr->insert( make_pair(meshName, newMesh) ); 
    70       return &meshList_ptr->at(meshName); 
     66      CMesh::meshList.insert( make_pair(meshName, newMesh) ); 
     67      return &meshList[meshName]; 
    7168    } 
    7269  } 
     
    227224 * \param [in] bounds_lat Array of boundary latitudes. Its size depends on the element type. 
    228225 */ 
     226//  void CMesh::createMesh(const CArray<double, 1>& lonvalue, const CArray<double, 1>& latvalue, 
     227//            const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat) 
     228//  { 
     229//    int nvertex = (bounds_lon.numElements() == 0) ? 1 : bounds_lon.rows(); 
     230// 
     231//    if (nvertex == 1) 
     232//    { 
     233//      nbNodes_ = lonvalue.numElements(); 
     234//      node_lon.resizeAndPreserve(nbNodes_); 
     235//      node_lat.resizeAndPreserve(nbNodes_); 
     236//      for (int nn = 0; nn < nbNodes_; ++nn) 
     237//      { 
     238//        if (map_nodes.find(make_pair (lonvalue(nn), latvalue(nn))) == map_nodes.end()) 
     239//        { 
     240//          map_nodes[make_pair (lonvalue(nn), latvalue(nn))] = nn ; 
     241//          node_lon(nn) = lonvalue(nn); 
     242//          node_lat(nn) = latvalue(nn); 
     243//        } 
     244//      } 
     245//    } 
     246//    else if (nvertex == 2) 
     247//    { 
     248//      nbEdges_ = bounds_lon.shape()[1]; 
     249// 
     250//      // Create nodes and edge_node connectivity 
     251//      node_lon.resizeAndPreserve(nbEdges_*nvertex); // Max possible number of nodes 
     252//      node_lat.resizeAndPreserve(nbEdges_*nvertex); 
     253//      edge_nodes.resizeAndPreserve(nvertex, nbEdges_); 
     254// 
     255//      for (int ne = 0; ne < nbEdges_; ++ne) 
     256//      { 
     257//        for (int nv = 0; nv < nvertex; ++nv) 
     258//        { 
     259//          if (map_nodes.find(make_pair (bounds_lon(nv, ne), bounds_lat(nv ,ne))) == map_nodes.end()) 
     260//          { 
     261//            map_nodes[make_pair (bounds_lon(nv, ne), bounds_lat(nv, ne))] = nbNodes_ ; 
     262//            edge_nodes(nv,ne) = nbNodes_ ; 
     263//            node_lon(nbNodes_) = bounds_lon(nv, ne); 
     264//            node_lat(nbNodes_) = bounds_lat(nv, ne); 
     265//            ++nbNodes_ ; 
     266//          } 
     267//          else 
     268//            edge_nodes(nv,ne) = map_nodes[make_pair (bounds_lon(nv, ne), bounds_lat(nv ,ne))]; 
     269//        } 
     270//      } 
     271//      node_lon.resizeAndPreserve(nbNodes_); 
     272//      node_lat.resizeAndPreserve(nbNodes_); 
     273// 
     274//      // Create edges 
     275//      edge_lon.resizeAndPreserve(nbEdges_); 
     276//      edge_lat.resizeAndPreserve(nbEdges_); 
     277// 
     278//      for (int ne = 0; ne < nbEdges_; ++ne) 
     279//      { 
     280//        if (map_edges.find(make_ordered_pair (edge_nodes(0,ne), edge_nodes(1,ne))) == map_edges.end()) 
     281//        { 
     282//          map_edges[make_ordered_pair ( edge_nodes(0,ne), edge_nodes(1,ne) )] = ne ; 
     283//          edge_lon(ne) = lonvalue(ne); 
     284//          edge_lat(ne) = latvalue(ne); 
     285//        } 
     286// 
     287//      } 
     288//      edgesAreWritten = true; 
     289//    } 
     290//    else 
     291//    { 
     292//      nbFaces_ = bounds_lon.shape()[1]; 
     293// 
     294//      // Create nodes and face_node connectivity 
     295//      node_lon.resizeAndPreserve(nbFaces_*nvertex);  // Max possible number of nodes 
     296//      node_lat.resizeAndPreserve(nbFaces_*nvertex); 
     297//      face_nodes.resize(nvertex, nbFaces_); 
     298// 
     299//      for (int nf = 0; nf < nbFaces_; ++nf) 
     300//      { 
     301//        for (int nv = 0; nv < nvertex; ++nv) 
     302//        { 
     303//          if (map_nodes.find(make_pair (bounds_lon(nv, nf), bounds_lat(nv ,nf))) == map_nodes.end()) 
     304//          { 
     305//            map_nodes[make_pair (bounds_lon(nv, nf), bounds_lat(nv, nf))] = nbNodes_ ; 
     306//            face_nodes(nv,nf) = nbNodes_ ; 
     307//            node_lon(nbNodes_) = bounds_lon(nv, nf); 
     308//            node_lat(nbNodes_) = bounds_lat(nv ,nf); 
     309//            ++nbNodes_ ; 
     310//          } 
     311//          else 
     312//          { 
     313//            face_nodes(nv,nf) = map_nodes[make_pair (bounds_lon(nv, nf), bounds_lat(nv ,nf))]; 
     314//          } 
     315//        } 
     316//      } 
     317//      node_lon.resizeAndPreserve(nbNodes_); 
     318//      node_lat.resizeAndPreserve(nbNodes_); 
     319// 
     320//      // Create edges and edge_nodes connectivity 
     321//      edge_lon.resizeAndPreserve(nbFaces_*nvertex); // Max possible number of edges 
     322//      edge_lat.resizeAndPreserve(nbFaces_*nvertex); 
     323//      edge_nodes.resizeAndPreserve(2, nbFaces_*nvertex); 
     324//      edge_faces.resize(2, nbFaces_*nvertex); 
     325//      face_edges.resize(nvertex, nbFaces_); 
     326//      face_faces.resize(nvertex, nbFaces_); 
     327// 
     328//      vector<int> countEdges(nbFaces_*nvertex);   // needed in case if edges have been already generated 
     329//      vector<int> countFaces(nbFaces_); 
     330//      countEdges.assign(nbFaces_*nvertex, 0); 
     331//      countFaces.assign(nbFaces_, 0); 
     332//      int edge; 
     333//      for (int nf = 0; nf < nbFaces_; ++nf) 
     334//      { 
     335//        for (int nv1 = 0; nv1 < nvertex; ++nv1) 
     336//        { 
     337//          int nv = 0; 
     338//          int nv2 = (nv1 < nvertex -1 ) ? (nv1 + 1) : (nv1 + 1 - nvertex); // cyclic rotation 
     339//          if (map_edges.find(make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))) == map_edges.end()) 
     340//          { 
     341//            map_edges[make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))] = nbEdges_ ; 
     342//            face_edges(nv1,nf) = map_edges[make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))]; 
     343//            edge_faces(0,nbEdges_) = nf; 
     344//            edge_faces(1,nbEdges_) = -999; 
     345//            face_faces(nv1,nf) = 999999; 
     346//            edge_nodes(Range::all(),nbEdges_) = face_nodes(nv1,nf), face_nodes(nv2,nf); 
     347//            edge_lon(nbEdges_) = ( abs( node_lon(face_nodes(nv1,nf)) - node_lon(face_nodes(nv2,nf))) < 180.) ? 
     348//                        (( node_lon(face_nodes(nv1,nf)) + node_lon(face_nodes(nv2,nf))) * 0.5) : 
     349//                        (( node_lon(face_nodes(nv1,nf)) + node_lon(face_nodes(nv2,nf))) * 0.5 -180.); 
     350//            edge_lat(nbEdges_) = ( node_lat(face_nodes(nv1,nf)) + node_lat(face_nodes(nv2,nf)) ) * 0.5; 
     351//            ++nbEdges_; 
     352//          } 
     353//          else 
     354//          { 
     355//            edge = map_edges[make_ordered_pair (face_nodes(nv1,nf), face_nodes(nv2,nf))]; 
     356//            face_edges(nv1,nf) = edge; 
     357//            if (edgesAreWritten) 
     358//            { 
     359//              edge_faces(countEdges[edge], edge) = nf; 
     360//              if (countEdges[edge]==0) 
     361//              { 
     362//                face_faces(nv1,nf) = 999999; 
     363//              } 
     364//              else 
     365//              { 
     366//                int face1 = nf; // = edge_faces(1,edge) 
     367//                int face2 = edge_faces(0,edge); 
     368//                face_faces(countFaces[face1], face1) =  face2; 
     369//                face_faces(countFaces[face2], face2) =  face1; 
     370//                ++(countFaces[face1]); 
     371//                ++(countFaces[face2]); 
     372//              } 
     373//            } 
     374//            else 
     375//            { 
     376//              edge_faces(1,edge) = nf; 
     377//              int face1 = nf; // = edge_faces(1,edge) 
     378//              int face2 = edge_faces(0,edge); 
     379//              face_faces(countFaces[face1], face1) =  face2; 
     380//              face_faces(countFaces[face2], face2) =  face1; 
     381//              ++(countFaces[face1]); 
     382//              ++(countFaces[face2]); 
     383//            } 
     384//            ++(countEdges[edge]); 
     385//          } 
     386//        } 
     387//      } 
     388//      edge_nodes.resizeAndPreserve(2, nbEdges_); 
     389//      edge_faces.resizeAndPreserve(2, nbEdges_); 
     390//      edge_lon.resizeAndPreserve(nbEdges_); 
     391//      edge_lat.resizeAndPreserve(nbEdges_); 
     392// 
     393//      // Create faces 
     394//      face_lon.resize(nbFaces_); 
     395//      face_lat.resize(nbFaces_); 
     396//      face_lon = lonvalue; 
     397//      face_lat = latvalue; 
     398//      facesAreWritten = true; 
     399// 
     400//    } // nvertex > 2 
     401// 
     402//  } // createMesh() 
    229403 
    230404///---------------------------------------------------------------- 
     
    240414 * \param [in] bounds_lat Array of boundary latitudes. Its size depends on the element type. 
    241415 */ 
    242   void CMesh::createMeshEpsilon(const MPI_Comm& comm, 
     416  void CMesh::createMeshEpsilon(const ep_lib::MPI_Comm& comm, 
    243417                                const CArray<double, 1>& lonvalue, const CArray<double, 1>& latvalue, 
    244418                                const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat) 
     
    247421    int nvertex = (bounds_lon.numElements() == 0) ? 1 : bounds_lon.rows(); 
    248422    int mpiRank, mpiSize; 
    249     MPI_Comm_rank(comm, &mpiRank); 
    250     MPI_Comm_size(comm, &mpiSize); 
     423    ep_lib::MPI_Comm_rank(comm, &mpiRank); 
     424    ep_lib::MPI_Comm_size(comm, &mpiSize); 
    251425    double prec = 1e-11;  // used in calculations of edge_lon/lat 
    252426 
     
    286460      unsigned long nbEdgesOnProc = nbEdges_; 
    287461      unsigned long nbEdgesAccum; 
    288       MPI_Scan(&nbEdgesOnProc, &nbEdgesAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 
     462      ep_lib::MPI_Scan(&nbEdgesOnProc, &nbEdgesAccum, 1, EP_UNSIGNED_LONG, EP_SUM, comm); 
    289463      nbEdgesAccum -= nbEdges_; 
    290464 
     
    416590         unsigned long nodeCount = nodeIdx2Idx.size(); 
    417591         unsigned long nodeStart, nbNodes; 
    418          MPI_Scan(&nodeCount, &nodeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 
     592         ep_lib::MPI_Scan(&nodeCount, &nodeStart, 1, EP_UNSIGNED_LONG, EP_SUM, comm); 
    419593         int nNodes = nodeStart; 
    420          MPI_Bcast(&nNodes, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); 
     594         ep_lib::MPI_Bcast(&nNodes, 1, EP_UNSIGNED_LONG, mpiSize-1, comm); 
    421595         nbNodesGlo = nNodes; 
    422596 
     
    509683      unsigned long nbFacesOnProc = nbFaces_; 
    510684      unsigned long nbFacesAccum; 
    511       MPI_Scan(&nbFacesOnProc, &nbFacesAccum, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 
     685      ep_lib::MPI_Scan(&nbFacesOnProc, &nbFacesAccum, 1, EP_UNSIGNED_LONG, EP_SUM, comm); 
    512686      nbFacesAccum -= nbFaces_; 
    513687 
     
    633807 
    634808        unsigned long edgeStart, nbEdges; 
    635         MPI_Scan(&edgeCount, &edgeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 
     809        ep_lib::MPI_Scan(&edgeCount, &edgeStart, 1, EP_UNSIGNED_LONG, EP_SUM, comm); 
    636810        int nEdges = edgeStart; 
    637         MPI_Bcast(&nEdges, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); 
     811        ep_lib::MPI_Bcast(&nEdges, 1, EP_UNSIGNED_LONG, mpiSize-1, comm); 
    638812        nbEdgesGlo = nEdges; 
    639813 
     
    8541028        unsigned long edgeCount = edgeIdx2Idx.size(); 
    8551029        unsigned long edgeStart, nbEdges; 
    856         MPI_Scan(&edgeCount, &edgeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 
     1030        ep_lib::MPI_Scan(&edgeCount, &edgeStart, 1, EP_UNSIGNED_LONG, EP_SUM, comm); 
    8571031        int nEdges = edgeStart; 
    858         MPI_Bcast(&nEdges, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); 
     1032        ep_lib::MPI_Bcast(&nEdges, 1, EP_UNSIGNED_LONG, mpiSize-1, comm); 
    8591033        nbEdgesGlo = nEdges; 
    8601034 
     
    11241298        unsigned long nodeCount = nodeIdx2Idx.size(); 
    11251299        unsigned long nodeStart, nbNodes; 
    1126         MPI_Scan(&nodeCount, &nodeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 
     1300        ep_lib::MPI_Scan(&nodeCount, &nodeStart, 1, EP_UNSIGNED_LONG, EP_SUM, comm); 
    11271301        int nNodes = nodeStart; 
    1128         MPI_Bcast(&nNodes, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); 
     1302        ep_lib::MPI_Bcast(&nNodes, 1, EP_UNSIGNED_LONG, mpiSize-1, comm); 
    11291303        nbNodesGlo = nNodes; 
    11301304 
     
    12441418        unsigned long edgeCount = edgeIdx2Idx.size(); 
    12451419        unsigned long edgeStart, nbEdges; 
    1246         MPI_Scan(&edgeCount, &edgeStart, 1, MPI_UNSIGNED_LONG, MPI_SUM, comm); 
     1420        ep_lib::MPI_Scan(&edgeCount, &edgeStart, 1, EP_UNSIGNED_LONG, EP_SUM, comm); 
    12471421        int nEdges = edgeStart; 
    1248         MPI_Bcast(&nEdges, 1, MPI_UNSIGNED_LONG, mpiSize-1, comm); 
     1422        ep_lib::MPI_Bcast(&nEdges, 1, EP_UNSIGNED_LONG, mpiSize-1, comm); 
    12491423        nbEdgesGlo = nEdges; 
    12501424 
     
    14401614   */ 
    14411615 
    1442   void CMesh::getGloNghbFacesNodeType(const MPI_Comm& comm, const CArray<int, 1>& face_idx, 
     1616  void CMesh::getGloNghbFacesNodeType(const ep_lib::MPI_Comm& comm, const CArray<int, 1>& face_idx, 
    14431617                               const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat, 
    14441618                               CArray<int, 2>& nghbFaces) 
     
    14491623 
    14501624    int mpiRank, mpiSize; 
    1451     MPI_Comm_rank(comm, &mpiRank); 
    1452     MPI_Comm_size(comm, &mpiSize); 
     1625    ep_lib::MPI_Comm_rank(comm, &mpiRank); 
     1626    ep_lib::MPI_Comm_size(comm, &mpiSize); 
    14531627 
    14541628    // (1) Generating unique node indexes 
     
    15961770   */ 
    15971771 
    1598   void CMesh::getGloNghbFacesEdgeType(const MPI_Comm& comm, const CArray<int, 1>& face_idx, 
     1772  void CMesh::getGloNghbFacesEdgeType(const ep_lib::MPI_Comm& comm, const CArray<int, 1>& face_idx, 
    15991773                               const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat, 
    16001774                               CArray<int, 2>& nghbFaces) 
     
    16051779 
    16061780    int mpiRank, mpiSize; 
    1607     MPI_Comm_rank(comm, &mpiRank); 
    1608     MPI_Comm_size(comm, &mpiSize); 
     1781    ep_lib::MPI_Comm_rank(comm, &mpiRank); 
     1782    ep_lib::MPI_Comm_size(comm, &mpiSize); 
    16091783 
    16101784    // (1) Generating unique node indexes 
     
    17771951   */ 
    17781952 
    1779   void CMesh::getGlobalNghbFaces(const int nghbType, const MPI_Comm& comm, 
     1953  void CMesh::getGlobalNghbFaces(const int nghbType, const ep_lib::MPI_Comm& comm, 
    17801954                                 const CArray<int, 1>& face_idx, 
    17811955                                 const CArray<double, 2>& bounds_lon, const CArray<double, 2>& bounds_lat, 
  • XIOS/dev/branch_openmp/src/node/mesh.hpp

    r1545 r1642  
    8383      int nbFaces_; 
    8484 
    85       static std::map <StdString, CMesh> *meshList_ptr; 
    86       #pragma omp threadprivate(meshList_ptr) 
    87       static std::map <StdString, vector<int> > *domainList_ptr; 
    88       #pragma omp threadprivate(domainList_ptr) 
     85      static std::map <StdString, CMesh> meshList; 
     86      static std::map <StdString, vector<int> > domainList; 
    8987      CClientClientDHTSizet* pNodeGlobalIndex;                    // pointer to a map <nodeHash, nodeIdxGlo> 
    9088      CClientClientDHTSizet* pEdgeGlobalIndex;                    // pointer to a map <edgeHash, edgeIdxGlo> 
  • XIOS/dev/branch_openmp/src/node/node_enum.hpp

    r1460 r1642  
    2323         eZoomAxis, 
    2424         eInterpolateAxis, 
     25         eExtractAxis, 
    2526         eZoomDomain, 
    2627         eInterpolateDomain, 
     
    3839         eDuplicateScalarToAxis, 
    3940         eReduceScalarToScalar, 
    40          eReorderDomain 
     41         eReorderDomain, 
     42         eExtractDomain 
    4143       } ENodeType; 
    4244 
  • XIOS/dev/branch_openmp/src/node/node_type.hpp

    r1460 r1642  
    1313#include "zoom_axis.hpp" 
    1414#include "interpolate_axis.hpp" 
     15#include "extract_axis.hpp" 
    1516#include "zoom_domain.hpp" 
    1617#include "interpolate_domain.hpp" 
     
    2930#include "reduce_scalar_to_scalar.hpp" 
    3031#include "reorder_domain.hpp" 
     32#include "extract_domain.hpp" 
    3133 
    3234 
  • XIOS/dev/branch_openmp/src/node/reduce_axis_to_axis.hpp

    r1460 r1642  
    5959      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6060      static bool _dummyRegistered; 
    61       #pragma omp threadprivate(_dummyRegistered) 
    6261  }; // class CReduceAxisToAxis 
    6362 
  • XIOS/dev/branch_openmp/src/node/reduce_axis_to_scalar.hpp

    r1331 r1642  
    5959      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6060      static bool _dummyRegistered; 
    61       #pragma omp threadprivate(_dummyRegistered) 
    6261  }; // class CReduceAxisToScalar 
    6362 
  • XIOS/dev/branch_openmp/src/node/reduce_domain_to_axis.hpp

    r1331 r1642  
    6060      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CReduceDomainToAxis 
    6463 
  • XIOS/dev/branch_openmp/src/node/reduce_domain_to_scalar.hpp

    r1331 r1642  
    6060      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CReduceDomainToScalar 
    6463 
  • XIOS/dev/branch_openmp/src/node/reduce_scalar_to_scalar.hpp

    r1460 r1642  
    5959      static CTransformation<CScalar>* create(const StdString& id, xml::CXMLNode* node); 
    6060      static bool _dummyRegistered; 
    61       #pragma omp threadprivate(_dummyRegistered) 
    6261  }; // class CReduceScalarToScalar 
    6362 
  • XIOS/dev/branch_openmp/src/node/reorder_domain.hpp

    r1460 r1642  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CReorderDomain 
    6463 
  • XIOS/dev/branch_openmp/src/node/scalar.cpp

    r1545 r1642  
    2727   { /* Ne rien faire de plus */ } 
    2828 
    29  
    30    std::map<StdString, ETranformationType> *CScalar::transformationMapList_ptr = 0; 
    31  
     29   std::map<StdString, ETranformationType> CScalar::transformationMapList_ = std::map<StdString, ETranformationType>(); 
     30   bool CScalar::dummyTransformationMapList_ = CScalar::initializeTransformationMap(CScalar::transformationMapList_); 
    3231   bool CScalar::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
    3332   { 
     
    3635     m["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; 
    3736     m["reduce_scalar"] = TRANS_REDUCE_SCALAR_TO_SCALAR; 
    38    } 
    39  
    40    bool CScalar::initializeTransformationMap() 
    41    { 
    42      CScalar::transformationMapList_ptr = new std::map<StdString, ETranformationType>(); 
    43      (*CScalar::transformationMapList_ptr)["reduce_axis"]   = TRANS_REDUCE_AXIS_TO_SCALAR; 
    44      (*CScalar::transformationMapList_ptr)["extract_axis"]  = TRANS_EXTRACT_AXIS_TO_SCALAR; 
    45      (*CScalar::transformationMapList_ptr)["reduce_domain"] = TRANS_REDUCE_DOMAIN_TO_SCALAR; 
    46      (*CScalar::transformationMapList_ptr)["reduce_scalar"] = TRANS_REDUCE_SCALAR_TO_SCALAR; 
    4737   } 
    4838 
     
    175165 
    176166        nodeElementName = node.getElementName(); 
    177         if(CScalar::transformationMapList_ptr == 0) initializeTransformationMap(); 
    178         std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_ptr->end(), it; 
    179         it = transformationMapList_ptr->find(nodeElementName); 
     167        std::map<StdString, ETranformationType>::const_iterator ite = transformationMapList_.end(), it; 
     168        it = transformationMapList_.find(nodeElementName); 
    180169        if (ite != it) 
    181170        { 
  • XIOS/dev/branch_openmp/src/node/scalar.hpp

    r1460 r1642  
    8383           TransMapTypes transformationMap_; 
    8484 
    85            void setTransformations(const TransMapTypes&); 
     85            void setTransformations(const TransMapTypes&); 
    8686 
    8787       private: 
    8888           static bool initializeTransformationMap(std::map<StdString, ETranformationType>& m); 
    89            static bool initializeTransformationMap(); 
    90            static std::map<StdString, ETranformationType> *transformationMapList_ptr; 
    91            #pragma omp threadprivate(transformationMapList_ptr) 
     89           static std::map<StdString, ETranformationType> transformationMapList_; 
    9290           static bool dummyTransformationMapList_; 
    93            #pragma omp threadprivate(dummyTransformationMapList_) 
    9491 
    9592 
  • XIOS/dev/branch_openmp/src/node/temporal_splitting.hpp

    r1460 r1642  
    5959      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6060      static bool _dummyRegistered; 
    61       #pragma omp threadprivate(_dummyRegistered) 
    6261  }; // class CTemporalSplitting 
    6362 
  • XIOS/dev/branch_openmp/src/node/transformation_enum.hpp

    r1460 r1642  
    2424        TRANS_DUPLICATE_SCALAR_TO_AXIS = 15, 
    2525        TRANS_REDUCE_SCALAR_TO_SCALAR = 16, 
    26         TRANS_REORDER_DOMAIN = 17 
     26        TRANS_REORDER_DOMAIN = 17, 
     27        TRANS_EXTRACT_DOMAIN = 18, 
     28        TRANS_EXTRACT_AXIS = 19 
    2729      } ETranformationType; 
    2830 
  • XIOS/dev/branch_openmp/src/node/zoom_axis.hpp

    r1331 r1642  
    6060      static CTransformation<CAxis>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CZoomAxis 
    6463 
  • XIOS/dev/branch_openmp/src/node/zoom_domain.hpp

    r1331 r1642  
    6060      static CTransformation<CDomain>* create(const StdString& id, xml::CXMLNode* node); 
    6161      static bool _dummyRegistered; 
    62       #pragma omp threadprivate(_dummyRegistered) 
    6362  }; // class CZoomDomain 
    6463 
Note: See TracChangeset for help on using the changeset viewer.