Ignore:
Timestamp:
12/11/18 13:22:07 (6 years ago)
Author:
oabramkina
Message:

Exception handling on trunk.

To activate it, compilation flag -DXIOS_EXCEPTION should be added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/axis.cpp

    r1566 r1622  
    4848   bool CAxis::dummyTransformationMapList_ = CAxis::initializeTransformationMap(CAxis::transformationMapList_); 
    4949   bool CAxis::initializeTransformationMap(std::map<StdString, ETranformationType>& m) 
     50   TRY 
    5051   { 
    5152     m["zoom_axis"] = TRANS_ZOOM_AXIS; 
     
    6061 
    6162   } 
     63   CATCH 
    6264 
    6365   ///--------------------------------------------------------------- 
    6466 
    6567   const std::set<StdString> & CAxis::getRelFiles(void) const 
     68   TRY 
    6669   { 
    6770      return (this->relFiles); 
    6871   } 
     72   CATCH 
    6973 
    7074   bool CAxis::IsWritten(const StdString & filename) const 
     75   TRY 
    7176   { 
    7277      return (this->relFiles.find(filename) != this->relFiles.end()); 
    7378   } 
     79   CATCH 
    7480 
    7581   bool CAxis::isWrittenCompressed(const StdString& filename) const 
     82   TRY 
    7683   { 
    7784      return (this->relFilesCompressed.find(filename) != this->relFilesCompressed.end()); 
    7885   } 
     86   CATCH 
    7987 
    8088   bool CAxis::isDistributed(void) const 
     89   TRY 
    8190   { 
    8291      bool distributed = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 
    8392             (!this->n.isEmpty() && (this->n != this->n_glo)); 
    84       // 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 
    8594      // should be considered to be distributed. This should be a temporary solution      
    8695      distributed |= (1 == CContext::getCurrent()->client->clientSize); 
    8796      return distributed; 
    8897   } 
     98   CATCH 
    8999 
    90100   /*! 
     
    94104    */ 
    95105   bool CAxis::isCompressible(void) const 
     106   TRY 
    96107   { 
    97108      return isCompressible_; 
    98109   } 
     110   CATCH 
    99111 
    100112   void CAxis::addRelFile(const StdString & filename) 
     113   TRY 
    101114   { 
    102115      this->relFiles.insert(filename); 
    103116   } 
     117   CATCH_DUMP_ATTR 
    104118 
    105119   void CAxis::addRelFileCompressed(const StdString& filename) 
     120   TRY 
    106121   { 
    107122      this->relFilesCompressed.insert(filename); 
    108123   } 
     124   CATCH_DUMP_ATTR 
    109125 
    110126   //---------------------------------------------------------------- 
     
    115131   */ 
    116132   int CAxis::getNumberWrittenIndexes(MPI_Comm writtenCom) 
     133   TRY 
    117134   { 
    118135     int writtenSize; 
     
    120137     return numberWrittenIndexes_[writtenSize]; 
    121138   } 
     139   CATCH_DUMP_ATTR 
    122140 
    123141   /*! 
     
    126144   */ 
    127145   int CAxis::getTotalNumberWrittenIndexes(MPI_Comm writtenCom) 
     146   TRY 
    128147   { 
    129148     int writtenSize; 
     
    131150     return totalNumberWrittenIndexes_[writtenSize]; 
    132151   } 
     152   CATCH_DUMP_ATTR 
    133153 
    134154   /*! 
     
    137157   */ 
    138158   int CAxis::getOffsetWrittenIndexes(MPI_Comm writtenCom) 
     159   TRY 
    139160   { 
    140161     int writtenSize; 
     
    142163     return offsetWrittenIndexes_[writtenSize]; 
    143164   } 
     165   CATCH_DUMP_ATTR 
    144166 
    145167   CArray<int, 1>& CAxis::getCompressedIndexToWriteOnServer(MPI_Comm writtenCom) 
     168   TRY 
    146169   { 
    147170     int writtenSize; 
     
    149172     return compressedIndexToWriteOnServer[writtenSize]; 
    150173   } 
     174   CATCH_DUMP_ATTR 
     175 
    151176   //---------------------------------------------------------------- 
    152177 
     
    158183   std::map<int, StdSize> CAxis::getAttributesBufferSize(CContextClient* client, const std::vector<int>& globalDim, int orderPositionInGrid, 
    159184                                                         CServerDistributionDescription::ServerDistributionType distType) 
     185   TRY 
    160186   { 
    161187 
     
    221247       } 
    222248     } 
    223  
    224249     return attributesSizes; 
    225250   } 
     251   CATCH_DUMP_ATTR 
    226252 
    227253   //---------------------------------------------------------------- 
     
    234260 
    235261   CAxis* CAxis::createAxis() 
     262   TRY 
    236263   { 
    237264     CAxis* axis = CAxisGroup::get("axis_definition")->createChild(); 
    238265     return axis; 
    239266   } 
     267   CATCH 
    240268 
    241269   /*! 
     
    244272   */ 
    245273   void CAxis::checkAttributes(void) 
     274   TRY 
    246275   { 
    247276      if (this->n_glo.isEmpty()) 
     
    285314      } 
    286315 
    287       // Remove this check because it doen't make sense in case of a hole or overlapping axes 
     316      // Remove this check because it doesn't make sense in case of a hole or overlapping axes 
    288317      if (!this->value.isEmpty()) 
    289318      { 
     
    306335      } 
    307336   } 
     337   CATCH_DUMP_ATTR 
    308338 
    309339   /*! 
     
    311341   */ 
    312342   void CAxis::checkData() 
     343   TRY 
    313344   { 
    314345      if (data_begin.isEmpty()) data_begin.setValue(0); 
     
    331362      } 
    332363   } 
     364   CATCH_DUMP_ATTR 
    333365 
    334366    size_t CAxis::getGlobalWrittenSize(void) 
     
    341373   */ 
    342374   void CAxis::checkMask() 
     375   TRY 
    343376   { 
    344377      if (!mask.isEmpty()) 
     
    360393      } 
    361394   } 
     395   CATCH_DUMP_ATTR 
    362396 
    363397   /*! 
     
    365399   */ 
    366400   void CAxis::checkBounds() 
     401   TRY 
    367402   { 
    368403     if (!bounds.isEmpty()) 
     
    377412     else hasBounds = false; 
    378413   } 
     414   CATCH_DUMP_ATTR 
    379415 
    380416  void CAxis::checkLabel() 
     417  TRY 
    381418  { 
    382419    if (!label.isEmpty()) 
     
    391428    else hasLabel = false; 
    392429  } 
     430  CATCH_DUMP_ATTR 
    393431 
    394432  /*! 
     
    396434  */ 
    397435  void CAxis::checkEligibilityForCompressedOutput() 
     436  TRY 
    398437  { 
    399438    // We don't check if the mask is valid here, just if a mask has been defined at this point. 
    400439    isCompressible_ = !mask.isEmpty(); 
    401440  } 
     441  CATCH_DUMP_ATTR 
    402442 
    403443  /*! 
     
    405445  */ 
    406446  bool CAxis::dispatchEvent(CEventServer& event) 
     447  TRY 
    407448  { 
    408449     if (SuperClass::dispatchEvent(event)) return true; 
     
    430471     } 
    431472  } 
     473  CATCH 
    432474 
    433475   /*! 
     
    435477   */ 
    436478   void CAxis::checkAttributesOnClient() 
     479   TRY 
    437480   { 
    438481     if (this->areClientAttributesChecked_) return; 
     
    443486     this->areClientAttributesChecked_ = true; 
    444487   } 
     488   CATCH_DUMP_ATTR 
    445489 
    446490   /* 
     
    450494   void CAxis::checkAttributesOnClientAfterTransformation(const std::vector<int>& globalDim, int orderPositionInGrid, 
    451495                                                          CServerDistributionDescription::ServerDistributionType distType) 
     496   TRY 
    452497   { 
    453498     CContext* context=CContext::getCurrent() ; 
     
    463508     this->isClientAfterTransformationChecked = true; 
    464509   } 
     510   CATCH_DUMP_ATTR 
    465511 
    466512   /* 
     
    473519   void CAxis::sendCheckedAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
    474520                                     CServerDistributionDescription::ServerDistributionType distType) 
     521   TRY 
    475522   { 
    476523     if (!this->areClientAttributesChecked_) checkAttributesOnClient(); 
     
    483530     this->isChecked = true; 
    484531   } 
     532   CATCH_DUMP_ATTR 
    485533 
    486534  /*! 
     
    491539  void CAxis::sendAttributes(const std::vector<int>& globalDim, int orderPositionInGrid, 
    492540                             CServerDistributionDescription::ServerDistributionType distType) 
     541  TRY 
    493542  { 
    494543     sendDistributionAttribute(globalDim, orderPositionInGrid, distType); 
     
    505554     }      
    506555  } 
     556  CATCH_DUMP_ATTR 
    507557 
    508558  /* 
     
    516566  void CAxis::computeConnectedClients(const std::vector<int>& globalDim, int orderPositionInGrid, 
    517567                                     CServerDistributionDescription::ServerDistributionType distType) 
     568  TRY 
    518569  { 
    519570    CContext* context = CContext::getCurrent(); 
     
    635686    } 
    636687  } 
     688  CATCH_DUMP_ATTR 
    637689 
    638690  /* 
     
    642694  */ 
    643695  void CAxis::computeWrittenIndex() 
     696  TRY 
    644697  {   
    645698    if (computedWrittenIndex_) return; 
     
    688741    } 
    689742  } 
     743  CATCH_DUMP_ATTR 
    690744 
    691745  void CAxis::computeWrittenCompressedIndex(MPI_Comm writtenComm) 
     746  TRY 
    692747  { 
    693748    int writtenCommSize; 
     
    758813    } 
    759814  } 
     815  CATCH_DUMP_ATTR 
    760816 
    761817  /*! 
     
    768824  void CAxis::sendDistributionAttribute(const std::vector<int>& globalDim, int orderPositionInGrid, 
    769825                                        CServerDistributionDescription::ServerDistributionType distType) 
     826  TRY 
    770827  { 
    771828    std::list<CContextClient*>::iterator it; 
     
    806863    } 
    807864  } 
     865  CATCH_DUMP_ATTR 
    808866 
    809867  /* 
     
    812870  */ 
    813871  void CAxis::recvDistributionAttribute(CEventServer& event) 
     872  TRY 
    814873  { 
    815874    CBufferIn* buffer = event.subEvents.begin()->buffer; 
     
    818877    get(axisId)->recvDistributionAttribute(*buffer); 
    819878  } 
     879  CATCH 
    820880 
    821881  /* 
     
    824884  */ 
    825885  void CAxis::recvDistributionAttribute(CBufferIn& buffer) 
     886  TRY 
    826887  { 
    827888    int ni_srv, begin_srv; 
     
    833894    begin.setValue(begin_srv); 
    834895  } 
     896  CATCH_DUMP_ATTR 
    835897 
    836898  /* 
     
    840902  */ 
    841903  void CAxis::sendNonDistributedAttributes() 
     904  TRY 
    842905  { 
    843906    std::list<CContextClient*>::iterator it; 
     
    893956    } 
    894957  } 
     958  CATCH_DUMP_ATTR 
    895959 
    896960  /* 
     
    899963  */ 
    900964  void CAxis::recvNonDistributedAttributes(CEventServer& event) 
     965  TRY 
    901966  { 
    902967    list<CEventServer::SSubEvent>::iterator it; 
     
    909974    } 
    910975  } 
     976  CATCH 
    911977 
    912978  /* 
     
    916982  */ 
    917983  void CAxis::recvNonDistributedAttributes(int rank, CBufferIn& buffer) 
     984  TRY 
    918985  {  
    919986    CArray<int,1> tmp_index, tmp_data_index; 
     
    9571024    for (int idx = 0; idx < index.numElements(); ++idx) globalLocalIndexMap_[index(idx)] = idx; 
    9581025  } 
     1026  CATCH_DUMP_ATTR 
    9591027 
    9601028  /* 
     
    9641032  */ 
    9651033  void CAxis::sendDistributedAttributes(void) 
     1034  TRY 
    9661035  { 
    9671036    int ns, n, i, j, ind, nv, idx; 
     
    10691138    } 
    10701139  } 
     1140  CATCH_DUMP_ATTR 
    10711141 
    10721142  /* 
     
    10751145  */ 
    10761146  void CAxis::recvDistributedAttributes(CEventServer& event) 
     1147  TRY 
    10771148  { 
    10781149    string axisId; 
     
    10901161    get(axisId)->recvDistributedAttributes(ranks, buffers); 
    10911162  } 
     1163  CATCH 
    10921164 
    10931165  /* 
     
    10971169  */ 
    10981170  void CAxis::recvDistributedAttributes(vector<int>& ranks, vector<CBufferIn*> buffers) 
     1171  TRY 
    10991172  { 
    11001173    int nbReceived = ranks.size(), idx, ind, gloInd, locInd; 
     
    12191292    data_begin.setValue(0); 
    12201293  } 
    1221  
     1294  CATCH_DUMP_ATTR 
    12221295 
    12231296  /*! 
     
    12291302  */ 
    12301303  bool CAxis::isEqual(CAxis* obj) 
     1304  TRY 
    12311305  { 
    12321306    vector<StdString> excludedAttr; 
     
    12521326    return objEqual; 
    12531327  } 
     1328  CATCH_DUMP_ATTR 
    12541329 
    12551330  /* 
     
    12591334  */ 
    12601335  CTransformation<CAxis>* CAxis::addTransformation(ETranformationType transType, const StdString& id) 
     1336  TRY 
    12611337  { 
    12621338    transformationMap_.push_back(std::make_pair(transType, CTransformation<CAxis>::createTransformation(transType,id))); 
    12631339    return transformationMap_.back().second; 
    12641340  } 
     1341  CATCH_DUMP_ATTR 
    12651342 
    12661343  /* 
     
    12681345  */ 
    12691346  bool CAxis::hasTransformation() 
     1347  TRY 
    12701348  { 
    12711349    return (!transformationMap_.empty()); 
    12721350  } 
     1351  CATCH_DUMP_ATTR 
    12731352 
    12741353  /* 
     
    12771356  */ 
    12781357  void CAxis::setTransformations(const TransMapTypes& axisTrans) 
     1358  TRY 
    12791359  { 
    12801360    transformationMap_ = axisTrans; 
    12811361  } 
     1362  CATCH_DUMP_ATTR 
    12821363 
    12831364  /* 
     
    12861367  */ 
    12871368  CAxis::TransMapTypes CAxis::getAllTransformations(void) 
     1369  TRY 
    12881370  { 
    12891371    return transformationMap_; 
    12901372  } 
     1373  CATCH_DUMP_ATTR 
    12911374 
    12921375  /* 
     
    12951378  */ 
    12961379  void CAxis::duplicateTransformation(CAxis* src) 
     1380  TRY 
    12971381  { 
    12981382    if (src->hasTransformation()) 
     
    13011385    } 
    13021386  } 
     1387  CATCH_DUMP_ATTR 
    13031388 
    13041389  /*! 
     
    13061391   */ 
    13071392  void CAxis::solveInheritanceTransformation() 
     1393  TRY 
    13081394  { 
    13091395    if (hasTransformation() || !hasDirectAxisReference()) 
     
    13221408        refAxis[i]->setTransformations(axis->getAllTransformations()); 
    13231409  } 
     1410  CATCH_DUMP_ATTR 
    13241411 
    13251412  void CAxis::setContextClient(CContextClient* contextClient) 
     1413  TRY 
    13261414  { 
    13271415    if (clientsSet.find(contextClient)==clientsSet.end()) 
     
    13301418      clientsSet.insert(contextClient); 
    13311419    } 
    1332 } 
     1420  } 
     1421  CATCH_DUMP_ATTR 
    13331422 
    13341423  void CAxis::parse(xml::CXMLNode & node) 
     1424  TRY 
    13351425  { 
    13361426    SuperClass::parse(node); 
     
    13631453    } 
    13641454  } 
     1455  CATCH_DUMP_ATTR 
    13651456 
    13661457  DEFINE_REF_FUNC(Axis,axis) 
Note: See TracChangeset for help on using the changeset viewer.