- Timestamp:
- 02/01/22 15:28:48 (2 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_axis.cpp
r2270 r2291 79 79 80 80 } 81 82 bool local=false ; 83 if (!algo->local.isEmpty()) local=algo->local ; 81 84 82 int globalIndexSize = axisSource-> n_glo; 83 for (int idx = 0; idx < globalIndexSize; ++idx) transformationMapping_[0].push_back(idx); 85 auto& transMap = this->transformationMapping_; 86 87 if (local) 88 { 89 scalarDestination->n=1 ; // no mask 90 scalarDestination->mask.reset() ; 91 92 CArray<size_t,1> srcGlobalIndex ; 93 axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(srcGlobalIndex) ; 94 size_t nbIdx = srcGlobalIndex.numElements(); 95 if (nbIdx==0) scalarDestination->n=0 ; 96 scalarDestination->checkAttributes() ; 84 97 85 scalarDestination->checkAttributes() ; 98 for (size_t idx = 0; idx < nbIdx; ++idx) 99 { 100 size_t globalIdx = srcGlobalIndex(idx); 101 transformationMapping_[0].push_back(globalIdx); 102 } 103 104 } 105 else 106 { 107 scalarDestination->checkAttributes() ; 108 109 int globalIndexSize = axisSource->getLocalView(CElementView::WORKFLOW)->getGlobalSize(); 110 CArray<size_t,1> dstGlobalIndex ; 111 scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; 112 if (dstGlobalIndex.numElements()!=0) 113 for (int idx = 0; idx < globalIndexSize; ++idx) transformationMapping_[0].push_back(idx); 114 } 115 86 116 this->computeAlgorithm(axisSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; 87 117 -
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 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.cpp
r2270 r2291 10 10 #include "grid_transformation_factory_impl.hpp" 11 11 #include "reduction.hpp" 12 #include "grid_algorithm_reduce.hpp" 13 12 14 13 15 … … 47 49 TRY 48 50 { 49 eliminateRedondantSrc_= false;51 scalarDestination->checkAttributes() ; 50 52 if (algo->operation.isEmpty()) 51 53 ERROR("CScalarAlgorithmReduceScalar::CScalarAlgorithmReduceScalar(CScalar* scalarDestination, CScalar* scalarSource, CReduceScalarToScalar* algo)", … … 75 77 76 78 } 77 transformationMapping_[0].push_back(0) ; 79 80 auto& transMap = this->transformationMapping_; 81 82 CArray<size_t,1> dstGlobalIndex ; 83 scalarDestination->getLocalView(CElementView::WORKFLOW)->getGlobalIndexView(dstGlobalIndex) ; 84 size_t nbIdx = dstGlobalIndex.numElements(); 78 85 79 scalarDestination->checkAttributes() ; 86 for (size_t idx = 0; idx < nbIdx; ++idx) 87 { 88 size_t globalIdx = dstGlobalIndex(idx); 89 transMap[globalIdx].resize(1); 90 transMap[globalIdx][0]=globalIdx ; 91 } 92 80 93 this->computeAlgorithm(scalarSource->getLocalView(CElementView::WORKFLOW), scalarDestination->getLocalView(CElementView::WORKFLOW)) ; 81 94 } 82 95 CATCH 96 97 shared_ptr<CGridAlgorithm> CScalarAlgorithmReduceScalar::createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos) 98 { 99 auto algo=make_shared<CGridAlgorithmReduce>(gridSrc, gridDst, pos, shared_from_this(), operator_) ; 100 algo->computeAlgorithm(false) ; 101 return algo ; 102 } 83 103 84 104 CScalarAlgorithmReduceScalar::~CScalarAlgorithmReduceScalar() -
XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/scalar_algorithm/scalar_algorithm_reduce_scalar.hpp
r2270 r2291 42 42 std::map<int, int>& elementPositionInGridDst2AxisPosition, 43 43 std::map<int, int>& elementPositionInGridDst2DomainPosition); 44 virtual shared_ptr<CGridAlgorithm> createGridAlgorithm(CGrid* gridSrc, CGrid* gridDst, int pos); 44 45 static bool dummyRegistered_; 45 46 };
Note: See TracChangeset
for help on using the changeset viewer.