Ignore:
Timestamp:
11/23/18 14:48:14 (6 years ago)
Author:
oabramkina
Message:

Dev: adding exception handling.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_olga/src/transformation/domain_algorithm_interpolate.cpp

    r1542 r1612  
    3131                                                                     std::map<int, int>& elementPositionInGridDst2AxisPosition, 
    3232                                                                     std::map<int, int>& elementPositionInGridDst2DomainPosition) 
     33TRY 
    3334{ 
    3435  std::vector<CDomain*> domainListDestP = gridDst->getDomains(); 
     
    4142  return (new CDomainAlgorithmInterpolate(domainListDestP[domainDstIndex], domainListSrcP[domainSrcIndex], interpolateDomain)); 
    4243} 
     44CATCH 
    4345 
    4446bool CDomainAlgorithmInterpolate::registerTrans() 
     47TRY 
    4548{ 
    4649  CGridTransformationFactory<CDomain>::registerTransformation(TRANS_INTERPOLATE_DOMAIN, create); 
    4750} 
     51CATCH 
    4852 
    4953CDomainAlgorithmInterpolate::CDomainAlgorithmInterpolate(CDomain* domainDestination, CDomain* domainSource, CInterpolateDomain* interpDomain) 
    5054: CDomainAlgorithmTransformation(domainDestination, domainSource), interpDomain_(interpDomain), writeToFile_(false), readFromFile_(false) 
     55TRY 
    5156{ 
    5257  CContext* context = CContext::getCurrent(); 
     
    9398     
    9499} 
     100CATCH 
    95101 
    96102/*! 
     
    98104*/ 
    99105void CDomainAlgorithmInterpolate::computeRemap() 
     106TRY 
    100107{ 
    101108  using namespace sphereRemap; 
     
    399406 
    400407} 
     408CATCH 
    401409 
    402410void CDomainAlgorithmInterpolate::processPole(std::map<int,std::vector<std::pair<int,double> > >& interMapValuePole, 
    403411                                              int nbGlobalPointOnPole) 
     412TRY 
    404413{ 
    405414  CContext* context = CContext::getCurrent(); 
     
    468477 
    469478} 
     479CATCH 
    470480 
    471481/*! 
     
    473483*/ 
    474484void CDomainAlgorithmInterpolate::computeIndexSourceMapping_(const std::vector<CArray<double,1>* >& dataAuxInputs) 
     485TRY 
    475486{ 
    476487  if (readFromFile_)   
     
    481492  } 
    482493} 
     494CATCH 
    483495 
    484496void CDomainAlgorithmInterpolate::writeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     497TRY 
    485498 
    486499  writeInterpolationInfo(fileToReadWrite_, interpMapValue); 
    487500} 
     501CATCH 
    488502 
    489503void CDomainAlgorithmInterpolate::readRemapInfo() 
     504TRY 
    490505 
    491506  std::map<int,std::vector<std::pair<int,double> > > interpMapValue; 
     
    494509  exchangeRemapInfo(interpMapValue); 
    495510} 
     511CATCH 
    496512 
    497513void CDomainAlgorithmInterpolate::convertRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     514TRY 
    498515{ 
    499516  CContext* context = CContext::getCurrent(); 
     
    520537  }       
    521538} 
     539CATCH 
    522540 
    523541/*! 
     
    525543*/ 
    526544void CDomainAlgorithmInterpolate::exchangeRemapInfo(std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     545TRY 
    527546{ 
    528547  CContext* context = CContext::getCurrent(); 
     
    704723  delete [] recvBuff; 
    705724} 
     725CATCH 
    706726  
    707727/*! Redefined some functions of CONetCDF4 to make use of them */ 
     
    710730int CDomainAlgorithmInterpolate::WriteNetCdf::addDimensionWrite(const StdString& name,  
    711731                                                                const StdSize size) 
     732TRY 
    712733{ 
    713734  return CONetCDF4::addDimension(name, size);   
    714735} 
     736CATCH 
    715737 
    716738int CDomainAlgorithmInterpolate::WriteNetCdf::addVariableWrite(const StdString& name, nc_type type, 
    717739                                                               const std::vector<StdString>& dim) 
     740TRY 
    718741{ 
    719742  return CONetCDF4::addVariable(name, type, dim); 
    720743} 
     744CATCH 
    721745 
    722746void CDomainAlgorithmInterpolate::WriteNetCdf::endDefinition() 
     747TRY 
    723748{ 
    724749  CONetCDF4::definition_end(); 
    725750} 
     751CATCH 
    726752 
    727753void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray<int,1>& data, const StdString& name, 
     
    729755                                                              const std::vector<StdSize>* start, 
    730756                                                              const std::vector<StdSize>* count) 
     757TRY 
    731758{ 
    732759  CONetCDF4::writeData<int,1>(data, name, collective, record, start, count); 
    733760} 
     761CATCH 
    734762 
    735763void CDomainAlgorithmInterpolate::WriteNetCdf::writeDataIndex(const CArray<double,1>& data, const StdString& name, 
     
    737765                                                              const std::vector<StdSize>* start, 
    738766                                                              const std::vector<StdSize>* count) 
     767TRY 
    739768{ 
    740769  CONetCDF4::writeData<double,1>(data, name, collective, record, start, count); 
    741770} 
     771CATCH 
    742772 
    743773/* 
     
    748778void CDomainAlgorithmInterpolate::writeInterpolationInfo(std::string& filename, 
    749779                                                         std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     780TRY 
    750781{ 
    751782  CContext* context = CContext::getCurrent(); 
     
    827858  netCdfWriter.closeFile(); 
    828859} 
     860CATCH 
    829861 
    830862/*! 
     
    836868void CDomainAlgorithmInterpolate::readInterpolationInfo(std::string& filename, 
    837869                                                        std::map<int,std::vector<std::pair<int,double> > >& interpMapValue) 
     870TRY 
    838871{ 
    839872  int ncid ; 
     
    894927      interpMapValue[dstIndex[ind]-indexOffset].push_back(make_pair(srcIndex[ind]-indexOffset,weight[ind])); 
    895928 } 
     929CATCH 
    896930 
    897931void CDomainAlgorithmInterpolate::apply(const std::vector<std::pair<int,double> >& localIndex, 
     
    900934                                            std::vector<bool>& flagInitial, 
    901935                                            bool ignoreMissingValue, bool firstPass  ) 
     936TRY 
    902937{ 
    903938  int nbLocalIndex = localIndex.size();    
     
    941976  } 
    942977} 
     978CATCH 
    943979 
    944980void CDomainAlgorithmInterpolate::updateData(CArray<double,1>& dataOut) 
     981TRY 
    945982{ 
    946983  if (detectMissingValue) 
     
    961998  } 
    962999} 
    963  
    964 } 
     1000CATCH 
     1001 
     1002} 
Note: See TracChangeset for help on using the changeset viewer.