Changeset 1143 for XIOS/dev/dev_olga/src/node/axis.cpp
- Timestamp:
- 05/22/17 18:11:12 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/axis.cpp
r1129 r1143 25 25 , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 26 26 , isClientAfterTransformationChecked(false) 27 , isDistributed_(false),hasBounds_(false), isCompressible_(false)27 , hasBounds_(false), isCompressible_(false) 28 28 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 29 29 , transformationMap_(), hasValue(false), doZoomByIndex_(false) … … 36 36 , CAxisAttributes(), isChecked(false), relFiles(), areClientAttributesChecked_(false) 37 37 , isClientAfterTransformationChecked(false) 38 , isDistributed_(false),hasBounds_(false), isCompressible_(false)38 , hasBounds_(false), isCompressible_(false) 39 39 , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0) 40 40 , transformationMap_(), hasValue(false), doZoomByIndex_(false) … … 76 76 bool CAxis::isDistributed(void) const 77 77 { 78 return isDistributed_; 78 return (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 79 (!this->n.isEmpty() && (this->n != this->n_glo));; 79 80 } 80 81 … … 266 267 this->checkZoom(); 267 268 this->checkMask(); 268 this->checkBounds(); 269 270 isDistributed_ = (!this->begin.isEmpty() && !this->n.isEmpty() && (this->begin + this->n < this->n_glo)) || 271 (!this->n.isEmpty() && (this->n != this->n_glo)); 269 this->checkBounds(); 272 270 } 273 271 … … 613 611 computedWrittenIndex_ = true; 614 612 615 CContext* context=CContext::getCurrent() ;616 CContext Client* client = context->client;613 CContext* context=CContext::getCurrent(); 614 CContextServer* server = context->server; 617 615 618 616 std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1); … … 621 619 nBeginGlobal[0] = 0; 622 620 nGlob[0] = n_glo; 623 CDistributionServer srvDist( client->clientSize, nBegin, nSize, nBeginGlobal, nGlob);621 CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 624 622 const CArray<size_t,1>& writtenGlobalIndex = srvDist.getGlobalIndex(); 625 623 … … 628 626 ite = globalLocalIndexMap_.end(), it; 629 627 CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(), 630 itSrve = writtenGlobalIndex.end(), itSrv; 631 localIndexToWriteOnServer.resize(writtenGlobalIndex.numElements()); 628 itSrve = writtenGlobalIndex.end(), itSrv; 629 630 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 631 { 632 indGlo = *itSrv; 633 if (ite != globalLocalIndexMap_.find(indGlo)) 634 { 635 ++nbWritten; 636 } 637 } 638 639 localIndexToWriteOnServer.resize(nbWritten); 640 641 nbWritten = 0; 632 642 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 633 643 { … … 638 648 ++nbWritten; 639 649 } 650 } 651 652 if (isCompressible()) 653 { 654 nbWritten = 0; 655 boost::unordered_map<size_t,size_t> localGlobalIndexMap; 656 for (itSrv = itSrvb; itSrv != itSrve; ++itSrv) 657 { 658 indGlo = *itSrv; 659 if (ite != globalLocalIndexMap_.find(indGlo)) 660 { 661 localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo; 662 ++nbWritten; 663 } 664 } 665 666 nbWritten = 0; 667 for (int idx = 0; idx < data_index.numElements(); ++idx) 668 { 669 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 670 { 671 ++nbWritten; 672 } 673 } 674 675 compressedIndexToWriteOnServer.resize(nbWritten); 676 nbWritten = 0; 677 for (int idx = 0; idx < data_index.numElements(); ++idx) 678 { 679 if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx))) 680 { 681 compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_index(idx)]; 682 ++nbWritten; 683 } 684 } 685 686 numberWrittenIndexes_ = nbWritten; 687 if (isDistributed()) 688 { 689 690 MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 691 MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm); 692 offsetWrittenIndexes_ -= numberWrittenIndexes_; 693 } 694 else 695 totalNumberWrittenIndexes_ = numberWrittenIndexes_; 640 696 } 641 697
Note: See TracChangeset
for help on using the changeset viewer.