Ignore:
Timestamp:
01/31/19 12:12:52 (5 years ago)
Author:
yushan
Message:

branch merged with trunk @1645. arch file (ep&mpi) added for ADA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/src/transformation/generic_algorithm_transformation.cpp

    r1601 r1646  
    3434                                            std::vector<bool>& flagInitial, 
    3535                                            bool ignoreMissingValue, bool firstPass  ) 
     36TRY 
    3637{ 
    3738  int nbLocalIndex = localIndex.size();    
     
    6162  } 
    6263} 
     64CATCH 
    6365 
    6466void CGenericAlgorithmTransformation::computePositionElements(CGrid* dst, CGrid* src) 
     67TRY 
    6568{ 
    6669  int idxScalar = 0, idxAxis = 0, idxDomain = 0; 
     
    108111  } 
    109112} 
     113CATCH 
    110114 
    111115bool CGenericAlgorithmTransformation::isDistributedTransformation(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst) 
     116TRY 
    112117{ 
    113118 
     
    147152  } 
    148153  return isDistributed_ ; 
    149  
     154} 
     155CATCH 
     156 
    150157/*! 
    151158  This function computes the global indexes of grid source, which the grid destination is in demand. 
     
    160167                                                               CGrid* gridDst, 
    161168                                                               SourceDestinationIndexMap& globaIndexWeightFromSrcToDst) 
     169TRY 
    162170 { 
    163171  CContext* context = CContext::getCurrent(); 
     
    443451  }   
    444452 } 
     453CATCH 
    445454 
    446455/*! 
     
    461470                                                                   std::vector<std::unordered_map<int,std::vector<size_t> > >& globalElementIndexOnProc, 
    462471                                                                   SourceDestinationIndexMap& globaIndexWeightFromSrcToDst) 
     472TRY 
    463473{ 
    464474  SourceDestinationIndexMap globaIndexWeightFromSrcToDst_tmp ; 
     
    640650       } 
    641651     } 
    642  
    643 } 
     652} 
     653CATCH 
    644654 
    645655/*! 
     
    654664                                                                 CArray<size_t,1>& destGlobalIndexPositionInGrid, 
    655665                                                                 std::unordered_map<int,std::vector<size_t> >& globalScalarIndexOnProc) 
     666TRY 
    656667{ 
    657668  CContext* context = CContext::getCurrent(); 
     
    666677  } 
    667678} 
     679CATCH 
    668680 
    669681/*! 
     
    678690                                                               CArray<size_t,1>& destGlobalIndexPositionInGrid, 
    679691                                                               std::unordered_map<int,std::vector<size_t> >& globalAxisIndexOnProc) 
     692TRY 
    680693{ 
    681694  CContext* context = CContext::getCurrent(); 
     
    735748  } 
    736749} 
     750CATCH 
    737751 
    738752/*! 
     
    747761                                                                 CArray<size_t,1>& destGlobalIndexPositionInGrid, 
    748762                                                                 std::unordered_map<int,std::vector<size_t> >& globalDomainIndexOnProc) 
     763TRY 
    749764{ 
    750765  CContext* context = CContext::getCurrent(); 
     
    838853  } 
    839854} 
    840  
    841  
    842  
    843  
    844  
     855CATCH 
    845856 
    846857void CGenericAlgorithmTransformation::computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst, 
    847                                                                                  vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, vector<bool>& localMaskOnGridDest) 
     858                                                                                 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, 
     859                                                                                 int& nlocalIndexDest) 
     860TRY 
    848861{ 
    849862 
     
    871884     
    872885  int nlocalIndexSrc=1 ; 
    873   int nlocalIndexDest=1 ; 
     886//  int nlocalIndexDest=1 ; 
     887  nlocalIndexDest=1 ; 
    874888  CArray<bool,1> maskScalar(1) ; 
    875889  maskScalar  = true ; 
     
    933947    nlocalIndexDest=nlocalIndexDest*nIndexDst[i] ; 
    934948  } 
    935  
    936  
    937  
    938  
    939  
    940949 
    941950  vector<int> dstLocalInd ; 
     
    985994  } 
    986995 
    987 // just get the local src mask 
    988   CArray<bool,1> localMaskOnSrcGrid; 
    989   gridSrc->getLocalMask(localMaskOnSrcGrid) ; 
    990 // intermediate grid, mask is not initialized => set up mask to true 
    991   if (localMaskOnSrcGrid.isEmpty()) 
    992   { 
    993     localMaskOnSrcGrid.resize(nlocalIndexSrc) ; 
    994     localMaskOnSrcGrid=true ; 
    995   } 
    996    
    997  
    998   localMaskOnGridDest.resize(nlocalIndexDest,false) ; 
    999  
    1000996  vector<vector<vector<pair<int,double> > > > dstIndWeight(transformationMapping_.size()) ; 
    1001997    
     
    10241020   
    10251021  nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight,   
    1026                                currentInd,localSrc,localDst,weight, localMaskOnSrcGrid, localMaskOnGridDest ); 
     1022                               currentInd,localSrc,localDst,weight); 
    10271023                
    10281024} 
    1029  
    1030  
    1031 void CGenericAlgorithmTransformation::nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid, vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst, int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc, int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd, 
    1032                     vector<int>& localSrc, vector<int>& localDst, vector<double>& weight,  CArray<bool,1>& localMaskOnGridSrc, vector<bool>& localMaskOnGridDest ) 
     1025CATCH 
     1026 
     1027 
     1028void CGenericAlgorithmTransformation::nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid, 
     1029                                                                   vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst, 
     1030                                                                   int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc, 
     1031                                                                   int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd, 
     1032                                                                   vector<int>& localSrc, vector<int>& localDst, vector<double>& weight) 
     1033TRY 
    10331034{ 
    10341035  int masked_ ; 
     
    10431044        masked_=masked ; 
    10441045        if (!mask(i)) masked_=false ; 
    1045         nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, currentInd, localSrc, localDst, weight, localMaskOnGridSrc, localMaskOnGridDest) ; 
     1046        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, 
     1047                                     dstIndWeight, currentInd, localSrc, localDst, weight); 
    10461048      } 
    10471049    } 
     
    10571059            for(vector<pair<int,double> >::iterator it = dstIndWeight[t][currentInd].begin(); it!=dstIndWeight[t][currentInd].end(); ++it) 
    10581060            { 
    1059               if (localMaskOnGridSrc(srcInd)) 
    1060               { 
    1061                 localSrc.push_back(srcIndCompressed) ; 
    1062                 localDst.push_back(it->first) ; 
    1063                 weight.push_back(it->second) ; 
    1064                 localMaskOnGridDest[it->first]=true ; 
    1065               } 
     1061              localSrc.push_back(srcIndCompressed) ; 
     1062              localDst.push_back(it->first) ; 
     1063              weight.push_back(it->second) ; 
    10661064              (it->first)++ ; 
    10671065            } 
    10681066          } 
    10691067          if (t < dstIndWeight.size()-1) t++ ; 
    1070           if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ; 
     1068            srcIndCompressed ++ ; 
    10711069        } 
    10721070        srcInd++ ; 
     
    10861084        masked_=masked ; 
    10871085        if (!mask(i)) masked_=false ;  
    1088         nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight , i,  localSrc, localDst, weight, localMaskOnGridSrc, localMaskOnGridDest) ; 
     1086        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, 
     1087                                     srcIndCompressed, nIndexSrc, t, dstIndWeight , i,  localSrc, localDst, weight); 
    10891088      } 
    10901089    } 
     
    11001099            for(vector<pair<int,double> >::iterator it = dstIndWeight[t][i].begin(); it!=dstIndWeight[t][i].end(); ++it) 
    11011100            { 
    1102               if (localMaskOnGridSrc(srcInd)) 
    1103               { 
    1104                 localSrc.push_back(srcIndCompressed) ; 
    1105                 localDst.push_back(it->first) ; 
    1106                 weight.push_back(it->second) ; 
    1107                 localMaskOnGridDest[it->first]=true ; 
    1108               } 
     1101              localSrc.push_back(srcIndCompressed) ; 
     1102              localDst.push_back(it->first) ; 
     1103              weight.push_back(it->second) ; 
    11091104              (it->first)++ ; 
    11101105            } 
    11111106           } 
    11121107          if (t < dstIndWeight.size()-1) t++ ; 
    1113           if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ; 
     1108          srcIndCompressed ++ ; 
    11141109        } 
    11151110        srcInd++ ; 
     
    11191114 
    11201115} 
    1121  
    1122  
    1123  
    1124  
    1125  
    1126  
    1127  
    1128  
    1129  
    1130  
     1116CATCH 
    11311117 
    11321118/*! 
     
    11361122*/ 
    11371123void CGenericAlgorithmTransformation::computeIndexSourceMapping(const std::vector<CArray<double,1>* >& dataAuxInputs) 
     1124TRY 
    11381125{ 
    11391126  computeIndexSourceMapping_(dataAuxInputs); 
    11401127} 
     1128CATCH 
    11411129 
    11421130std::vector<StdString> CGenericAlgorithmTransformation::getIdAuxInputs() 
     1131TRY 
    11431132{ 
    11441133  return idAuxInputs_; 
    11451134} 
     1135CATCH 
    11461136 
    11471137CGenericAlgorithmTransformation::AlgoTransType CGenericAlgorithmTransformation::type() 
     1138TRY 
    11481139{ 
    11491140  return type_; 
    11501141} 
    1151  
    1152 } 
     1142CATCH 
     1143 
     1144} 
Note: See TracChangeset for help on using the changeset viewer.