Changeset 1584
- Timestamp:
- 10/12/18 16:02:37 (5 years ago)
- Location:
- XIOS/dev/dev_olga/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/filter/spatial_transform_filter.cpp
r1542 r1584 201 201 const std::list<CGridTransformation::RecvIndexGridDestinationMap>& listLocalIndexToReceive = gridTransformation->getLocalIndexToReceiveOnGridDest(); 202 202 const std::list<size_t>& listNbLocalIndexToReceive = gridTransformation->getNbLocalIndexToReceiveOnGridDest(); 203 const std::list<std::vector<bool> >& listLocalIndexMaskOnDest = gridTransformation->getLocalMaskIndexOnGridDest();203 // const std::list<std::vector<bool> >& listLocalIndexMaskOnDest = gridTransformation->getLocalMaskIndexOnGridDest(); 204 204 const std::vector<CGenericAlgorithmTransformation*>& listAlgos = gridTransformation->getAlgos(); 205 205 … … 210 210 std::list<CGridTransformation::RecvIndexGridDestinationMap>::const_iterator itListRecv = listLocalIndexToReceive.begin(); 211 211 std::list<size_t>::const_iterator itNbListRecv = listNbLocalIndexToReceive.begin(); 212 std::list<std::vector<bool> >::const_iterator itLocalMaskIndexOnDest = listLocalIndexMaskOnDest.begin();212 // std::list<std::vector<bool> >::const_iterator itLocalMaskIndexOnDest = listLocalIndexMaskOnDest.begin(); 213 213 std::vector<CGenericAlgorithmTransformation*>::const_iterator itAlgo = listAlgos.begin(); 214 214 215 for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itLocalMaskIndexOnDest, ++itAlgo) 215 // for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itLocalMaskIndexOnDest, ++itAlgo) 216 for (; itListSend != iteListSend; ++itListSend, ++itListRecv, ++itNbListRecv, ++itAlgo) 216 217 { 217 218 CArray<double,1> dataCurrentSrc(dataCurrentDest); … … 266 267 267 268 dataCurrentDest.resize(*itNbListRecv); 268 const std::vector<bool>& localMaskDest = *itLocalMaskIndexOnDest; 269 for (int i = 0; i < localMaskDest.size(); ++i) 270 if (localMaskDest[i]) dataCurrentDest(i) = 0.0; 271 else dataCurrentDest(i) = defaultValue; 269 dataCurrentDest = 0.0; 270 // const std::vector<bool>& localMaskDest = *itLocalMaskIndexOnDest; 271 // for (int i = 0; i < localMaskDest.size(); ++i) 272 // if (localMaskDest[i]) dataCurrentDest(i) = 0.0; 273 // else dataCurrentDest(i) = defaultValue; 272 274 273 275 std::vector<bool> localInitFlag(dataCurrentDest.numElements(), true); -
XIOS/dev/dev_olga/src/node/grid.cpp
r1576 r1584 432 432 */ 433 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 }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 470 471 471 /* -
XIOS/dev/dev_olga/src/node/grid.hpp
r1568 r1584 205 205 bool hasTransform(); 206 206 size_t getGlobalWrittenSize(void) ; 207 void getLocalMask(CArray<bool,1>& localMask) ;208 template<int N>209 void getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask) ;207 // void getLocalMask(CArray<bool,1>& localMask) ; 208 // template<int N> 209 // void getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask) ; 210 210 public: 211 211 CArray<int, 1> storeIndex_client; … … 573 573 \param [in] multi-dimension array grid mask 574 574 */ 575 template<int N>576 void CGrid::getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask)577 {578 if (gridMask.isEmpty()) return ;579 int dim = gridMask.dimensions();580 std::vector<int> dimensionSizes(dim);581 for (int i = 0; i < dim; ++i) dimensionSizes[i] = gridMask.extent(i);582 583 std::vector<int> idxLoop(dim,0);584 int ssize = gridMask.numElements(), idx = 0;585 localMask.resize(ssize);586 while (idx < ssize)587 {588 for (int i = 0; i < dim-1; ++i)589 {590 if (idxLoop[i] == dimensionSizes[i])591 {592 idxLoop[i] = 0;593 ++idxLoop[i+1];594 }595 }596 597 int maskIndex = idxLoop[0];598 int mulDim = 1;599 for (int k = 1; k < dim; ++k)600 {601 mulDim *= dimensionSizes[k-1];602 maskIndex += idxLoop[k]*mulDim;603 }604 localMask(maskIndex) = *(gridMask.dataFirst()+maskIndex);605 606 ++idxLoop[0];607 ++idx;608 }609 }575 //template<int N> 576 //void CGrid::getLocalMask(const CArray<bool,N>& gridMask, CArray<bool,1>& localMask) 577 //{ 578 // if (gridMask.isEmpty()) return ; 579 // int dim = gridMask.dimensions(); 580 // std::vector<int> dimensionSizes(dim); 581 // for (int i = 0; i < dim; ++i) dimensionSizes[i] = gridMask.extent(i); 582 // 583 // std::vector<int> idxLoop(dim,0); 584 // int ssize = gridMask.numElements(), idx = 0; 585 // localMask.resize(ssize); 586 // while (idx < ssize) 587 // { 588 // for (int i = 0; i < dim-1; ++i) 589 // { 590 // if (idxLoop[i] == dimensionSizes[i]) 591 // { 592 // idxLoop[i] = 0; 593 // ++idxLoop[i+1]; 594 // } 595 // } 596 // 597 // int maskIndex = idxLoop[0]; 598 // int mulDim = 1; 599 // for (int k = 1; k < dim; ++k) 600 // { 601 // mulDim *= dimensionSizes[k-1]; 602 // maskIndex += idxLoop[k]*mulDim; 603 // } 604 // localMask(maskIndex) = *(gridMask.dataFirst()+maskIndex); 605 // 606 // ++idxLoop[0]; 607 // ++idx; 608 // } 609 //} 610 610 611 611 // Declare/Define CGridGroup and CGridDefinition -
XIOS/dev/dev_olga/src/transformation/generic_algorithm_transformation.cpp
r1542 r1584 843 843 844 844 845 846 845 void 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) 848 852 { 849 853 … … 871 875 872 876 int nlocalIndexSrc=1 ; 873 int nlocalIndexDest=1 ; 877 // int nlocalIndexDest=1 ; 878 nlocalIndexDest=1 ; 874 879 CArray<bool,1> maskScalar(1) ; 875 880 maskScalar = true ; … … 933 938 nlocalIndexDest=nlocalIndexDest*nIndexDst[i] ; 934 939 } 935 936 937 938 939 940 940 941 941 vector<int> dstLocalInd ; … … 986 986 987 987 // just get the local src mask 988 CArray<bool,1> localMaskOnSrcGrid;989 gridSrc->getLocalMask(localMaskOnSrcGrid) ;988 // CArray<bool,1> localMaskOnSrcGrid; 989 // gridSrc->getLocalMask(localMaskOnSrcGrid) ; 990 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) ;991 // if (localMaskOnSrcGrid.isEmpty()) 992 // { 993 // localMaskOnSrcGrid.resize(nlocalIndexSrc) ; 994 // localMaskOnSrcGrid=true ; 995 // } 996 997 998 // localMaskOnGridDest.resize(nlocalIndexDest,false) ; 999 999 1000 1000 vector<vector<vector<pair<int,double> > > > dstIndWeight(transformationMapping_.size()) ; … … 1023 1023 int srcIndCompressed=0 ; 1024 1024 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 ); 1025 1029 nonDistributedrecursiveFunct(nElement-1,true,elementPositionInGrid,maskSrc,maskDst, srcInd, srcIndCompressed, nIndexSrc, t, dstIndWeight, 1026 currentInd,localSrc,localDst,weight , localMaskOnSrcGrid, localMaskOnGridDest);1030 currentInd,localSrc,localDst,weight); 1027 1031 1028 1032 } 1029 1033 1030 1034 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 ) 1035 void 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 ) 1033 1042 { 1034 1043 int masked_ ; … … 1043 1052 masked_=masked ; 1044 1053 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) ; 1046 1057 } 1047 1058 } … … 1057 1068 for(vector<pair<int,double> >::iterator it = dstIndWeight[t][currentInd].begin(); it!=dstIndWeight[t][currentInd].end(); ++it) 1058 1069 { 1059 if (localMaskOnGridSrc(srcInd))1070 // if (localMaskOnGridSrc(srcInd)) 1060 1071 { 1061 1072 localSrc.push_back(srcIndCompressed) ; 1062 1073 localDst.push_back(it->first) ; 1063 1074 weight.push_back(it->second) ; 1064 localMaskOnGridDest[it->first]=true ;1075 // localMaskOnGridDest[it->first]=true ; 1065 1076 } 1066 1077 (it->first)++ ; … … 1068 1079 } 1069 1080 if (t < dstIndWeight.size()-1) t++ ; 1070 if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ; 1081 // if (localMaskOnGridSrc(srcInd)) 1082 srcIndCompressed ++ ; 1071 1083 } 1072 1084 srcInd++ ; … … 1086 1098 masked_=masked ; 1087 1099 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) ; 1089 1104 } 1090 1105 } … … 1100 1115 for(vector<pair<int,double> >::iterator it = dstIndWeight[t][i].begin(); it!=dstIndWeight[t][i].end(); ++it) 1101 1116 { 1102 if (localMaskOnGridSrc(srcInd))1117 // if (localMaskOnGridSrc(srcInd)) 1103 1118 { 1104 1119 localSrc.push_back(srcIndCompressed) ; 1105 1120 localDst.push_back(it->first) ; 1106 1121 weight.push_back(it->second) ; 1107 localMaskOnGridDest[it->first]=true ;1122 // localMaskOnGridDest[it->first]=true ; 1108 1123 } 1109 1124 (it->first)++ ; … … 1111 1126 } 1112 1127 if (t < dstIndWeight.size()-1) t++ ; 1113 if (localMaskOnGridSrc(srcInd)) srcIndCompressed ++ ; 1128 // if (localMaskOnGridSrc(srcInd)) 1129 srcIndCompressed ++ ; 1114 1130 } 1115 1131 srcInd++ ; -
XIOS/dev/dev_olga/src/transformation/generic_algorithm_transformation.hpp
r1542 r1584 87 87 */ 88 88 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); 89 91 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) ; 93 103 94 104 protected: -
XIOS/dev/dev_olga/src/transformation/grid_transformation.cpp
r1542 r1584 346 346 std::list<RecvIndexGridDestinationMap>().swap(localIndexToReceiveOnGridDest_); 347 347 std::list<size_t>().swap(nbLocalIndexOnGridDest_); 348 std::list<std::vector<bool> >().swap(localMaskOnGridDest_);348 // std::list<std::vector<bool> >().swap(localMaskOnGridDest_); 349 349 } 350 350 else … … 399 399 vector<int> localDst ; 400 400 vector<double> weight ; 401 localMaskOnGridDest_.push_back(vector<bool>()) ; 401 int nbLocalIndexOnGridDest; 402 // localMaskOnGridDest_.push_back(vector<bool>()) ; 402 403 CTimer::get("computeTransformationMappingNonDistributed").resume(); 404 // algo->computeTransformationMappingNonDistributed(elementPosition, gridSource_, tmpGridDestination_, 405 // localSrc, localDst, weight, localMaskOnGridDest_.back()) ; 403 406 algo->computeTransformationMappingNonDistributed(elementPosition, gridSource_, tmpGridDestination_, 404 localSrc, localDst, weight, localMaskOnGridDest_.back()) ;407 localSrc, localDst, weight, nbLocalIndexOnGridDest) ; 405 408 CTimer::get("computeTransformationMappingNonDistributed").suspend(); 406 409 407 410 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) ; 409 414 int clientRank=client->clientRank ; 410 415 { … … 472 477 size_t nbLocalIndex = globalLocalIndexGridDestSendToServer.size(); 473 478 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); 477 482 478 483 // Find out number of index sent from grid source and number of index received on grid destination … … 657 662 recvTmp[recvRank][realRecvSize].first = globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]; 658 663 recvTmp[recvRank][realRecvSize].second = recvWeightDst(idx); 659 tmpMask[globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]] = true;664 // tmpMask[globalLocalIndexGridDestSendToServer[recvIndexDst(idx)]] = true; 660 665 ++realRecvSize; 661 666 } … … 714 719 \return local mask of data 715 720 */ 716 const std::list<std::vector<bool> >& CGridTransformation::getLocalMaskIndexOnGridDest() const717 {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 49 49 const std::list<RecvIndexGridDestinationMap>& getLocalIndexToReceiveOnGridDest() const; 50 50 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; 52 52 53 53 CGrid* getGridSource() { return originalGridSource_; } … … 84 84 //! Number of local index of data to receive on grid destination 85 85 std::list<size_t> nbLocalIndexOnGridDest_; 86 std::list<std::vector<bool> > localMaskOnGridDest_;86 // std::list<std::vector<bool> > localMaskOnGridDest_; 87 87 88 88 bool dynamicalTransformation_;
Note: See TracChangeset
for help on using the changeset viewer.