Changeset 2291 for XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.cpp
- Timestamp:
- 02/01/22 15:28:48 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_domain.cpp
r2270 r2291 74 74 } 75 75 76 TransformationIndexMap& transMap = this->transformationMapping_; 77 78 int ni_glo = domainSrc_->ni_glo ; 79 int nj_glo = domainSrc_->nj_glo ; 80 int nbDomainIdx ; 76 bool local=false ; 77 if (!algo->local.isEmpty()) local=algo->local ; 81 78 82 bool local = algo->local ;79 auto& transMap = this->transformationMapping_; 83 80 84 81 if (local) 85 82 { 86 const CArray<int, 1>& i_index = domainSrc_-> i_index.getValue() ; 87 const CArray<int, 1>& j_index = domainSrc_-> j_index.getValue() ; 88 const CArray<bool,1>& localMask = domainSrc_-> localMask ; 89 int nbDomainIdx = i_index.numElements(); 83 scalarDestination->n=1 ; // no mask 84 scalarDestination->mask.reset() ; 85 86 CArray<size_t,1> srcGlobalIndex ; 87 domainSource->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; 88 size_t nbIdx = srcGlobalIndex.numElements(); 89 if (nbIdx==0) scalarDestination->n=0 ; 90 scalarDestination->checkAttributes() ; 90 91 91 for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain) 92 { 93 if (localMask(idxDomain)) 94 { 95 transMap[0].push_back(j_index(idxDomain)* ni_glo + i_index(idxDomain)); 96 } 97 } 92 for (size_t idx = 0; idx < nbIdx; ++idx) 93 { 94 size_t globalIdx = srcGlobalIndex(idx); 95 transformationMapping_[0].push_back(globalIdx); 96 } 97 98 98 } 99 99 else 100 { 101 nbDomainIdx = ni_glo * nj_glo; 102 for (int idxDomain = 0; idxDomain < nbDomainIdx; ++idxDomain) transMap[0].push_back(idxDomain); 100 { 101 scalarDestination->checkAttributes() ; 102 103 int globalIndexSize = domainSource->getLocalView(CElementView::WORKFLOW)->getGlobalSize(); 104 CArray<size_t,1> dstGlobalIndex ; 105 scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; 106 if (dstGlobalIndex.numElements()!=0) 107 for (int idx = 0; idx < globalIndexSize; ++idx) transformationMapping_[0].push_back(idx); 103 108 } 104 105 scalarDestination->checkAttributes() ; 109 106 110 this->computeAlgorithm(domainSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; 111 107 112 } 108 113 CATCH
Note: See TracChangeset
for help on using the changeset viewer.