Ignore:
Timestamp:
10/12/18 16:02:37 (6 years ago)
Author:
oabramkina
Message:

Clean-up in transformation classes related to the new treatment of grid mask at the entrance of a workflow.

Location:
XIOS/dev/dev_olga/src/transformation
Files:
4 edited

Legend:

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

    r1542 r1584  
    843843 
    844844 
    845  
    846845void CGenericAlgorithmTransformation::computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst, 
    847                                                                                  vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, vector<bool>& localMaskOnGridDest) 
     846                                                                                 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, 
     847                                                                                 int nlocalIndexDest) 
     848 
     849//void CGenericAlgorithmTransformation::computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst, 
     850//                                                                                 vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, 
     851//                                                                                 vector<bool>& localMaskOnGridDest) 
    848852{ 
    849853 
     
    871875     
    872876  int nlocalIndexSrc=1 ; 
    873   int nlocalIndexDest=1 ; 
     877//  int nlocalIndexDest=1 ; 
     878  nlocalIndexDest=1 ; 
    874879  CArray<bool,1> maskScalar(1) ; 
    875880  maskScalar  = true ; 
     
    933938    nlocalIndexDest=nlocalIndexDest*nIndexDst[i] ; 
    934939  } 
    935  
    936  
    937  
    938  
    939  
    940940 
    941941  vector<int> dstLocalInd ; 
     
    986986 
    987987// just get the local src mask 
    988   CArray<bool,1> localMaskOnSrcGrid; 
    989   gridSrc->getLocalMask(localMaskOnSrcGrid) ; 
     988//  CArray<bool,1> localMaskOnSrcGrid; 
     989//  gridSrc->getLocalMask(localMaskOnSrcGrid) ; 
    990990// 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) ; 
     991//  if (localMaskOnSrcGrid.isEmpty()) 
     992//  { 
     993//    localMaskOnSrcGrid.resize(nlocalIndexSrc) ; 
     994//    localMaskOnSrcGrid=true ; 
     995//  } 
     996   
     997 
     998//  localMaskOnGridDest.resize(nlocalIndexDest,false) ; 
    999999 
    10001000  vector<vector<vector<pair<int,double> > > > dstIndWeight(transformationMapping_.size()) ; 
     
    10231023  int srcIndCompressed=0 ; 
    10241024   
     1025//  nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, 
     1026//                               currentInd,localSrc,localDst,weight, localMaskOnSrcGrid, localMaskOnGridDest ); 
     1027//  nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, 
     1028//                               currentInd,localSrc,localDst,weight, localMaskOnGridDest ); 
    10251029  nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight,   
    1026                                currentInd,localSrc,localDst,weight, localMaskOnSrcGrid, localMaskOnGridDest ); 
     1030                               currentInd,localSrc,localDst,weight); 
    10271031                
    10281032} 
    10291033 
    10301034 
    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 ) 
     1035void CGenericAlgorithmTransformation::nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid, 
     1036                                                                   vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst, 
     1037                                                                   int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc, 
     1038                                                                   int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd, 
     1039                                                                   vector<int>& localSrc, vector<int>& localDst, vector<double>& weight) 
     1040//                                                                   CArray<bool,1>& localMaskOnGridSrc 
     1041//                                                                   , vector<bool>& localMaskOnGridDest ) 
    10331042{ 
    10341043  int masked_ ; 
     
    10431052        masked_=masked ; 
    10441053        if (!mask(i)) masked_=false ; 
    1045         nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, currentInd, localSrc, localDst, weight, localMaskOnGridSrc, localMaskOnGridDest) ; 
     1054//        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, currentInd, localSrc, localDst, weight, localMaskOnGridSrc, localMaskOnGridDest) ; 
     1055        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, 
     1056                                     dstIndWeight, currentInd, localSrc, localDst, weight);//, localMaskOnGridDest) ; 
    10461057      } 
    10471058    } 
     
    10571068            for(vector<pair<int,double> >::iterator it = dstIndWeight[t][currentInd].begin(); it!=dstIndWeight[t][currentInd].end(); ++it) 
    10581069            { 
    1059               if (localMaskOnGridSrc(srcInd)) 
     1070//              if (localMaskOnGridSrc(srcInd)) 
    10601071              { 
    10611072                localSrc.push_back(srcIndCompressed) ; 
    10621073                localDst.push_back(it->first) ; 
    10631074                weight.push_back(it->second) ; 
    1064                 localMaskOnGridDest[it->first]=true ; 
     1075//                localMaskOnGridDest[it->first]=true ; 
    10651076              } 
    10661077              (it->first)++ ; 
     
    10681079          } 
    10691080          if (t < dstIndWeight.size()-1) t++ ; 
    1070           if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ; 
     1081//          if (localMaskOnGridSrc(srcInd)) 
     1082            srcIndCompressed ++ ; 
    10711083        } 
    10721084        srcInd++ ; 
     
    10861098        masked_=masked ; 
    10871099        if (!mask(i)) masked_=false ;  
    1088         nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight , i,  localSrc, localDst, weight, localMaskOnGridSrc, localMaskOnGridDest) ; 
     1100        nonDistributedrecursiveFunct(currentPos-1, masked_, elementPositionInGrid, maskSrc, maskDst, srcInd, 
     1101                                     srcIndCompressed, nIndexSrc, t, dstIndWeight , i,  localSrc, localDst, weight); 
     1102//                                     localMaskOnGridSrc, 
     1103//                                     localMaskOnGridDest) ; 
    10891104      } 
    10901105    } 
     
    11001115            for(vector<pair<int,double> >::iterator it = dstIndWeight[t][i].begin(); it!=dstIndWeight[t][i].end(); ++it) 
    11011116            { 
    1102               if (localMaskOnGridSrc(srcInd)) 
     1117//              if (localMaskOnGridSrc(srcInd)) 
    11031118              { 
    11041119                localSrc.push_back(srcIndCompressed) ; 
    11051120                localDst.push_back(it->first) ; 
    11061121                weight.push_back(it->second) ; 
    1107                 localMaskOnGridDest[it->first]=true ; 
     1122//                localMaskOnGridDest[it->first]=true ; 
    11081123              } 
    11091124              (it->first)++ ; 
     
    11111126           } 
    11121127          if (t < dstIndWeight.size()-1) t++ ; 
    1113           if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ; 
     1128//          if (localMaskOnGridSrc(srcInd)) 
     1129            srcIndCompressed ++ ; 
    11141130        } 
    11151131        srcInd++ ; 
  • XIOS/dev/dev_olga/src/transformation/generic_algorithm_transformation.hpp

    r1542 r1584  
    8787  */ 
    8888  void computeIndexSourceMapping(const std::vector<CArray<double,1>* >& dataAuxInputs = std::vector<CArray<double,1>* >()); 
     89//  void computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst, 
     90//                                                  vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, vector<bool>& localMaskOnGridDest); 
    8991  void computeTransformationMappingNonDistributed(int elementPositionInGrid, CGrid* gridSrc, CGrid* gridDst, 
    90                                                   vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, vector<bool>& localMaskOnGridDest); 
    91   void 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, 
    92                                      vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, CArray<bool,1>& localMaskOnGridSrc, vector<bool>& localMaskOnGridDest) ; 
     92                                                  vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, int nbLocalIndexOnGridDest); 
     93//  void 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, 
     94//                                     vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, CArray<bool,1>& localMaskOnGridSrc, vector<bool>& localMaskOnGridDest) ; 
     95//  void nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid,  vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst, 
     96//                                    int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc, 
     97//                                    int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd, 
     98//                                    vector<int>& localSrc, vector<int>& localDst, vector<double>& weight, vector<bool>& localMaskOnGridDest) ; 
     99  void nonDistributedrecursiveFunct(int currentPos, bool masked, int elementPositionInGrid,  vector< CArray<bool,1>* >& maskSrc, vector< CArray<bool,1>* >& maskDst, 
     100                                    int& srcInd, int& srcIndCompressed, vector<int>& nIndexSrc, 
     101                                    int& t, vector<vector<vector<pair<int,double> > > >& dstIndWeight, int currentInd, 
     102                                    vector<int>& localSrc, vector<int>& localDst, vector<double>& weight) ; 
    93103 
    94104protected: 
  • XIOS/dev/dev_olga/src/transformation/grid_transformation.cpp

    r1542 r1584  
    346346      std::list<RecvIndexGridDestinationMap>().swap(localIndexToReceiveOnGridDest_); 
    347347      std::list<size_t>().swap(nbLocalIndexOnGridDest_); 
    348       std::list<std::vector<bool> >().swap(localMaskOnGridDest_); 
     348//      std::list<std::vector<bool> >().swap(localMaskOnGridDest_); 
    349349    } 
    350350    else 
     
    399399        vector<int> localDst ; 
    400400        vector<double> weight ; 
    401         localMaskOnGridDest_.push_back(vector<bool>()) ; 
     401        int nbLocalIndexOnGridDest; 
     402//        localMaskOnGridDest_.push_back(vector<bool>()) ; 
    402403        CTimer::get("computeTransformationMappingNonDistributed").resume();   
     404//        algo->computeTransformationMappingNonDistributed(elementPosition, gridSource_, tmpGridDestination_, 
     405//                                                         localSrc, localDst, weight, localMaskOnGridDest_.back()) ; 
    403406        algo->computeTransformationMappingNonDistributed(elementPosition, gridSource_, tmpGridDestination_,  
    404                                                          localSrc, localDst, weight, localMaskOnGridDest_.back()) ; 
     407                                                         localSrc, localDst, weight, nbLocalIndexOnGridDest) ; 
    405408        CTimer::get("computeTransformationMappingNonDistributed").suspend();   
    406409 
    407410        CTimer::get("computeTransformationMappingConvert").resume();   
    408         nbLocalIndexOnGridDest_.push_back(localMaskOnGridDest_.back().size()) ; 
     411//        nbLocalIndexOnGridDest_.push_back(localMaskOnGridDest_.back().size()) ; 
     412//        nbLocalIndexOnGridDest_.push_back(localMaskOnGridDest_.back().size()) ; 
     413        nbLocalIndexOnGridDest_.push_back(nbLocalIndexOnGridDest) ; 
    409414        int clientRank=client->clientRank ; 
    410415        { 
     
    472477  size_t nbLocalIndex = globalLocalIndexGridDestSendToServer.size(); 
    473478  nbLocalIndexOnGridDest_.push_back(nbLocalIndex); 
    474   localMaskOnGridDest_.push_back(std::vector<bool>()); 
    475   std::vector<bool>& tmpMask = localMaskOnGridDest_.back(); 
    476   tmpMask.resize(nbLocalIndex,false); 
     479//  localMaskOnGridDest_.push_back(std::vector<bool>()); 
     480//  std::vector<bool>& tmpMask = localMaskOnGridDest_.back(); 
     481//  tmpMask.resize(nbLocalIndex,false); 
    477482 
    478483  // Find out number of index sent from grid source and number of index received on grid destination 
     
    657662        recvTmp[recvRank][realRecvSize].first = globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]; 
    658663        recvTmp[recvRank][realRecvSize].second = recvWeightDst(idx); 
    659         tmpMask[globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]] = true; 
     664//        tmpMask[globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]] = true; 
    660665         ++realRecvSize; 
    661666      } 
     
    714719  \return local mask of data 
    715720*/ 
    716 const std::list<std::vector<bool> >& CGridTransformation::getLocalMaskIndexOnGridDest() const 
    717 { 
    718   return localMaskOnGridDest_; 
    719 } 
    720  
    721 } 
     721//const std::list<std::vector<bool> >& CGridTransformation::getLocalMaskIndexOnGridDest() const 
     722//{ 
     723//  return localMaskOnGridDest_; 
     724//} 
     725 
     726} 
  • XIOS/dev/dev_olga/src/transformation/grid_transformation.hpp

    r978 r1584  
    4949  const std::list<RecvIndexGridDestinationMap>& getLocalIndexToReceiveOnGridDest() const; 
    5050  const std::list<size_t>& getNbLocalIndexToReceiveOnGridDest() const; 
    51   const std::list<std::vector<bool> >& getLocalMaskIndexOnGridDest() const; 
     51//  const std::list<std::vector<bool> >& getLocalMaskIndexOnGridDest() const; 
    5252 
    5353  CGrid* getGridSource() { return originalGridSource_; } 
     
    8484  //! Number of local index of data to receive on grid destination 
    8585  std::list<size_t> nbLocalIndexOnGridDest_; 
    86   std::list<std::vector<bool> > localMaskOnGridDest_; 
     86//  std::list<std::vector<bool> > localMaskOnGridDest_; 
    8787 
    8888  bool dynamicalTransformation_; 
Note: See TracChangeset for help on using the changeset viewer.